Skip to content

Commit 63dac50

Browse files
author
aglavic
committed
Update mpfit and fit_data from experimental.
1 parent 8906b73 commit 63dac50

File tree

3 files changed

+762
-572
lines changed

3 files changed

+762
-572
lines changed

deb_control

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Source: plot-script
22
Section: scientific
33
Priority: extra
4-
Maintainer: Artur Glavic <a.glavic@fz-juelich.de>
4+
Maintainer: Artur Glavic <artur.glavic@gmail.com>
55
Standards-Version: 3.8.1
6-
Homepage: http://iffwww.iff.kfa-juelich.de/~glavic/plotwiki
6+
Homepage: http://plotpy.sourceforge.net/plotwiki/
77

88
Package: plot-script
99
Architecture: all

plot_script/fit_data.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,8 +2420,8 @@ def __init__(self, initial_parameters):
24202420
FitFunction.__init__(self, initial_parameters)
24212421
self.refine_parameters=[0, 1, 2]
24222422

2423-
def simulate(self, x, ignore=None):
2424-
return FitFunction.simulate(self, x, interpolate=1)
2423+
def simulate(self, x, interpolate=None, inside_fitrange=False):
2424+
return FitFunction.simulate(self, x, interpolate=1, inside_fitrange=inside_fitrange)
24252425

24262426
def residuals(self, params, y, x, yerror=None):
24272427
'''
@@ -2910,6 +2910,44 @@ def fit_function(self, p, x, y):
29102910
value=I*V+c
29112911
return value.flatten()
29122912

2913+
class FitFerromagneticOrderparameter(FitFunction):
2914+
'''
2915+
Order parameter from
2916+
M. D. Kuz’min, PRL 94, 107204 (2005)
2917+
'''
2918+
2919+
# define class variables.
2920+
name="FM Orderparameter"
2921+
parameters=[1., 100., 1., 5./2., 0., 0.]
2922+
parameter_names=['M_S', 'T_C', 's', 'p', 'C_P', 'C_D']
2923+
fit_function_text='Parameters: M_S=[M_S] s=[s|2] T_C=[T_C]'
2924+
2925+
parameter_description={
2926+
'M_S': 'Saturation magnetization',
2927+
'T_C': 'Transition temperature',
2928+
's': 'Shape parameter, see (PRL 94, 107204 (2005))',
2929+
'p': 'Shape parameter (5/2 in most cases), see (PRL 94, 107204 (2005))',
2930+
'C_P': 'Paramagnetic correction factor',
2931+
'C_D': 'Diamagnetic correction factor',
2932+
}
2933+
2934+
def __init__(self, initial_parameters):
2935+
'''
2936+
Constructor setting the initial values of the parameters.
2937+
'''
2938+
FitFunction.__init__(self, initial_parameters)
2939+
self.refine_parameters=[0, 1, 2, 4, 5]
2940+
2941+
def fit_function(self, p, T):
2942+
Ms=p[0]
2943+
tau=T/p[1]
2944+
s=p[2]
2945+
P=p[3]
2946+
C_P=p[4]
2947+
C_D=p[5]
2948+
m=numpy.where(tau<1, (1.-s*tau**(2./3.)-(1.-s)*tau**P)**(1./3.), 0.)
2949+
return Ms*m+C_P/T+C_D
2950+
29132951

29142952
#--------------------------------- Define common functions for 3d fits ---------------------------------
29152953

@@ -2945,6 +2983,7 @@ class FitSession(FitSessionGUI):
29452983
FitCrystalLayer.name: FitCrystalLayer,
29462984
FitRelaxingCrystalLayer.name: FitRelaxingCrystalLayer,
29472985
FitOffspecular.name: FitOffspecular,
2986+
FitFerromagneticOrderparameter.name: FitFerromagneticOrderparameter,
29482987
#FitNanoparticleZFC.name: FitNanoparticleZFC,
29492988
#FitNanoparticleZFC2.name: FitNanoparticleZFC2,
29502989
}

0 commit comments

Comments
 (0)