Changeset 2141
 Timestamp:
 Feb 5, 2016 9:50:49 AM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASII.py
r2135 r2141 3132 3132 3133 3133 def OnExportPeakList(self,event): 3134 nptand = lambda x: np.tan(x*math.pi/180.) 3134 3135 pth = G2G.GetExportPath(self) 3135 3136 dlg = wx.FileDialog(self, 'Choose output peak list file name', pth, '', … … 3154 3155 wave = G2mth.getWave(Inst) 3155 3156 elif name2 == 'Peak List': 3156 peaks = self.PatternTree.GetItemPyData(item2)['peaks'] 3157 pkdata = self.PatternTree.GetItemPyData(item2) 3158 peaks = pkdata['peaks'] 3159 sigDict = pkdata['sigDict'] 3157 3160 item2, cookie2 = self.PatternTree.GetNextChild(item, cookie2) 3158 3161 file.write("#%s \n" % (name+' Peak List')) … … 3160 3163 file.write('#wavelength = %10.6f\n'%(wave)) 3161 3164 if 'T' in Type: 3162 file.write('#%9s %10s %1 2s %10s %10s %10s %10s %10s\n'%('pos','dsp','int','alp','bet','sig','gam','FWHM'))3165 file.write('#%9s %10s %10s %12s %10s %10s %10s %10s %10s\n'%('pos','dsp','esd','int','alp','bet','sig','gam','FWHM')) 3163 3166 else: 3164 file.write('#%9s %10s %1 2s %10s %10s %10s\n'%('pos','dsp','int','sig','gam','FWHM'))3165 for peak in peaks:3167 file.write('#%9s %10s %10s %12s %10s %10s %10s\n'%('pos','dsp','esd','int','sig','gam','FWHM')) 3168 for ip,peak in enumerate(peaks): 3166 3169 dsp = G2lat.Pos2dsp(Inst,peak[0]) 3167 3170 if 'T' in Type: #TOF  more cols 3171 esds = {'pos':0.,'int':0.,'alp':0.,'bet':0.,'sig':0.,'gam':0.} 3172 for name in esds.keys(): 3173 esds[name] = sigDict.get('%s%d'%(name,ip),0.) 3168 3174 sig = np.sqrt(peak[8]) 3169 3175 gam = peak[10] 3176 esddsp = G2lat.Pos2dsp(Inst,esds['pos']) 3170 3177 FWHM = G2pwd.getgamFW(gam,sig) #to get deltaTOF from Gam(peak) 3171 file.write("%10.2f %10.5f %1 2.2f %10.3f %10.3f %10.3f %10.3f %10.3f\n" % \3172 (peak[0],dsp, peak[2],np.sqrt(max(0.0001,peak[4])),peak[6],peak[8],peak[10],FWHM))3178 file.write("%10.2f %10.5f %10.5f %12.2f %10.3f %10.3f %10.3f %10.3f %10.3f\n" % \ 3179 (peak[0],dsp,esddsp,peak[2],np.sqrt(max(0.0001,peak[4])),peak[6],peak[8],peak[10],FWHM)) 3173 3180 else: #CW 3181 #get esds from sigDict for each peak & put in output  esds for sig & gam from UVWXY? 3182 esds = {'pos':0.,'int':0.,'sig':0.,'gam':0.} 3183 for name in esds.keys(): 3184 esds[name] = sigDict.get('%s%d'%(name,ip),0.) 3174 3185 sig = np.sqrt(peak[4]) #var > sig 3175 3186 gam = peak[6] 3187 esddsp = 0.5*esds['pos']*dsp/nptand(peak[0]/2.) 3176 3188 FWHM = G2pwd.getgamFW(gam,sig) #to get delta2theta in deg. from Gam(peak) 3177 file.write("%10. 3f %10.5f %12.2f %10.5f %10.5f %10.5f \n" % \3178 (peak[0],dsp, peak[2],np.sqrt(max(0.0001,peak[4]))/100.,peak[6]/100.,FWHM/100.)) #convert to deg3189 file.write("%10.4f %10.5f %10.5f %12.2f %10.5f %10.5f %10.5f \n" % \ 3190 (peak[0],dsp,esddsp,peak[2],np.sqrt(max(0.0001,peak[4]))/100.,peak[6]/100.,FWHM/100.)) #convert to deg 3179 3191 item, cookie = self.PatternTree.GetNextChild(self.root, cookie) 3180 3192 file.close()
Note: See TracChangeset
for help on using the changeset viewer.