I follow the example avaliable for Fitting multiple INS spectra (https://www.mantidproject.org/Crystal_Field_Examples) and my results give me a giant error, in order of billions, but the parameters Bmn are of the order 10^-5. The calculated INS spectra fits very well with the experimental results, but the error in the determination of parameters indicate a wrong calculation. Is this error correct?
My code in python is that:
from CrystalField import CrystalField, CrystalFieldFit
data_ws1=Load(‘INS-Low-Q-Er-20K.dat’)
data_ws2=Load(‘INS-Low-Q-Er-50K.dat’)
data_ws3=Load(‘INS-Low-Q-Er-100K.dat’)
cf = CrystalField(‘Er’, ‘C3v’, Temperature=[20,50,100], FWHM=[0.25,0.25,0.25], B20=-0.0099826357677831601, B40=-3.0154807041123003e-05,
B43=1e-5, B60=-3.6816957724262839e-06, B63=1e-5, B66=-3.3261927380776656e-05, FWHMVariation=0.05, ToleranceEnergy=0.8)
cf.PeakShape = ‘Gaussian’
cf.IntensityScaling = [2, 2, 2] # Scale factor if data is not in absolute units (mbarn/sr/f.u./meV), will be fitted.
cf.peaks[0].ties({‘f6.Sigma’: ‘0.25’, ‘f2.Sigma’: ‘0.2’, ‘f18.Sigma’: ‘0.001’})
cf.peaks[1].ties({‘f10.Sigma’: ‘0.25’, ‘f2.Sigma’: ‘0.19’, ‘f12.Sigma’: ‘0.1’})
cf.peaks[2].ties({‘f10.Sigma’: ‘0.25’, ‘f2.Sigma’: ‘0.19’, ‘f12.Sigma’: ‘0.1’})
Runs the fit
fit = CrystalFieldFit(Model=cf, InputWorkspace=[data_ws1, data_ws2, data_ws3], MaxIterations=200)
fit.fit()
Plots the data and print fitted parameters
l=plotSpectrum(‘fit_Workspace_0’, [0,1,2], error_bars=False)
l.activeLayer().setAxisScale(Layer.Left, 0, 200)
l.activeLayer().setAxisScale(Layer.Bottom, 0, 4)
l=plotSpectrum(‘fit_Workspace_1’, [0,1,2], error_bars=False)
l.activeLayer().setAxisScale(Layer.Left, 0, 200)
l.activeLayer().setAxisScale(Layer.Bottom, 0, 4)
l=plotSpectrum(‘fit_Workspace_2’, [0,1,2], error_bars=False)
l.activeLayer().setAxisScale(Layer.Left, 0, 200)
l.activeLayer().setAxisScale(Layer.Bottom, 0, 4)
Prints output parameters and cost function.
for parnames in [‘B20’, ‘B40’,‘B43’,‘B60’,‘B63’,‘B66’]:
print parnames+’ = ‘+str(fit.model[parnames])+’ meV’
table = mtd[‘fit_Parameters’]
print 'Cost function value = '+str(table.row(table.rowCount()-1)[‘Value’])
and the results are:
Cost function value = 1324.66980944