Changeset 4522


Ignore:
Timestamp:
Jul 16, 2020 9:30:05 AM (3 years ago)
Author:
vondreele
Message:

fix exporters for pink reflection data

Location:
trunk/exports
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_csv.py

    r4190 r4522  
    338338        for i,phasenam in enumerate(sorted(histblk['Reflection Lists'])):
    339339            phasDict = histblk['Reflection Lists'][phasenam]
    340             tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]]
     340            tname = {'T':'TOF','C':'2-theta','B':'2-theta'}[phasDict['Type'][2]]
    341341            if phasDict.get('Super',False):
    342342                WriteList(self,("h","k","l","m","d-sp",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo","phase #"))
     
    351351                        FWHM = G2pwd.getgamFW(gam,sig)
    352352                        self.Write(fmt.format(h,k,l,m,dsp,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,i))
    353                     else:        #convert to deg       
     353                    elif 'C' in phasDict['Type']:        #convert to deg       
    354354                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,Prfo = refItem[:14]
     355                        s = np.sqrt(max(sig,0.0001))/100.   #var -> sig in deg
     356                        g = gam/100.    #-> deg
     357                        FWHM = G2pwd.getgamFW(g,s)
     358                        self.Write(fmt.format(h,k,l,m,dsp,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,i))
     359                    elif 'B' in phasDict['Type']:        #convert to deg       
     360                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,x,x,x,Prfo = refItem[:17]
    355361                        s = np.sqrt(max(sig,0.0001))/100.   #var -> sig in deg
    356362                        g = gam/100.    #-> deg
     
    369375                        FWHM = G2pwd.getgamFW(gam,sig)
    370376                        self.Write(fmt.format(h,k,l,dsp,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,Prfo,i))
    371                     else:        #convert to deg       
     377                    elif 'C' in phasDict['Type']:        #convert to deg       
    372378                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,Prfo = refItem[:13]
     379                        g = gam/100.
     380                        s = np.sqrt(max(sig,0.0001))/100.
     381                        FWHM = G2pwd.getgamFW(g,s)
     382                        self.Write(fmt.format(h,k,l,dsp,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,Prfo,i))
     383                    elif 'B' in phasDict['Type']:        #convert to deg       
     384                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,x,x,x,Prfo = refItem[:16]
    373385                        g = gam/100.
    374386                        s = np.sqrt(max(sig,0.0001))/100.
  • trunk/exports/G2export_examples.py

    r3990 r4522  
    199199        for phasenam in histblk['Reflection Lists']:
    200200            phasDict = histblk['Reflection Lists'][phasenam]
    201             tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]]
     201            tname = {'T':'TOF','C':'2-theta','B':'2-theta'}[phasDict['Type'][2]]
    202202            self.Write('\nPhase '+str(phasenam))
    203203            if phasDict.get('Super',False):
     
    217217                        FWHM = G2pwd.getgamFW(gam,sig)
    218218                        self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,prfo))
    219                     else:
     219                    elif 'C' in phasDict['Type']:
    220220                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,prfo = refItem[:14]
     221                        g = gam/100.    #centideg -> deg
     222                        s = np.sqrt(max(sig,0.0001))/100.   #var -> sig in deg
     223                        FWHM = G2pwd.getgamFW(g,s)  #FWHM
     224                        self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult,s,g,FWHM,prfo))
     225                    elif 'B' in phasDict['Type']:
     226                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,x,x,x,prfo = refItem[:17]
    221227                        g = gam/100.    #centideg -> deg
    222228                        s = np.sqrt(max(sig,0.0001))/100.   #var -> sig in deg
     
    239245                        FWHM = G2pwd.getgamFW(gam,sig)
    240246                        self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult,np.sqrt(max(sig,0.0001)),gam,FWHM,prfo))
    241                     else:
     247                    elif 'C' in phasDict['Type']:
    242248                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,prfo = refItem[:13]
     249                        g = gam/100.    #centideg -> deg
     250                        s = np.sqrt(max(sig,0.0001))/100.   #var -> sig in deg
     251                        FWHM = G2pwd.getgamFW(g,s)
     252                        self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult,   \
     253                            s,g,FWHM,prfo))
     254                    elif 'B' in phasDict['Type']:
     255                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,x,x,x,prfo = refItem[:16]
    243256                        g = gam/100.    #centideg -> deg
    244257                        s = np.sqrt(max(sig,0.0001))/100.   #var -> sig in deg
  • trunk/exports/G2export_pwdr.py

    r4072 r4522  
    4242        '''Write an instrument parameter file
    4343        '''
    44         if 'T' in Inst['Type'][0]:      #can't do TOF iparm files
     44        if 'T' in Inst['Type'][0] or 'B' in Inst['Type'][0]:      #can't do TOF or pink iparm files
    4545            return None
    4646        prmname = os.path.splitext(self.filename)[0] + '.prm'
     
    7373        if prmname: self.Write('Instrument parameter file:'+os.path.split(prmname)[1])
    7474        x = np.array(histblk['Data'][0])
    75         if 'C' in histblk['Instrument Parameters'][0]['Type'][0]:
    76             x *= 100.
    77         else:
     75        if 'T' in histblk['Instrument Parameters'][0]['Type'][0]:
    7876            cw = np.diff(x)
    7977            x[:-1] += cw
     78        else:
     79            x *= 100.
    8080        # convert weights to sigmas; use largest weight as minimum esd
    8181        s = np.sqrt(np.maximum(0.,np.array(histblk['Data'][2])))
Note: See TracChangeset for help on using the changeset viewer.