Changeset 1773
- Timestamp:
- Apr 2, 2015 10:56:59 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r1770 r1773 106 106 elif 'P' in dType: 107 107 return {'Histogram':histoName,'Show':False,'Scale':[1.0,False], 108 'Pref.Ori.':['MD',1.0,False,[0,0,1],0,{} ],108 'Pref.Ori.':['MD',1.0,False,[0,0,1],0,{},[],0.1], 109 109 'Size':['isotropic',[1.,1.,1.],[False,False,False],[0,0,1], 110 110 [1.,1.,1.,0.,0.,0.],6*[False,]], -
trunk/GSASIIddataGUI.py
r1772 r1773 473 473 newPOCoef[cofName] = POCoeff[cofName] 474 474 return newPOCoef 475 475 476 476 def OnExtRef(event): 477 477 Obj = event.GetEventObject() … … 740 740 741 741 def SHDataSizer(POData): 742 743 def OnODFValue(event): 744 Obj = event.GetEventObject() 745 odf = ODFIndx[Obj.GetId()] 746 try: 747 value = float(Obj.GetValue()) 748 POData[5][odf] = value 749 except ValueError: 750 pass 751 Obj.SetValue('%8.3f'%(POData[5][odf])) 752 G2plt.PlotSizeStrainPO(G2frame,data,hist) 753 742 754 textJ = G2lat.textureIndex(POData[5]) 743 755 mainSizer.Add(wx.StaticText(DData,-1,' Spherical harmonic coefficients: '+'Texture index: %.3f'%(textJ)),0,WACV) … … 751 763 ODFval = wx.TextCtrl(DData,wx.ID_ANY,'%8.3f'%(POData[5][odf]),style=wx.TE_PROCESS_ENTER) 752 764 ODFIndx[ODFval.GetId()] = odf 753 #ODFval.Bind(wx.EVT_TEXT_ENTER,OnODFValue)754 #ODFval.Bind(wx.EVT_KILL_FOCUS,OnODFValue)765 ODFval.Bind(wx.EVT_TEXT_ENTER,OnODFValue) 766 ODFval.Bind(wx.EVT_KILL_FOCUS,OnODFValue) 755 767 ODFSizer.Add(ODFval,0,WACV) 756 768 return ODFSizer 769 770 def SHPenalty(POData): 771 772 def OnHKLList(event): 773 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Select penalty hkls', 774 'Penalty hkls',hkls,filterBox=False) 775 try: 776 if dlg.ShowModal() == wx.ID_OK: 777 POData[6] = [hkls[i] for i in dlg.GetSelections()] 778 else: 779 return 780 finally: 781 dlg.Destroy() 782 wx.CallLater(100,UpdateDData,G2frame,DData,data) 783 784 def OnshToler(event): 785 try: 786 value = float(shToler.GetValue()) 787 POData[7] = value 788 except ValueError: 789 pass 790 shToler.SetValue('%.2f'%(POData[7])) 791 792 A = G2lat.cell2A(generalData['Cell'][1:7]) 793 hkls = G2lat.GenPfHKLs(10,SGData,A) 794 shPenalty = wx.BoxSizer(wx.HORIZONTAL) 795 shPenalty.Add(wx.StaticText(DData,-1,' Negative MRD penalty list: '),0,WACV) 796 shPenalty.Add(wx.ComboBox(DData,value=POData[6][0],choices=POData[6], 797 style=wx.CB_DROPDOWN),0,WACV) 798 hklList = wx.Button(DData,label='Select penalty hkls') 799 hklList.Bind(wx.EVT_BUTTON,OnHKLList) 800 shPenalty.Add(hklList,0,WACV) 801 shPenalty.Add(wx.StaticText(DData,-1,' Zero MRD tolerance: '),0,WACV) 802 shToler = wx.TextCtrl(DData,-1,'%.2f'%(POData[7]),style=wx.TE_PROCESS_ENTER) 803 shToler.Bind(wx.EVT_TEXT_ENTER,OnshToler) 804 shToler.Bind(wx.EVT_KILL_FOCUS,OnshToler) 805 shPenalty.Add(shToler,0,WACV) 806 return shPenalty 757 807 758 808 def ExtSizer(): … … 975 1025 poSizer = wx.BoxSizer(wx.VERTICAL) 976 1026 POData = UseList[hist]['Pref.Ori.'] 1027 # patch - add penalty items 1028 if len(POData) < 7: 1029 POData.append(['']) 1030 POData.append(0.1) 1031 # end patch 977 1032 poSizer.Add(PoTopSizer(POData)) 978 1033 if POData[0] == 'MD': … … 981 1036 if POData[4]: #SH order > 0 982 1037 poSizer.Add(SHDataSizer(POData)) 1038 poSizer.Add(SHPenalty(POData)) 983 1039 984 1040 mainSizer.Add(poSizer) -
trunk/GSASIIlattice.py
r1766 r1773 862 862 HKL.append([h,k,l,1/math.sqrt(rdsq)]) 863 863 return sortHKLd(HKL,True,True) 864 865 def GenPfHKLs(nMax,SGData,A): 866 """Generate the unique pole figure reflections for a lattice and Bravais type. 867 Min d-spacing=1.0A & no more than nMax returned 868 869 :param nMax: maximum number of hkls returned 870 :param SGData: space group dictionary with at least 871 872 * 'SGLaue': Laue group symbol: one of '-1','2/m','mmm','4/m','6/m','4/mmm','6/mmm', '3m1', '31m', '3', '3R', '3mR', 'm3', 'm3m' 873 * 'SGLatt': lattice centering: one of 'P','A','B','C','I','F' 874 * 'SGUniq': code for unique monoclinic axis one of 'a','b','c' (only if 'SGLaue' is '2/m') otherwise an empty string 875 876 :param A: reciprocal metric tensor elements as [G11,G22,G33,2*G12,2*G13,2*G23] 877 :return: HKL = list of 'h k l' strings sorted with largest d first; no duplicate zones 878 879 """ 880 HKL = np.array(GenHLaue(1.0,SGData,A)).T[:3].T #strip d-spacings 881 N = min(nMax,len(HKL)) 882 return ['%d %d %d'%(h[0],h[1],h[2]) for h in HKL[:N]] 883 864 884 865 885 def GenSSHLaue(dmin,SGData,SSGData,Vec,maxH,A): -
trunk/GSASIIphsGUI.py
r1772 r1773 5772 5772 5773 5773 def OnTextureRefine(event): 5774 print 'refine texture ?'5774 print 'refine texture maybe from C[i,j] in seq. result? not yet' 5775 5775 event.Skip() 5776 5776 5777 5777 def OnTextureClear(event): 5778 print 'clear texture? '5778 print 'clear texture? - does nothing' 5779 5779 event.Skip() 5780 5780 -
trunk/GSASIIstrIO.py
r1771 r1773 2071 2071 controlDict[pfx+'SHord'] = hapData['Pref.Ori.'][4] 2072 2072 controlDict[pfx+'SHncof'] = len(hapData['Pref.Ori.'][5]) 2073 controlDict[pfx+'SHhkl'] = [eval(a.replace(' ',',')) for a in hapData['Pref.Ori.'][6]] 2074 controlDict[pfx+'SHtoler'] = hapData['Pref.Ori.'][7] 2073 2075 for item in hapData['Pref.Ori.'][5]: 2074 2076 hapDict[pfx+item] = hapData['Pref.Ori.'][5][item] … … 2119 2121 else: #'SH' for spherical harmonics 2120 2122 PrintSHPO(hapData['Pref.Ori.']) 2123 print >>pFile,' Penalty hkl list: '+str(controlDict[pfx+'SHhkl'])+' tolerance: %.2f'%(controlDict[pfx+'SHtoler']) 2121 2124 PrintSize(hapData['Size']) 2122 2125 PrintMuStrain(hapData['Mustrain'],SGData) -
trunk/exports/G2export_csv.py
r1762 r1773 24 24 import GSASIIobj as G2obj 25 25 import GSASIImath as G2mth 26 import GSASIIpwd as G2pwd 26 27 27 28 def WriteList(obj,headerItems): … … 248 249 tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]] 249 250 if phasDict.get('Super',False): 250 WriteList(self,("h","k","l","m",tname,"F_obs","F_calc","phase","mult"," phase #"))251 fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{: d}"251 WriteList(self,("h","k","l","m",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","phase #")) 252 fmt = "{:.0f},{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:d}" 252 253 refList = phasDict['RefList'] 253 254 for refItem in refList: 254 255 h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:13] 255 self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,i)) 256 FWHM = G2pwd.getgamFW(gam,sig) 257 self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,i)) 256 258 else: 257 WriteList(self,("h","k","l",tname,"F_obs","F_calc","phase","mult"," phase #"))258 fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{: d}"259 WriteList(self,("h","k","l",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","phase #")) 260 fmt = "{:.0f},{:.0f},{:.0f},{:.3f},{:.3f},{:.3f},{:.2f},{:.0f},{:.3f},{:.3f},{:.3f},{:d}" 259 261 refList = phasDict['RefList'] 260 262 for refItem in refList: 261 263 h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr = refItem[:12] 262 self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,i)) 264 FWHM = G2pwd.getgamFW(gam,sig) 265 self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,i)) 263 266 self.CloseFile() 264 267 print(str(hist)+'reflections written to file '+str(self.fullpath)) -
trunk/exports/G2export_examples.py
r1762 r1773 28 28 #import GSASIIstrIO as G2stIO 29 29 import GSASIImath as G2mth 30 import GSASIIpwd as G2pwd 30 31 #import GSASIIlattice as G2lat 31 32 #import GSASIIspc as G2spc … … 192 193 tname = {'T':'TOF','C':'2-theta'}[phasDict['Type'][2]] 193 194 self.Write('\nPhase '+str(phasenam)) 194 self.Write(80*'=')195 195 if phasDict.get('Super',False): 196 self.Write(87*'=') 196 197 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(8 0*'=')198 hfmt = "{:>10s} {:>8s} {:>12s} {:>12s} {:>7s} {:>6s} {:>8s} {:>8s} {:>8s}" 199 fmt = "{:>10s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.3f} {:8.3f} {:8.3f}" 200 self.Write(hfmt.format("h,k,l,m",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM")) 201 self.Write(87*'=') 201 202 refList = phasDict['RefList'] 202 203 for refItem in refList: 203 204 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 FWHM = G2pwd.getgamFW(gam,sig) 206 self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM)) 205 207 else: 208 self.Write(85*'=') 206 209 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(8 0*'=')210 hfmt = "{:>8s} {:>8s} {:>12s} {:>12s} {:>7s} {:>6s} {:>8s} {:>8s} {:>8s}" 211 fmt = "{:>8s} {:8.3f} {:12.3f} {:12.3f} {:7.2f} {:6.0f} {:8.3f} {:8.3f} {:8.3f}" 212 self.Write(hfmt.format("h,k,l",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM")) 213 self.Write(85*'=') 211 214 refList = phasDict['RefList'] 212 215 for refItem in refList: 213 216 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)) 217 FWHM = G2pwd.getgamFW(gam,sig) 218 self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM)) 215 219 self.CloseFile() 216 220 print(str(hist)+'reflections written to file '+str(self.fullpath)) -
trunk/imports/G2sfact_CIF.py
r1762 r1773 113 113 im = 0 114 114 for i in range(2): 115 if hklitems[i][3] in blkkeys: #Super lattice reflections h,k,l,m 116 im = 1 115 117 if hklitems[i][0] in blkkeys and hklitems[i][1] in blkkeys and hklitems[i][2] in blkkeys: 116 118 dnIndex = i 117 if hklitems[i][3] in blkkeys: #Super lattice reflections h,k,l,m118 im = 1119 119 break 120 120 else: … … 216 216 if dn in itemkeys: 217 217 F2dn = dn 218 for d nin F2calcnames:219 if d nin itemkeys:220 F2cdn = d n218 for dm in F2calcnames: 219 if dm in itemkeys: 220 F2cdn = dm 221 221 FcalcPresent = True 222 222 break 223 for d nin F2signames:224 if d nin itemkeys:225 F2sdn = d n223 for dm in F2signames: 224 if dm in itemkeys: 225 F2sdn = dm 226 226 break 227 227 break … … 230 230 if dn in itemkeys: 231 231 Fdn = dn 232 for d nin Fcalcnames:233 if d nin itemkeys:234 Fcdn = d n232 for dm in Fcalcnames: 233 if dm in itemkeys: 234 Fcdn = dm 235 235 FcalcPresent = True 236 236 break 237 for d nin Fsignames:238 if d nin itemkeys:239 Fsdn = d n237 for dm in Fsignames: 238 if dm in itemkeys: 239 Fsdn = dm 240 240 break 241 241 break … … 258 258 HKL = [] 259 259 try: 260 for i in hklitems[dnIndex] : # '_refln[._]index_[hkl]'260 for i in hklitems[dnIndex][:3+im]: # '_refln[._]index_[hkl]' 261 261 num = itemkeys.get(i) 262 262 try:
Note: See TracChangeset
for help on using the changeset viewer.