@@ -2227,34 +2227,45 @@ def DoCalibInst(IndexPeaks,Inst,Sample):
22272227
22282228 def SetInstParms ():
22292229 dataType = Inst ['Type' ][0 ]
2230+ insNames = ['Lam' ,]
2231+ insVals = [G2mth .getWave (Inst ),]
22302232 insVary = []
2231- insNames = []
2232- insVals = []
2233+ if Inst . get ( 'Lam' ,[ 1.0 , 1.0 , False ])[ 2 ]:
2234+ insVary . append ( 'Lam' )
22332235 for parm in Inst :
2236+ if parm == 'Lam' :
2237+ continue
22342238 insNames .append (parm )
22352239 insVals .append (Inst [parm ][1 ])
2236- if parm in ['Lam' , ' difC' ,'difA' ,'difB' ,'Zero' ,'2-theta' ,'XE' ,'YE' ,'ZE' ]:
2240+ if parm in ['difC' ,'difA' ,'difB' ,'Zero' ,'2-theta' ,'XE' ,'YE' ,'ZE' ]:
22372241 if Inst [parm ][2 ]:
22382242 insVary .append (parm )
2239- if 'C' in dataType or 'B' in dataType and 'Debye' in Sample [ 'Type ' ]:
2243+ if dataType [ 2 ] in [ 'A' , 'B' , 'C ' ]:
22402244 insNames .append ('radius' )
22412245 insVals .append (Sample ['Gonio. radius' ])
2242- insNames .append ('DisplaceX' )
2243- insVals .append (Sample ['DisplaceX' ][0 ])
2244- if Sample ['DisplaceX' ][1 ]:
2245- insVary .append ('DisplaceX' )
2246- insNames .append ('DisplaceY' )
2247- insVals .append (Sample ['DisplaceY' ][0 ])
2248- if Sample ['DisplaceY' ][1 ]:
2249- insVary .append ('DisplaceY' )
2246+ if 'Debye' in Sample ['Type' ]:
2247+ insNames .append ('DisplaceX' )
2248+ insVals .append (Sample ['DisplaceX' ][0 ])
2249+ if Sample ['DisplaceX' ][1 ]:
2250+ insVary .append ('DisplaceX' )
2251+ insNames .append ('DisplaceY' )
2252+ insVals .append (Sample ['DisplaceY' ][0 ])
2253+ if Sample ['DisplaceY' ][1 ]:
2254+ insVary .append ('DisplaceY' )
2255+ else :
2256+ insNames .append ('Shift' )
2257+ insVals .append (Sample ['Shift' ][0 ])
2258+ if Sample ['Shift' ][1 ]:
2259+ insVary .append ('Shift' )
2260+
22502261 instDict = dict (zip (insNames ,insVals ))
22512262 return dataType ,instDict ,insVary
22522263
22532264 def GetInstParms (parmDict ,varyList ):
22542265 for name in Inst :
22552266 Inst [name ][1 ] = parmDict [name ]
22562267 for name in Sample :
2257- if name in ['DisplaceX' ,'DisplaceY' ]: # for CW only
2268+ if name in ['DisplaceX' ,'DisplaceY' , 'Shift' ]: # for CW only
22582269 try :
22592270 Sample [name ][0 ] = parmDict [name ]
22602271 except :
@@ -2277,8 +2288,11 @@ def InstPrint(sigDict):
22772288 sigstr += ptfmt % (sigDict [parm ])
22782289 else :
22792290 sigstr += 12 * ' '
2291+ parmList = ['Shift' ,]
2292+ if 'Debye' in Sample ['Type' ]:
2293+ parmList = ['DisplaceX' ,'DisplaceY' ]
22802294 for parm in Sample :
2281- if parm in [ 'DisplaceX' , 'DisplaceY' ] :
2295+ if parm in parmList :
22822296 ptlbls += "%s" % (parm .center (12 ))
22832297 ptstr += ptfmt % (Sample [parm ][0 ])
22842298 if parm in sigDict :
@@ -2292,9 +2306,12 @@ def InstPrint(sigDict):
22922306 def errPeakPos (values ,peakDsp ,peakPos ,peakWt ,dataType ,parmDict ,varyList ):
22932307 parmDict .update (zip (varyList ,values ))
22942308 calcPos = G2lat .getPeakPos (dataType ,parmDict ,peakDsp )
2295- if 'C' in dataType or 'B' in dataType :
2296- const = 18.e-2 / (np .pi * parmDict ['radius' ])
2297- shft = - const * (parmDict ['DisplaceX' ]* npcosd (calcPos )+ parmDict ['DisplaceY' ]* npsind (calcPos ))+ parmDict ['Zero' ]
2309+ if dataType [2 ] in ['A' ,'B' ,'C' ]:
2310+ const = 0.18 / (np .pi * parmDict ['radius' ])
2311+ if 'Debye' in Sample ['Type' ]:
2312+ shft = - 0.5 * const * (parmDict ['DisplaceX' ]* npcosd (calcPos )+ parmDict ['DisplaceY' ]* npsind (calcPos ))+ parmDict ['Zero' ]
2313+ else :
2314+ shft = - 2.0 * const * (parmDict ['Shift' ]* npcosd (calcPos / 2.0 )+ parmDict ['Zero' ])
22982315 # DThX = npasind(10**-3*parmDict['DisplaceX']*npcosd(calcPos)/parmDict['radius'])
22992316 # DThY = -npasind(10**-3*parmDict['DisplaceY']*npsind(calcPos)/parmDict['radius'])
23002317 # shft = DThX+DThY+parmDict['Zero']
0 commit comments