Changeset 2563
- Timestamp:
- Dec 7, 2016 11:53:18 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r2561 r2563 73 73 GSASIIpath.SetVersionNumber("$Revision$") 74 74 import GSASIIIO as G2IO 75 import GSASIIElem as G2elem 75 76 import GSASIIgrid as G2gd 76 77 import GSASIIctrls as G2G … … 3425 3426 3426 3427 def OnMakePDFs(self,event): 3427 '''Calculates PDFs 3428 ''' 3428 '''Sets up PDF data structure filled with defaults; if found chemical formula is inserted 3429 so a default PDF can be made. 3430 ''' 3431 sind = lambda x: math.sin(x*math.pi/180.) 3432 tth2q = lambda t,w:4.0*math.pi*sind(t/2.0)/w 3433 tof2q = lambda t,C:2.0*math.pi*C/t 3429 3434 TextList = [] 3430 PDFlist = [] 3435 ElLists = [] 3436 Qlimits = [] 3431 3437 Names = [] 3432 3438 if self.PatternTree.GetCount(): … … 3437 3443 if 'PWDR' in name: 3438 3444 TextList.append(name) 3445 Comments = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,id,'Comments')) 3446 Parms = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,id,'Instrument Parameters'))[0] 3447 fullLimits = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,id,'Limits'))[0] 3448 if 'C' in Parms['Type'][0]: 3449 wave = G2mth.getWave(Parms) 3450 qMax = tth2q(fullLimits[1],wave) 3451 else: #'T'of 3452 qMax = tof2q(fullLimits[0],Parms['difC'][1]) 3453 Qlimits.append([0.9*qMax,qMax]) 3454 ElList = {} 3455 for item in Comments: #grab chemical formula from Comments 3456 if 'formula' in item: 3457 formula = item.split('=')[1].split() 3458 elems = formula[::2] 3459 nums = formula[1::2] 3460 formula = zip(elems,nums) 3461 for [elem,num] in formula: 3462 ElData = G2elem.GetElInfo(elem,Parms) 3463 ElData['FormulaNo'] = float(num) 3464 ElList[elem] = ElData 3465 ElLists.append(ElList) 3439 3466 id, cookie = self.PatternTree.GetNextChild(self.root, cookie) 3440 3467 if len(TextList) < 1: … … 3444 3471 try: 3445 3472 if dlg.ShowModal() == wx.ID_OK: 3446 PDFlist = [TextList[i] for i in dlg.GetSelections()] 3447 for item in PDFlist: 3473 for i in dlg.GetSelections(): 3474 item = TextList[i] 3475 ElList = ElLists[i] 3448 3476 PWDRname = item[4:] 3449 3477 Id = self.PatternTree.AppendItem(parent=self.root,text='PDF '+PWDRname) … … 3452 3480 'Sample Bkg.':{'Name':'','Mult':-1.0,'Add':0.0}, 3453 3481 'Container':{'Name':'','Mult':-1.0,'Add':0.0}, 3454 'Container Bkg.':{'Name':'','Mult':-1.0,'Add':0.0},'ElList': {},3482 'Container Bkg.':{'Name':'','Mult':-1.0,'Add':0.0},'ElList':ElList, 3455 3483 'Geometry':'Cylinder','Diam':1.0,'Pack':0.50,'Form Vol':10.0, 3456 'DetType':'Image plate','ObliqCoeff':0.2,'Ruland':0.025,'QScaleLim': [0,100],3457 'Lorch':True,'BackRatio':0.0,'Rmax':100. }3484 'DetType':'Image plate','ObliqCoeff':0.2,'Ruland':0.025,'QScaleLim':Qlimits[i], 3485 'Lorch':True,'BackRatio':0.0,'Rmax':100.,'noRing':True} 3458 3486 self.PatternTree.SetItemPyData(self.PatternTree.AppendItem(Id,text='PDF Controls'),Data) 3459 3487 self.PatternTree.SetItemPyData(self.PatternTree.AppendItem(Id,text='I(Q)'+PWDRname),[]) -
trunk/GSASIIElem.py
r2546 r2563 21 21 import numpy as np 22 22 import atmdata 23 import GSASIImath as G2mth 23 24 24 25 getElSym = lambda sym: sym.split('+')[0].split('-')[0].capitalize() … … 216 217 AtomInfo['Lande g'] = 2.0 217 218 return AtomInfo 219 220 def GetElInfo(El,inst): 221 ElemSym = El.strip().capitalize() 222 if 'X' in inst['Type'][0]: 223 keV = 12.397639/G2mth.getWave(inst) 224 FpMu = FPcalc(GetXsectionCoeff(ElemSym), keV) 225 ElData = GetFormFactorCoeff(ElemSym)[0] 226 ElData['FormulaNo'] = 0.0 227 ElData.update(GetAtomInfo(ElemSym)) 228 ElData.update(dict(zip(['fp','fpp','mu'],FpMu))) 229 ElData.update(GetFFC5(El)) 230 else: #'N'eutron 231 ElData = {} 232 ElData.update(GetAtomInfo(ElemSym)) 233 ElData['FormulaNo'] = 0.0 234 ElData.update({'mu':0.0,'fp':0.0,'fpp':0.0}) 235 return ElData 218 236 219 237 def GetXsectionCoeff(El): -
trunk/GSASIIIO.py
r2561 r2563 897 897 Sample['Phi'] = data['GonioAngles'][2] 898 898 Sample['Azimuth'] = (azm+dazm)%360. #put here as bin center 899 polariz = 0.99 #set default polarization for synchrotron radiation! 900 for item in Comments: 901 if 'polariz' in item: 902 try: 903 polariz = float(item.split('=')[1]) 904 except: 905 polariz = 0.99 899 906 if 'PWDR' in Aname: 900 parms = ['PXC',data['wavelength'],0.0, 0.99,1.0,-0.10,0.4,0.30,1.0,0.0001,Azms[i]] #set polarization for synchrotron radiation!907 parms = ['PXC',data['wavelength'],0.0,polariz,1.0,-0.10,0.4,0.30,1.0,0.0001,Azms[i]] 901 908 elif 'SASD' in Aname: 902 909 Sample['Trans'] = data['SampleAbs'][0] -
trunk/GSASIIimage.py
r2556 r2563 900 900 TA,tam = Make2ThetaAzimuthMap(data,masks,(iBeg,iFin),(jBeg,jFin),times) #2-theta & azimuth arrays & create position mask 901 901 Nup += 1 902 if dlg: 903 pause = dlg.Update(Nup)904 if not pause[0]: CancelPressed = True902 # if dlg and jBlk == 0: #update progress bar on each row 903 # pause = dlg.Update(Nup) 904 # if not pause[0]: CancelPressed = True 905 905 Block = image[iBeg:iFin,jBeg:jFin] 906 906 t0 = time.time() … … 909 909 times[2] += time.time()-t0 910 910 Nup += 1 911 if dlg: 912 pause = dlg.Update(Nup)913 if not pause[0]: CancelPressed = True911 # if dlg and jBlk == 0: #update progress bar on each row 912 # pause = dlg.Update(Nup) 913 # if not pause[0]: CancelPressed = True 914 914 tax = np.where(tax > LRazm[1],tax-360.,tax) #put azm inside limits if possible 915 915 tax = np.where(tax < LRazm[0],tax+360.,tax) … … 932 932 Nup += 1 933 933 del tax; del tay; del taz; del tad; del tabs 934 if dlg :934 if dlg and jBlk == 0: #update progress bar on each row 935 935 pause = dlg.Update(Nup) 936 936 if not pause[0]: CancelPressed = True -
trunk/GSASIIimgGUI.py
r2555 r2563 1329 1329 Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,name) 1330 1330 MId = G2gd.GetPatternTreeItemId(G2frame,Id,'Masks') 1331 Mask = copy.deepcopy(G2frame.PatternTree.GetItemPyData(MId))1332 Mask.update( Data)1331 Mask = G2frame.PatternTree.GetItemPyData(MId) 1332 Mask.update(copy.deepcopy(Data)) 1333 1333 Mask['Thresholds'][1][0] = Thresh[1][0] #copy only lower threshold 1334 1334 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id, 'Masks'),Mask) -
trunk/GSASIIplot.py
r2556 r2563 2357 2357 if G2frame.Contour: 2358 2358 G2frame.SinglePlot = False 2359 Pa ttern[0]['Offset']= [0.,0.]2359 Page.Offset = [0.,0.] 2360 2360 elif event.key == 's': 2361 2361 if G2frame.Contour: … … 2453 2453 PDFdata = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'PDF Controls')) 2454 2454 numbDen = G2pwd.GetNumDensity(PDFdata['ElList'],PDFdata['Form Vol']) 2455 Xb = [0.,10.]2456 Yb = [0.,-40.*np.pi*numbDen]2457 2455 Ymax = 0.01 2458 2456 lenX = 0 … … 2488 2486 Plot.plot(X,Y,colors[N%6],picker=False) 2489 2487 if type == 'G(R)': 2488 Xb = [0.,10.] 2489 Yb = [0.,-40.*np.pi*numbDen] 2490 2490 Plot.plot(Xb,Yb,color='k',dashes=(5,5)) 2491 2491 elif type == 'F(Q)': -
trunk/GSASIIpwdGUI.py
r2561 r2563 4747 4747 inst = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,powId, 'Instrument Parameters'))[0] 4748 4748 if 'C' in inst['Type'][0]: 4749 if 'Lam' in inst: 4750 keV = 12.397639/inst['Lam'][1] 4751 else: 4752 keV = 12.397639/inst['Lam1'][0] 4753 wave = 12.397639/keV 4749 wave = G2mth.getWave(inst) 4750 keV = 12.397639/wave 4754 4751 qLimits = [tth2q(fullLimits[0],wave),tth2q(fullLimits[1],wave)] 4755 4752 polariz = inst['Polariz.'][1] … … 5124 5121 El = PE.Elem 5125 5122 if El not in ElList and El != 'None': 5126 ElemSym = El.strip().capitalize() 5127 if 'X' in inst['Type'][0]: 5128 FpMu = G2elem.FPcalc(G2elem.GetXsectionCoeff(ElemSym), keV) 5129 ElData = G2elem.GetFormFactorCoeff(ElemSym)[0] 5130 ElData['FormulaNo'] = 0.0 5131 ElData.update(G2elem.GetAtomInfo(ElemSym)) 5132 ElData.update(dict(zip(['fp','fpp','mu'],FpMu))) 5133 ElData.update(G2elem.GetFFC5(El)) 5134 else: #'N'eutron 5135 ElData = {} 5136 ElData.update(G2elem.GetAtomInfo(ElemSym)) 5137 ElData['FormulaNo'] = 0.0 5138 ElData.update({'mu':0.0,'fp':0.0,'fpp':0.0}) 5139 data['ElList'][El] = ElData 5123 data['ElList'][El] = G2elem.GetElInfo(El) 5140 5124 data['Form Vol'] = max(10.0,SumElementVolumes()) 5141 5125 PE.Destroy()
Note: See TracChangeset
for help on using the changeset viewer.