Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting ties and constrains #22

Open
Sevketcikmaz opened this issue May 9, 2024 · 0 comments
Open

setting ties and constrains #22

Sevketcikmaz opened this issue May 9, 2024 · 0 comments

Comments

@Sevketcikmaz
Copy link

I have an issue with setting ties and constrains with my strings. When I try to tie or constrain FWHM value, it says that there is an attribution error. Can you please help me solve this? The following is my strips
<<

import mantid algorithms, numpy and matplotlib

from mantid.simpleapi import *
import matplotlib.pyplot as plt
import numpy as np
from CrystalField import CrystalField, CrystalFieldFit, Background, Function, PhysicalProperties
from mantid.plots.utility import MantidAxType
from mantid.api import AnalysisDataService as ADS

PPCv = PhysicalProperties('Cv')

cf = CrystalField('Er', 'D4h', B20=-0.039105620771250384, B40=-0.00012224220121308797, B44=0.005840756562690297, B60=0.00000479869319, B64=0.000030333615728, Temperature=1.5, FWHM=0.65, PhysicalProperty=[PPCv])
cf.PeakShape = 'Lorentzian'

cf.background = Background(peak=Function('Lorentzian', Amplitude=10, PeakCentre=1, FWHM=0.65),
background=Function('LinearBackground', A0=1.0, A1=0.01))

data_ws1 = Load('C:\Users\galak\OneDrive\Desktop\calculations\erpdsi_neutronECplotting_Elasticline_exclude.dat')
heat = Load('C:\Users\galak\OneDrive\Desktop\calculations\ErPd_HC.dat')

cf.peaks.constraints('f1.FWHM < 0.7', 'f2.FWHM < 0.7')

Runs the fit

fit = CrystalFieldFit(Model=cf, InputWorkspace= [data_ws1, heat])
fit.fit()

##This is Eigen values
e = cf.getEigenvalues()
print(e)

for parnames in ['B20','B40', 'B44', 'B60','B64']:
print (parnames+' = '+str(fit.model[parnames])+' meV')

table = mtd['fit_Parameters']
print ('Cost function value = '+str(table.row(table.rowCount()-1)['Value']))

#plotSpectrum('fit_Workspace',[0,1,2],error_bars=False)
#plt.xlim([1,8])
#plt.ylim([0,90])

Please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant