Changeset 4370
- Timestamp:
- Mar 15, 2020 2:57:46 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIddataGUI.py
r4080 r4370 263 263 wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) 264 264 265 def OnHstrainRef(event):266 Obj = event.GetEventObject()267 hist,pid = Indx[Obj.GetId()]268 UseList[G2frame.hist]['HStrain'][1][pid] = Obj.GetValue()269 270 def OnHstrainVal(event):271 event.Skip()272 Obj = event.GetEventObject()273 hist,pid = Indx[Obj.GetId()]274 try:275 strain = float(Obj.GetValue())276 UseList[G2frame.hist]['HStrain'][0][pid] = strain277 except ValueError:278 pass279 Obj.SetValue("%.3g"%(UseList[G2frame.hist]['HStrain'][0][pid])) #reset in case of error280 281 265 def OnPOAxis(event): 282 266 event.Skip() … … 477 461 478 462 def HstrainSizer(): 463 464 def OnHstrainRef(event): 465 Obj = event.GetEventObject() 466 hist,pid = Indx[Obj.GetId()] 467 UseList[G2frame.hist]['HStrain'][1][pid] = Obj.GetValue() 468 469 def OnHstrainVal(event): 470 event.Skip() 471 Obj = event.GetEventObject() 472 hist,pid = Indx[Obj.GetId()] 473 try: 474 strain = float(Obj.GetValue()) 475 UseList[G2frame.hist]['HStrain'][0][pid] = strain 476 except ValueError: 477 pass 478 Obj.SetValue("%.3g"%(UseList[G2frame.hist]['HStrain'][0][pid])) #reset in case of error 479 479 480 hstrainSizer = wx.FlexGridSizer(0,6,5,5) 480 481 Hsnames = G2spc.HStrainNames(SGData) … … 689 690 flackSizer.Add(flackVal,0,WACV) 690 691 return flackSizer 692 693 def DispSizer(): 694 695 def OnDispRef(event): 696 Obj = event.GetEventObject() 697 UseList[G2frame.hist]['Layer Disp'][1] = Obj.GetValue() 698 699 dispSizer = wx.BoxSizer(wx.HORIZONTAL) 700 dispRef = wx.CheckBox(DData,wx.ID_ANY,label=' Layer displacement (\xb5m): ') 701 dispRef.SetValue(UseList[G2frame.hist]['Layer Disp'][1]) 702 dispRef.Bind(wx.EVT_CHECKBOX, OnDispRef) 703 dispSizer.Add(dispRef,0,WACV|wx.LEFT,5) 704 dispSizer.Add(G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Layer Disp'],0,nDig=(10,2),typeHint=float),0,WACV) 705 return dispSizer 691 706 692 707 def twinSizer(): … … 903 918 G2frame.hist+' not in GSAS-II data tree') 904 919 return 905 if 'Use' not in UseList[G2frame.hist]: #patch 920 #patch 921 if 'Use' not in UseList[G2frame.hist]: 906 922 UseList[G2frame.hist]['Use'] = True 907 923 if 'LeBail' not in UseList[G2frame.hist]: … … 913 929 if 'Fix FXU' not in UseList[G2frame.hist]: 914 930 UseList[G2frame.hist]['Fix FXU'] = ' ' 931 if 'Flack' not in UseList[G2frame.hist]: 932 UseList[G2frame.hist]['Flack'] = [0.0,False] 933 if 'Twins' not in UseList[G2frame.hist]: 934 UseList[G2frame.hist]['Twins'] = [[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],] 935 if 'Layer Disp' not in UseList[G2frame.hist]: 936 UseList[G2frame.hist]['Layer Disp'] = [0.0,False] 937 #end patch 915 938 bottomSizer = wx.BoxSizer(wx.VERTICAL) 916 939 useBox = wx.BoxSizer(wx.HORIZONTAL) … … 1003 1026 bottomSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Hydrostatic/elastic strain:')) 1004 1027 bottomSizer.Add(HstrainSizer()) 1028 bottomSizer.Add(DispSizer()) 1005 1029 1006 1030 poSizer = wx.BoxSizer(wx.VERTICAL) … … 1029 1053 bottomSizer.Add(BabSizer(),0,WACV|wx.BOTTOM,5) 1030 1054 elif G2frame.hist[:4] == 'HKLF': 1031 #patch1032 if 'Flack' not in UseList[G2frame.hist]:1033 UseList[G2frame.hist]['Flack'] = [0.0,False]1034 if 'Twins' not in UseList[G2frame.hist]:1035 UseList[G2frame.hist]['Twins'] = [[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],]1036 #end patch1037 1055 bottomSizer.Add(ExtSizer('HKLF'),0,WACV|wx.BOTTOM,5) 1038 1056 bottomSizer.Add(BabSizer(),0,WACV|wx.BOTTOM,5) -
trunk/GSASIImapvars.py
r4111 r4370 1811 1811 # if e: print 'error=',e 1812 1812 # if w: print 'error=',w 1813 # varyList = ['0::A0', '0::AUiso:0', '0::Afrac:1', '0::Afrac:2', '0::Afrac:3', '0::Afrac:4', '0::dAx:5', '0::dAy:5', '0::dAz:5', '0::AUiso:5', ':0:Back;0', ':0:Back;1', ':0:Back;2', ':0:Back;3', ':0:Back;4', ':0:Back;5', ':0:Back;6', ':0:Back;7', ':0:Back;8', ':0:Back;9', ':0:Back;10', ':0:Back;11', ':0:U', ':0:V', ':0:W', ':0:X', ':0:Y', ':0:Scale', ':0:DisplaceX', ':0:DisplaceY'] 1813 # varyList = ['0::A0', '0::AUiso:0', '0::Afrac:1', '0::Afrac:2', '0::Afrac:3', '0::Afrac:4', 1814 # '0::dAx:5', '0::dAy:5', '0::dAz:5', '0::AUiso:5', ':0:Back;0', ':0:Back;1', ':0:Back;2', ':0:Back;3', 1815 # ':0:Back;4', ':0:Back;5', ':0:Back;6', ':0:Back;7', ':0:Back;8', ':0:Back;9', ':0:Back;10', ':0:Back;11' 1816 # :0:U', ':0:V', ':0:W', ':0:X', ':0:Y', ':0:Scale', ':0:DisplaceX', ':0:DisplaceY'] 1814 1817 # constrDict = [ 1815 1818 # {'0::Afrac:4': 24.0, '0::Afrac:1': 16.0, '0::Afrac:3': 24.0, '0::Afrac:2': 16.0}, -
trunk/GSASIIobj.py
r4327 r4370 276 276 entries, 'BabA', 'BabU' 277 277 \ Extinction (list of float, bool) Extinction parameter 278 \ Flack (list of [float, bool]) Flack parameter & refine flag 278 279 \ HStrain (list of two lists) Hydrostatic strain. The first is 279 280 a list of the HStrain parameters (1, 2, 3, 4, or 6 … … 281 282 refinement parameters (same length) 282 283 \ Histogram (str) The name of the associated histogram 284 \ Layer Disp (list of [float, bool]) Layer displacement in beam direction & refine flag 283 285 \ LeBail (bool) Flag for LeBail extraction 284 286 \ Mustrain (list) Microstrain parameters, in order: … … 1585 1587 'Flack' : 'Flack parameter', 1586 1588 'TwinFr' : 'Twin fraction', 1589 'Layer Disp' : 'Layer displacement along beam', 1587 1590 #Histogram vars (:h:<var>) 1588 1591 'Absorption' : 'Absorption coef.', -
trunk/GSASIIphsGUI.py
r4366 r4370 8630 8630 copyNames = ['Scale','Extinction','Babinet','Flack','Twins','Fix FXU'] 8631 8631 else: #PWDR 8632 copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail','Fix FXU' ]8632 copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail','Fix FXU','Layer Disp'] 8633 8633 copyDict = {} 8634 8634 for name in copyNames: … … 8650 8650 copyNames = ['Scale','Extinction','Babinet','Flack','Twins','Fix FXU'] 8651 8651 else: #PWDR 8652 copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','Fix FXU' ]8652 copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','Fix FXU','Layer Disp'] 8653 8653 babNames = ['BabA','BabU'] 8654 8654 for name in copyNames: 8655 if name in ['Scale','Extinction','HStrain','Flack','Twins' ]:8655 if name in ['Scale','Extinction','HStrain','Flack','Twins','Layer Disp']: 8656 8656 if name == 'Extinction' and 'HKLF' in sourceDict['Histogram']: 8657 8657 copyDict[name] = {name:[sourceDict[name][:2]]} … … 8690 8690 item = keyList[sel] 8691 8691 for name in copyNames: 8692 if name in ['Scale','Extinction','HStrain','Flack','Twins' ]:8692 if name in ['Scale','Extinction','HStrain','Flack','Twins','Layer Disp']: 8693 8693 if name == 'Extinction' and 'HKLF' in sourceDict['Histogram']: 8694 8694 data['Histograms'][item][name][:2] = copy.deepcopy(sourceDict[name][:2]) … … 8733 8733 copyNames = ['Scale','Extinction','Babinet','Flack','Twins','Fix FXU'] 8734 8734 else: #PWDR 8735 copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail','Fix FXU' ]8735 copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail','Fix FXU','Layer Disp'] 8736 8736 dlg = G2G.G2MultiChoiceDialog(G2frame,'Select which parameters to copy', 8737 8737 'Select phase data parameters', copyNames) … … 8789 8789 'Mustrain':['isotropic',[1000.0,1000.0,1.0],[False,False,False],[0,0,1], 8790 8790 NShkl*[0.01,],NShkl*[False,]], 8791 'HStrain':[NDij*[0.0,],NDij*[False,]], 8791 'HStrain':[NDij*[0.0,],NDij*[False,]], 8792 'Layer Disp':[0.0,False], 8792 8793 'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},'Fix FXU':' '} 8793 8794 refList = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,Id,'Reflection Lists')) … … 10473 10474 pos -= const*(4.*Sample['Shift'][0]*cosd(pos/2.0)+ \ 10474 10475 Sample['Transparency'][0]*sind(pos)*100.0) #trans(=1/mueff) in cm 10475 else: #Debye-Scherrer - simple but maybe not right 10476 else: #Debye-Scherrer - simple but maybe not right - +Layer Disp from DData? 10476 10477 pos -= const*(Sample['DisplaceX'][0]*cosd(pos)+Sample['DisplaceY'][0]*sind(pos)) 10477 10478 indx = np.searchsorted(xdata[0],pos) -
trunk/GSASIIstrIO.py
r4197 r4370 2503 2503 HSvals.append(hapDict[pfx+name]) 2504 2504 if hapData['HStrain'][1][i]: 2505 # if hapData['HStrain'][1][i] and not hapDict[pfx+'LeBail']:2506 2505 hapVary.append(pfx+name) 2506 if 'Layer Disp' in hapData: 2507 hapDict[pfx+'LayerDisp'] = hapData['Layer Disp'][0] 2508 if hapData['Layer Disp'][1]: 2509 hapVary.append(pfx+'LayerDisp') 2507 2510 controlDict[pfx+'poType'] = hapData['Pref.Ori.'][0] 2508 2511 if hapData['Pref.Ori.'][0] == 'MD': … … 2579 2582 PrintMuStrain(hapData['Mustrain'],SGData) 2580 2583 PrintHStrain(hapData['HStrain'],SGData) 2584 if 'Layer Disp' in hapData: 2585 pFile.write(' Layer Displacement: %10.3f Refine? %s\n'%(hapData['Layer Disp'][0],hapData['Layer Disp'][1])) 2581 2586 if Phases[phase]['General']['Type'] != 'magnetic': 2582 2587 if hapData['Babinet']['BabA'][0]: … … 2978 2983 if pfx+name in sigDict: 2979 2984 SizeMuStrSig[pfx+'HStrain'][name] = sigDict[pfx+name] 2985 if 'Layer Disp' in hapData: 2986 hapData['Layer Disp'][0] = parmDict[pfx+'LayerDisp'] 2987 if pfx+'LayerDisp' in sigDict: 2988 SizeMuStrSig[pfx+'LayerDisp'] = sigDict[pfx+'LayerDisp'] 2980 2989 if Phases[phase]['General']['Type'] != 'magnetic': 2981 2990 for name in ['BabA','BabU']: … … 3061 3070 PrintMuStrainAndSig(hapData['Mustrain'],SizeMuStrSig[pfx+'Mustrain'],SGData) 3062 3071 PrintHStrainAndSig(hapData['HStrain'],SizeMuStrSig[pfx+'HStrain'],SGData) 3072 if pfx+'LayerDisp' in SizeMuStrSig: 3073 pFile.write(' Layer displacement : %10.3f, sig %10.3f\n'%(hapData['Layer Disp'][0],SizeMuStrSig[pfx+'LayerDisp'])) 3063 3074 if Phases[phase]['General']['Type'] != 'magnetic' and not parmDict[pfx+'LeBail']: 3064 3075 if len(BabSig): -
trunk/GSASIIstrMain.py
r4289 r4370 146 146 covMatrix = result[1]*Rvals['GOF']**2 147 147 sig = np.sqrt(np.diag(covMatrix)) 148 Lastshft = result[2] ['Xvec']148 Lastshft = result[2].get('Xvec',None) 149 149 if Lastshft is None: 150 150 Rvals['Max shft/sig'] = 0.0 -
trunk/GSASIIstrMath.py
r4344 r4370 2868 2868 return sigDict,gamDict 2869 2869 2870 def GetReflPos(refl,im,wave,A,pfx,hfx, calcControls,parmDict):2870 def GetReflPos(refl,im,wave,A,pfx,hfx,phfx,calcControls,parmDict): 2871 2871 'Needs a doc string' 2872 2872 if im: … … 2885 2885 parmDict[hfx+'Transparency']*sind(pos)*100.0) #trans(=1/mueff) in cm 2886 2886 else: #Debye-Scherrer - simple but maybe not right 2887 pos -= const*(parmDict[hfx+'DisplaceX']*cosd(pos)+ parmDict[hfx+'DisplaceY']*sind(pos))2887 pos -= const*(parmDict[hfx+'DisplaceX']*cosd(pos)+(parmDict[hfx+'DisplaceY']+parmDict[phfx+'LayerDisp'])*sind(pos)) 2888 2888 elif 'T' in calcControls[hfx+'histType']: 2889 2889 pos = parmDict[hfx+'difC']*d+parmDict[hfx+'difA']*d**2+parmDict[hfx+'difB']/d+parmDict[hfx+'Zero'] … … 2891 2891 return pos 2892 2892 2893 def GetReflPosDerv(refl,im,wave,A,pfx,hfx, calcControls,parmDict):2893 def GetReflPosDerv(refl,im,wave,A,pfx,hfx,phfx,calcControls,parmDict): 2894 2894 'Needs a doc string' 2895 2895 dpr = 180./np.pi … … 3242 3242 h,k,l = refl[:3] 3243 3243 Uniq = np.inner(refl[:3],SGMT) 3244 refl[5+im] = GetReflPos(refl,im,wave,A,pfx,hfx, calcControls,parmDict) #corrected reflection position3244 refl[5+im] = GetReflPos(refl,im,wave,A,pfx,hfx,phfx,calcControls,parmDict) #corrected reflection position 3245 3245 Lorenz = 1./(2.*sind(refl[5+im]/2.)**2*cosd(refl[5+im]/2.)) #Lorentz correction 3246 3246 refl[6+im:8+im] = GetReflSigGamCW(refl,im,wave,G,GB,phfx,calcControls,parmDict) #peak sig & gam … … 3294 3294 h,k,l = refl[:3] 3295 3295 Uniq = np.inner(refl[:3],SGMT) 3296 refl[5+im] = GetReflPos(refl,im,0.0,A,pfx,hfx, calcControls,parmDict) #corrected reflection position - #TODO - what about tabluated offset?3296 refl[5+im] = GetReflPos(refl,im,0.0,A,pfx,hfx,phfx,calcControls,parmDict) #corrected reflection position - #TODO - what about tabluated offset? 3297 3297 Lorenz = sind(abs(parmDict[hfx+'2-theta'])/2)*refl[4+im]**4 #TOF Lorentz correction 3298 3298 # refl[5+im] += GetHStrainShift(refl,im,SGData,phfx,hfx,calcControls,parmDict) #apply hydrostatic strain shift … … 3536 3536 pass 3537 3537 if 'C' in calcControls[hfx+'histType']: 3538 dpdA,dpdw,dpdZ,dpdSh,dpdTr,dpdX,dpdY,dpdV = GetReflPosDerv(refl,im,wave,A,pfx,hfx, calcControls,parmDict)3538 dpdA,dpdw,dpdZ,dpdSh,dpdTr,dpdX,dpdY,dpdV = GetReflPosDerv(refl,im,wave,A,pfx,hfx,phfx,calcControls,parmDict) 3539 3539 names = {hfx+'Scale':[dIdsh,'int'],hfx+'Polariz.':[dIdpola,'int'],phfx+'Scale':[dIdsp,'int'], 3540 3540 hfx+'U':[tanth**2,'sig'],hfx+'V':[tanth,'sig'],hfx+'W':[1.0,'sig'], … … 3542 3542 hfx+'I(L2)/I(L1)':[1.0,'L1/L2'],hfx+'Zero':[dpdZ,'pos'],hfx+'Lam':[dpdw,'pos'], 3543 3543 hfx+'Shift':[dpdSh,'pos'],hfx+'Transparency':[dpdTr,'pos'],hfx+'DisplaceX':[dpdX,'pos'], 3544 hfx+'DisplaceY':[dpdY,'pos'],phfx+'Extinction':[dFdEx,'int'], }3544 hfx+'DisplaceY':[dpdY,'pos'],phfx+'Extinction':[dFdEx,'int'],phfx+'LayerDisp':[dpdY,'pos']} 3545 3545 if 'Bragg' in calcControls[hfx+'instType']: 3546 3546 names.update({hfx+'SurfRoughA':[dFdAb[0],'int'], … … 3549 3549 names.update({hfx+'Absorption':[dFdAb,'int'],}) 3550 3550 else: #'T'OF 3551 dpdA,dpdZ,dpdDC,dpdDA,dpdDB,dpdV = GetReflPosDerv(refl,im,0.0,A,pfx,hfx, calcControls,parmDict)3551 dpdA,dpdZ,dpdDC,dpdDA,dpdDB,dpdV = GetReflPosDerv(refl,im,0.0,A,pfx,hfx,phfx,calcControls,parmDict) 3552 3552 names = {hfx+'Scale':[dIdsh,'int'],phfx+'Scale':[dIdsp,'int'], 3553 3553 hfx+'difC':[dpdDC,'pos'],hfx+'difA':[dpdDA,'pos'],hfx+'difB':[dpdDB,'pos'], … … 3615 3615 if Ka2 and iFin2-iBeg2: 3616 3616 depDerivDict[name][iBeg2:iFin2] += dDijDict[name]*dervDict2['pos'] 3617 #TODO: need Layer Disp deriv here 3617 3618 for i,name in enumerate([pfx+'mV0',pfx+'mV1',pfx+'mV2']): 3618 3619 if name in varylist:
Note: See TracChangeset
for help on using the changeset viewer.