Changeset 1836


Ignore:
Timestamp:
May 5, 2015 9:22:56 AM (8 years ago)
Author:
vondreele
Message:

add Prfo to export powder reflections as txt & csv
fix G2ctrls (remove a couple of G2Gs)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrls.py

    r1832 r1836  
    20852085    if multiple:
    20862086        if useCancel:
    2087             dlg = G2G.G2MultiChoiceDialog(
     2087            dlg = G2MultiChoiceDialog(
    20882088                ParentFrame,title, header, ChoiceList)
    20892089        else:
    2090             dlg = G2G.G2MultiChoiceDialog(
     2090            dlg = G2MultiChoiceDialog(
    20912091                ParentFrame,title, header, ChoiceList,
    20922092                style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.OK|wx.CENTRE)
  • trunk/exports/G2export_csv.py

    r1791 r1836  
    239239        hist = self.histnam[0] # there should only be one histogram, in any case take the 1st
    240240        histblk = self.Histograms[hist]
     241        self.Write('"Histogram"')
     242        self.Write('"'+hist+'"')
     243        self.Write('')
    241244        # table of phases
    242245        self.Write('"Phase name","phase #"')
     
    249252            tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]]
    250253            if phasDict.get('Super',False):
    251                 WriteList(self,("h","k","l","m",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","phase #"))
     254                WriteList(self,("h","k","l","m",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo","phase #"))
    252255                if 'T' in phasDict['Type']:
    253                     fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:d}"
     256                    fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:.4f},{:d}"
    254257                else:
    255                     fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.5f},{:.5f},{:.5f},{:d}"
     258                    fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.5f},{:.5f},{:.5f},{:.4f},{:d}"
    256259                refList = phasDict['RefList']
    257260                for refItem in refList:
    258                     h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:13]
    259                     FWHM = G2pwd.getgamFW(gam,sig)
    260261                    if 'T' in phasDict['Type']:
     262                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,x,x,x,Prfo = refItem[:17]
     263                        FWHM = G2pwd.getgamFW(gam,sig)
    261264                        self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,i))
    262265                    else:        #convert to deg       
     266                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,Prfo = refItem[:14]
     267                        FWHM = G2pwd.getgamFW(gam,sig)
    263268                        self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,    \
    264269                            np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.,i))
    265270            else:
    266                 WriteList(self,("h","k","l",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","phase #"))
     271                WriteList(self,("h","k","l",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo","phase #"))
    267272                if 'T' in phasDict['Type']:
    268                     fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:d}"
     273                    fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:.4f},{:d}"
    269274                else:
    270                     fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.5f},{:.5f},{:.5f},{:d}"
     275                    fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.5f},{:.5f},{:.5f},{:.4f},{:d}"
    271276                refList = phasDict['RefList']
    272277                for refItem in refList:
    273                     h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:12]
    274                     FWHM = G2pwd.getgamFW(gam,sig)
    275278                    if 'T' in phasDict['Type']:
    276                         self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,i))
     279                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,x,x,x,Prfo = refItem[:16]
     280                        FWHM = G2pwd.getgamFW(gam,sig)
     281                        self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,Prfo,i))
    277282                    else:        #convert to deg       
     283                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,Prfo = refItem[:13]
     284                        FWHM = G2pwd.getgamFW(gam,sig)
    278285                        self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,  \
    279                             np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.,i))
     286                            np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.,Prfo,i))
    280287        self.CloseFile()
    281288        print(str(hist)+'reflections written to file '+str(self.fullpath))
  • trunk/exports/G2export_examples.py

    r1791 r1836  
    189189        self.OpenFile()
    190190        hist = self.histnam[0] # there should only be one histogram, in any case take the 1st
     191        self.Write('\nHistogram '+hist)
    191192        histblk = self.Histograms[hist]
    192193        for phasenam in histblk['Reflection Lists']:
     
    195196            self.Write('\nPhase '+str(phasenam))
    196197            if phasDict.get('Super',False):
    197                 self.Write(87*'=')
     198                self.Write(96*'=')
    198199                hklfmt = "{:.0f},{:.0f},{:.0f},{:.0f}"
    199                 hfmt = "{:>10s} {:>8s} {:>12s} {:>12s} {:>7s} {:>6s} {:>8s} {:>8s} {:>8s}"
     200                hfmt = "{:>10s} {:>8s} {:>12s} {:>12s} {:>7s} {:>6s} {:>8s} {:>8s} {:>8s} {:>8s}"
    200201                if 'T' in phasDict['Type']:
    201                     fmt = "{:>10s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.3f} {:8.3f} {:8.3f}"
    202                 else:
    203                     fmt = "{:>10s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.5f} {:8.5f} {:8.5f}"
    204                 self.Write(hfmt.format("h,k,l,m",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM"))
    205                 self.Write(87*'=')
     202                    fmt = "{:>10s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.3f} {:8.3f} {:8.3f} {:8.4f}"
     203                else:
     204                    fmt = "{:>10s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.5f} {:8.5f} {:8.5f} {:8.4f}"
     205                self.Write(hfmt.format("h,k,l,m",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo"))
     206                self.Write(96*'=')
    206207                refList = phasDict['RefList']
    207208                for refItem in refList:
    208                     h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase = refItem[:12]
    209                     FWHM = G2pwd.getgamFW(gam,sig)
    210209                    if 'T' in phasDict['Type']:
    211                         self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM))
     210                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,x,x,x,prfo = refItem[:17]
     211                        FWHM = G2pwd.getgamFW(gam,sig)
     212                        self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,prfo))
    212213                    else:
     214                        h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,prfo = refItem[:14]
     215                        FWHM = G2pwd.getgamFW(gam,sig)
    213216                        self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult, \
    214                             np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.))
     217                            np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.,prfo))
    215218            else:
    216                 self.Write(85*'=')
     219                self.Write(94*'=')
    217220                hklfmt = "{:.0f},{:.0f},{:.0f}"
    218                 hfmt = "{:>8s} {:>8s} {:>12s} {:>12s} {:>7s} {:>6s} {:>8s} {:>8s} {:>8s}"
     221                hfmt = "{:>8s} {:>8s} {:>12s} {:>12s} {:>7s} {:>6s} {:>8s} {:>8s} {:>8s} {:>8s}"
    219222                if 'T' in phasDict['Type']:
    220                     fmt = "{:>8s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.3f} {:8.3f} {:8.3f}"
    221                 else:
    222                     fmt = "{:>8s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.5f} {:8.5f} {:8.5f}"
    223                 self.Write(hfmt.format("h,k,l",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM"))
    224                 self.Write(85*'=')
     223                    fmt = "{:>8s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.3f} {:8.3f} {:8.3f} {:8.4f}"
     224                else:
     225                    fmt = "{:>8s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.5f} {:8.5f} {:8.5f} {:8.4f}"
     226                self.Write(hfmt.format("h,k,l",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo"))
     227                self.Write(94*'=')
    225228                refList = phasDict['RefList']
    226229                for refItem in refList:
    227                     h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase = refItem[:11]
    228                     FWHM = G2pwd.getgamFW(gam,sig)
    229230                    if 'T' in phasDict['Type']:
    230                         self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM))
     231                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,x,x,x,prfo = refItem[:16]
     232                        FWHM = G2pwd.getgamFW(gam,sig)
     233                        self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,prfo))
    231234                    else:
     235                        h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,prfo = refItem[:13]
     236                        FWHM = G2pwd.getgamFW(gam,sig)
    232237                        self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult,   \
    233                             np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.))
     238                            np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.,prfo))
    234239        self.CloseFile()
    235240        print(str(hist)+'reflections written to file '+str(self.fullpath))                       
Note: See TracChangeset for help on using the changeset viewer.