@@ -2750,8 +2750,13 @@ def BackgroundPrint(Background,sigDict):
27502750 if 'BF mult' in sigDict :
27512751 print ('Background file mult: %.3f(%d)' % (Background [1 ]['background PWDR' ][1 ],int (1000 * sigDict ['BF mult' ])))
27522752
2753- def SetInstParms (Inst ):
2753+ def SetInstParms (Inst ,peakVary ):
2754+ # superesses refinement of instrument parameters if any corresponding peak parameter is refined
27542755 dataType = Inst ['Type' ][0 ]
2756+ noAlp = any ([True for vary in peakVary if 'alp' in vary ])
2757+ noBet = any ([True for vary in peakVary if 'bet' in vary ])
2758+ noSig = any ([True for vary in peakVary if 'sig' in vary ])
2759+ # noGam = any([True for vary in peakVary if 'gam' in vary])
27552760 insVary = []
27562761 insNames = []
27572762 insVals = []
@@ -2760,7 +2765,19 @@ def SetInstParms(Inst):
27602765 insVals .append (Inst [parm ][1 ])
27612766 if parm in ['U' ,'V' ,'W' ,'X' ,'Y' ,'Z' ,'SH/L' ,'I(L2)/I(L1)' ,'alpha' ,'A' ,'B' ,'C' ,
27622767 'beta-0' ,'beta-1' ,'beta-q' ,'sig-0' ,'sig-1' ,'sig-2' ,'sig-q' ,'alpha-0' ,'alpha-1' ] and Inst [parm ][2 ]:
2763- insVary .append (parm )
2768+ if 'alp' in parm and noAlp :
2769+ Inst [parm ][2 ] = False
2770+ continue
2771+ elif 'bet' in parm and noBet :
2772+ Inst [parm ][2 ] = False
2773+ continue
2774+ elif ('sig' in parm or parm in ['U' ,'V' ,'W' ]) and noSig :
2775+ Inst [parm ][2 ] = False
2776+ continue
2777+ # elif parm in ['X','Y','Z'] and noGam:
2778+ # Inst[parm][2] = False
2779+ # continue
2780+ insVary .append (parm )
27642781 instDict = dict (zip (insNames ,insVals ))
27652782 if 'SH/L' in instDict :
27662783 instDict ['SH/L' ] = max (instDict ['SH/L' ],0.002 )
@@ -2984,8 +3001,8 @@ def errPeakProfile(values,xdata,ydata,fixback,weights,dataType,parmdict,varylist
29843001 xFin = np .searchsorted (x ,Limits [1 ])+ 1
29853002 # find out what is varied
29863003 bakType ,bakDict ,bakVary = SetBackgroundParms (Background )
2987- dataType ,insDict ,insVary = SetInstParms (Inst )
29883004 peakDict ,peakVary = SetPeaksParms (Inst ['Type' ][0 ],Peaks )
3005+ dataType ,insDict ,insVary = SetInstParms (Inst ,peakVary )
29893006 parmDict = {}
29903007 parmDict .update (bakDict )
29913008 parmDict .update (insDict )
0 commit comments