Changeset 3140


Ignore:
Timestamp:
Oct 25, 2017 2:56:22 PM (6 years ago)
Author:
vondreele
Message:

add d-spacing to export csv reflection tables

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_csv.py

    r3136 r3140  
    303303            tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]]
    304304            if phasDict.get('Super',False):
    305                 WriteList(self,("h","k","l","m",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo","phase #"))
     305                WriteList(self,("h","k","l","m","d-sp",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo","phase #"))
    306306                if 'T' in phasDict['Type']:
    307                     fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:.4f},{:d}"
     307                    fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.5f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:.4f},{:d}"
    308308                else:
    309                     fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.5f},{:.5f},{:.5f},{:.4f},{:d}"
     309                    fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.5f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.5f},{:.5f},{:.5f},{:.4f},{:d}"
    310310                refList = phasDict['RefList']
    311311                for refItem in refList:
     
    313313                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,x,x,x,Prfo = refItem[:17]
    314314                        FWHM = G2pwd.getgamFW(gam,sig)
    315                         self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,i))
     315                        self.Write(fmt.format(h,k,l,m,dsp,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,i))
    316316                    else:        #convert to deg       
    317317                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,Prfo = refItem[:14]
     
    319319                        g = gam/100.    #-> deg
    320320                        FWHM = G2pwd.getgamFW(g,s)
    321                         self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,i))
     321                        self.Write(fmt.format(h,k,l,m,dsp,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,i))
    322322            else:
    323                 WriteList(self,("h","k","l",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo","phase #"))
     323                WriteList(self,("h","k","l","d-sp",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo","phase #"))
    324324                if 'T' in phasDict['Type']:
    325                     fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:.4f},{:d}"
     325                    fmt = "{:.0f},{:.0f},{:.0f},{:.5f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:.4f},{:d}"
    326326                else:
    327                     fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.5f},{:.5f},{:.5f},{:.4f},{:d}"
     327                    fmt = "{:.0f},{:.0f},{:.0f},{:.5f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.5f},{:.5f},{:.5f},{:.4f},{:d}"
    328328                refList = phasDict['RefList']
    329329                for refItem in refList:
     
    331331                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,x,x,x,Prfo = refItem[:16]
    332332                        FWHM = G2pwd.getgamFW(gam,sig)
    333                         self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,Prfo,i))
     333                        self.Write(fmt.format(h,k,l,dsp,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,Prfo,i))
    334334                    else:        #convert to deg       
    335335                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,Prfo = refItem[:13]
     
    337337                        s = np.sqrt(max(sig,0.0001))/100.
    338338                        FWHM = G2pwd.getgamFW(g,s)
    339                         self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,Prfo,i))
    340         self.CloseFile()
    341         print(hist+'reflections written to file '+self.fullpath)
     339                        self.Write(fmt.format(h,k,l,dsp,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,Prfo,i))
     340        self.CloseFile()
     341        print(hist+' reflections written to file '+self.fullpath)
    342342
    343343class ExportSingleCSV(G2IO.ExportBaseclass):
     
    371371            tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]]
    372372            if phasDict.get('Super',False):
    373                 WriteList(self,("h","k","l","m",tname,"F_obs","F_calc","phase","mult","phase #"))
    374                 fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:d}"
     373                WriteList(self,("h","k","l","m",'d-sp',tname,"F_obs","F_calc","phase","mult","phase #"))
     374                fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.5f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:d}"
    375375                refList = phasDict['RefList']
    376376                for refItem in refList:
    377377                    h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:13]
    378                     self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,i))               
     378                    self.Write(fmt.format(h,k,l,m,dsp,pos,Fobs,Fcalc,phase,mult,i))               
    379379            else:
    380                 WriteList(self,("h","k","l",tname,"F_obs","F_calc","phase","mult","phase #"))
    381                 fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:d}"
     380                WriteList(self,("h","k","l",'d-sp',tname,"F_obs","F_calc","phase","mult","phase #"))
     381                fmt = "{:.0f},{:.0f},{:.0f},{:.5f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:d}"
    382382                refList = phasDict['RefList']
    383383                for refItem in refList:
    384384                    h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:12]
    385                     self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,i))
     385                    self.Write(fmt.format(h,k,l,dsp,pos,Fobs,Fcalc,phase,mult,i))
    386386        self.CloseFile()
    387387        print(hist+' written to file '+self.fullname)                       
  • trunk/imports/G2pwd_xye.py

    r3136 r3140  
    165165        Temperature = 300
    166166        for S in self.comments:
    167             if 'Temp' in S.split('=')[0]:
     167            if 'temp' in S.lower().split('=')[0]:
    168168                try:
    169169                    Temperature = float(S.split('=')[1])
Note: See TracChangeset for help on using the changeset viewer.