Changeset 5117
- Timestamp:
- Dec 23, 2021 9:01:03 AM (21 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r5116 r5117 12912 12912 ##### Pawley routines ################################################################################ 12913 12913 def FillPawleyReflectionsGrid(): 12914 12915 def onRefineDClick(event): 12916 '''Called after a double-click on a cell label''' 12917 c = event.GetCol() 12918 if c == 5: #refine column label: just select it (& redisplay) 12919 G2frame.PawleyRefl.ClearSelection() 12920 G2frame.PawleyRefl.SelectCol(c,True) 12921 choice = ['Y - vary all','N - vary none',] 12922 dlg = wx.SingleChoiceDialog(G2frame,'Select refinement option', 12923 'Refinement controls',choice) 12924 dlg.CenterOnParent() 12925 if dlg.ShowModal() == wx.ID_OK: 12926 sel = dlg.GetSelection() 12927 if sel == 0: 12928 for row in range(G2frame.PawleyRefl.GetNumberRows()): PawleyPeaks[row][c]=True 12929 else: 12930 for row in range(G2frame.PawleyRefl.GetNumberRows()): PawleyPeaks[row][c]=False 12931 FillPawleyReflectionsGrid() 12932 12914 12933 def KeyEditPawleyGrid(event): 12915 12934 colList = G2frame.PawleyRefl.GetSelectedCols() … … 12959 12978 G2frame.PawleyRefl.SetTable(PawleyTable, True) 12960 12979 G2frame.PawleyRefl.Bind(wx.EVT_KEY_DOWN, KeyEditPawleyGrid) 12980 G2frame.PawleyRefl.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK, onRefineDClick) 12961 12981 for r in range(G2frame.PawleyRefl.GetNumberRows()): 12962 12982 for c in range(G2frame.PawleyRefl.GetNumberCols()): … … 13120 13140 gconst = 2.35482 # sqrt(8 ln 2) 13121 13141 dx = (xdata[0][1]-xdata[0][0])*20. #this ian approximation - not correct, but CW seems to be needed 13142 cw = np.diff(xdata[0]) 13143 cw = np.append(cw,cw[-1]) 13122 13144 gconst *= dx 13123 13145 … … 13138 13160 # we multiply the observed peak height by sqrt(8 ln 2)/(FWHM*sqrt(pi)) to determine the value of Icorr*F^2 13139 13161 # then divide by Icorr to get F^2. 13140 ref[6+im] = (xdata[1][indx]-xdata[4][indx])* gconst/(FWHM*np.sqrt(np.pi)) #Area of Gaussian is height * FWHM * sqrt(pi)13162 ref[6+im] = (xdata[1][indx]-xdata[4][indx])*FWHM*np.sqrt(np.pi) #Area of Gaussian is height * FWHM * sqrt(pi) 13141 13163 if 'E' not in Inst['Type'][0]: 13142 Lorenz = 1./(2.*sind(xdata[0][indx]/2.)**2*cosd(xdata[0][indx]/2.)) #Lorentz correction 13164 if 'C' in Inst['Type'][0]: 13165 Lorenz = 1./(2.*sind(xdata[0][indx]/2.)**2*cosd(xdata[0][indx]/2.)) #Lorentz correction 13166 else: 13167 Lorenz = ref[4+im]**4 13143 13168 pola = 1.0 13144 13169 if 'X' in Inst['Type']: … … 13149 13174 ref[6+im] /= (Sample['Scale'][0] * Vst * Lorenz * pola * ref[3+im]) 13150 13175 else: 13151 ref[6+im] /= ( Sample['Scale'][0] * ref[3+im])13176 ref[6+im] /= (0.02*Sample['Scale'][0] * ref[3+im]*cw[indx]) #why 0.02*cw? 13152 13177 except IndexError: 13153 13178 pass -
trunk/GSASIIstrMain.py
r5106 r5117 298 298 if CheckLeBail(Phases): # only needed for LeBail extraction 299 299 G2stMth.errRefine([],[Histograms,Phases,restraintDict,rigidbodyDict], 300 300 parmDict,[],calcControls,pawleyLookup,dlg) 301 301 G2stMth.GetFobsSq(Histograms,Phases,parmDict,calcControls) 302 302 if chisq0 is not None: -
trunk/GSASIIstrMath.py
r5116 r5117 3458 3458 refl[9+im] = parmDict[pInd] 3459 3459 except KeyError: 3460 # print ' ***Error %d,%d,%d missing from Pawley reflection list ***'%(h,k,l)3461 3460 continue 3462 3461 Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.) … … 3501 3500 refl[9+im] = parmDict[pInd] 3502 3501 except KeyError: 3503 # print ' ***Error %d,%d,%d missing from Pawley reflection list ***'%(h,k,l)3504 3502 continue 3505 3503 Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im]) … … 3697 3695 Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.) 3698 3696 elif 'E' in calcControls[hfx+'histType']: 3699 Wd,fmin,fmax = G2pwd.getWidthsED(refl[5+im],refl[6+im] *1.e4)3697 Wd,fmin,fmax = G2pwd.getWidthsED(refl[5+im],refl[6+im]) 3700 3698 iBeg = np.searchsorted(x,refl[5+im]-fmin) 3701 3699 iFin = np.searchsorted(x,refl[5+im]+fmax) … … 3873 3871 if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']: 3874 3872 sigDict,gamDict = GetSampleSigGamDerv(refl,im,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict) 3875 el se: #'T'OF3873 elif 'T' in calcControls[hfx+'histType']: #'T'OF 3876 3874 sigDict,gamDict = GetSampleSigGamDerv(refl,im,0.0,G,GB,SGData,hfx,phfx,calcControls,parmDict) 3875 else: #'E' 3876 sigDict = {} 3877 gamDict = {} 3877 3878 for name in gamDict: 3878 3879 if name in varylist:
Note: See TracChangeset
for help on using the changeset viewer.