Changeset 1762 for trunk/exports


Ignore:
Timestamp:
Mar 25, 2015 3:42:15 PM (7 years ago)
Author:
vondreele
Message:

fix exports of reflection csv & txt files to work for CW & TOF data as well as
3 & (3+1) symmetries
fix Det-X --> Det-Y
remove a Yield - caused crash
fix c-unique & a-unique monoclinit cell refinement & display
fix cif readers for phase

Location:
trunk/exports
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_csv.py

    r1761 r1762  
    246246        for i,phasenam in enumerate(sorted(histblk['Reflection Lists'])):
    247247            phasDict = histblk['Reflection Lists'][phasenam]
    248             if phasDict['Super']:
    249                 WriteList(self,("h","k","l","m","2-theta","F_obs","F_calc","phase","mult","phase #"))
     248            tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]]
     249            if phasDict.get('Super',False):
     250                WriteList(self,("h","k","l","m",tname,"F_obs","F_calc","phase","mult","phase #"))
    250251                fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:d}"
    251252                refList = phasDict['RefList']
    252253                for refItem in refList:
    253                     h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:12]
     254                    h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:13]
    254255                    self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,i))               
    255256            else:
    256                 WriteList(self,("h","k","l","2-theta","F_obs","F_calc","phase","mult","phase #"))
     257                WriteList(self,("h","k","l",tname,"F_obs","F_calc","phase","mult","phase #"))
    257258                fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:d}"
    258259                refList = phasDict['RefList']
    259260                for refItem in refList:
    260                     h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:11]
     261                    h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:12]
    261262                    self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,i))
    262263        self.CloseFile()
     
    289290        hist = self.histnam[0] # there should only be one histogram, in any case take the 1st
    290291        histblk = self.Histograms[hist]
    291         WriteList(self,("h","k","l","d-space","F_obs","sig(Fobs)","F_calc","phase","mult"))
    292         fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.2f},{:.4f},{:.2f},{:.2f},{:.0f}"
    293         for (
    294             h,k,l,mult,dsp,Fobs,sigFobs,Fcalc,FobsT,FcalcT,phase,Icorr
    295             ) in histblk['Data']['RefList']:
    296             self.Write(fmt.format(h,k,l,dsp,Fobs,sigFobs,Fcalc,phase,mult))
     292        for i,phasenam in enumerate(sorted(histblk['Reflection Lists'])):
     293            phasDict = histblk['Reflection Lists'][phasenam]
     294            tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]]
     295            if phasDict.get('Super',False):
     296                WriteList(self,("h","k","l","m",tname,"F_obs","F_calc","phase","mult","phase #"))
     297                fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:d}"
     298                refList = phasDict['RefList']
     299                for refItem in refList:
     300                    h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:13]
     301                    self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,i))               
     302            else:
     303                WriteList(self,("h","k","l",tname,"F_obs","F_calc","phase","mult","phase #"))
     304                fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:d}"
     305                refList = phasDict['RefList']
     306                for refItem in refList:
     307                    h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:12]
     308                    self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,i))
    297309        self.CloseFile()
    298310        print(str(hist)+' written to file '+str(self.fullname))                       
  • trunk/exports/G2export_examples.py

    r1261 r1762  
    188188        hist = self.histnam[0] # there should only be one histogram, in any case take the 1st
    189189        histblk = self.Histograms[hist]
    190         hklfmt = "{:.0f},{:.0f},{:.0f}"
    191         hfmt = "{:>8s} {:>8s} {:>12s} {:>12s} {:>7s} {:>6s}"
    192         fmt = "{:>8s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f}"
    193190        for phasenam in histblk['Reflection Lists']:
     191            phasDict = histblk['Reflection Lists'][phasenam]
     192            tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]]
    194193            self.Write('\nPhase '+str(phasenam))
    195194            self.Write(80*'=')
    196             self.Write(hfmt.format("h,k,l","2-theta","F_obs","F_calc","phase","mult"))
    197             self.Write(80*'=')
    198             for (
    199                 h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr
    200                 ) in histblk['Reflection Lists'][phasenam]['RefList']:
    201                 self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult))
     195            if phasDict.get('Super',False):
     196                hklfmt = "{:.0f},{:.0f},{:.0f},{:.0f}"
     197                hfmt = "{:>8s} {:>8s} {:>12s} {:>12s} {:>7s} {:>6s}"
     198                fmt = "{:>8s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f}"
     199                self.Write(hfmt.format("h,k,l,m",tname,"F_obs","F_calc","phase","mult"))
     200                self.Write(80*'=')
     201                refList = phasDict['RefList']
     202                for refItem in refList:
     203                    h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase = refItem[:12]
     204                    self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult))
     205            else:
     206                hklfmt = "{:.0f},{:.0f},{:.0f}"
     207                hfmt = "{:>8s} {:>8s} {:>12s} {:>12s} {:>7s} {:>6s}"
     208                fmt = "{:>8s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f}"
     209                self.Write(hfmt.format("h,k,l",tname,"F_obs","F_calc","phase","mult"))
     210                self.Write(80*'=')
     211                refList = phasDict['RefList']
     212                for refItem in refList:
     213                    h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase = refItem[:11]
     214                    self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult))
    202215        self.CloseFile()
    203216        print(str(hist)+'reflections written to file '+str(self.fullpath))                       
Note: See TracChangeset for help on using the changeset viewer.