Implenment the TF-2D fit
This commit is contained in:
parent
2744a57d68
commit
071d1b7726
@ -104,22 +104,13 @@ def polylog2_2d(x, y=0.0, centerx=0.0, centery=0.0, amplitude=1.0, sigmax=1.0, s
|
|||||||
return amplitude / np.pi / 1.59843 / max(tiny, sigmax * sigmay) * polylog(2, np.exp( -((x-centerx)**2/(2 * (sigmax)**2))-((y-centery)**2/( 2 * (sigmay)**2)) ))
|
return amplitude / np.pi / 1.59843 / max(tiny, sigmax * sigmay) * polylog(2, np.exp( -((x-centerx)**2/(2 * (sigmax)**2))-((y-centery)**2/( 2 * (sigmay)**2)) ))
|
||||||
|
|
||||||
|
|
||||||
def density_profile_BEC_2d(x, y=0.0, amplitude=1.0, condensateFraction=1.0, BEC_centerx=0.0, BEC_centery=0.0, thermal_centerx=0.0, thermal_centery=0.0,
|
def density_profile_BEC_2d(x, y=0.0, BEC_amplitude=1.0, thermal_amplitude=1.0, BEC_centerx=0.0, BEC_centery=0.0, thermal_centerx=0.0, thermal_centery=0.0,
|
||||||
BEC_sigmax=1.0, BEC_sigmay=1.0, thermal_sigmax=1.0, thermal_sigmay=1.0):
|
BEC_sigmax=1.0, BEC_sigmay=1.0, thermal_sigmax=1.0, thermal_sigmay=1.0):
|
||||||
|
|
||||||
return ThomasFermi_2d(x=x, y=y, centerx=BEC_centerx, centery=BEC_centery,
|
return ThomasFermi_2d(x=x, y=y, centerx=BEC_centerx, centery=BEC_centery,
|
||||||
amplitude=amplitude*condensateFraction, sigmax=BEC_sigmax, sigmay=BEC_sigmay
|
amplitude=BEC_amplitude, sigmax=BEC_sigmax, sigmay=BEC_sigmay
|
||||||
) + polylog2_2d(x=x, y=y, centerx=thermal_centerx, centery=thermal_centery,
|
) + polylog2_2d(x=x, y=y, centerx=thermal_centerx, centery=thermal_centery,
|
||||||
amplitude=amplitude * (1 - condensateFraction), sigmax=thermal_sigmax, sigmay=thermal_sigmay)
|
amplitude=thermal_amplitude, sigmax=thermal_sigmax, sigmay=thermal_sigmay)
|
||||||
|
|
||||||
|
|
||||||
# def density_profile_BEC_2d(x, y=0.0, BEC_amplitude=1.0, thermal_amplitude=1.0, BEC_centerx=0.0, BEC_centery=0.0, thermal_centerx=0.0, thermal_centery=0.0,
|
|
||||||
# BEC_sigmax=1.0, BEC_sigmay=1.0, thermal_sigmax=1.0, thermal_sigmay=1.0):
|
|
||||||
|
|
||||||
# return ThomasFermi_2d(x=x, y=y, centerx=BEC_centerx, centery=BEC_centery,
|
|
||||||
# amplitude=BEC_amplitude, sigmax=BEC_sigmax, sigmay=BEC_sigmay
|
|
||||||
# ) + polylog2_2d(x=x, y=y, centerx=thermal_centerx, centery=thermal_centery,
|
|
||||||
# amplitude=thermal_amplitude, sigmax=thermal_sigmax, sigmay=thermal_sigmay)
|
|
||||||
|
|
||||||
|
|
||||||
class GaussianWithOffsetModel(Model):
|
class GaussianWithOffsetModel(Model):
|
||||||
@ -338,7 +329,14 @@ class DensityProfileBEC2dModel(Model):
|
|||||||
self.set_param_hint('BEC_sigmax', min=0)
|
self.set_param_hint('BEC_sigmax', min=0)
|
||||||
self.set_param_hint('BEC_sigmay', min=0)
|
self.set_param_hint('BEC_sigmay', min=0)
|
||||||
self.set_param_hint('thermal_sigmax', min=0)
|
self.set_param_hint('thermal_sigmax', min=0)
|
||||||
self.set_param_hint('thermal_sigmay', min=0)
|
# self.set_param_hint('thermal_sigmay', min=0)
|
||||||
|
self.set_param_hint('BEC_amplitude', min=0)
|
||||||
|
self.set_param_hint('thermal_amplitude', min=0)
|
||||||
|
|
||||||
|
self.set_param_hint('thermalAspectRatio', min=0.8, max=1.2)
|
||||||
|
self.set_param_hint('thermal_sigmay', expr=f'{self.prefix}thermalAspectRatio * {self.prefix}thermal_sigmax')
|
||||||
|
|
||||||
|
self.set_param_hint('condensate_fraction', expr=f'{self.prefix}BEC_amplitude / ({self.prefix}BEC_amplitude + {self.prefix}thermal_amplitude)')
|
||||||
|
|
||||||
def guess(self, data, x, y, negative=False, **kwargs):
|
def guess(self, data, x, y, negative=False, **kwargs):
|
||||||
"""Estimate initial model parameter values from data."""
|
"""Estimate initial model parameter values from data."""
|
||||||
@ -347,39 +345,22 @@ class DensityProfileBEC2dModel(Model):
|
|||||||
fitResult = fitModel.fit(data, x=x, y=y, params=pars, **kwargs)
|
fitResult = fitModel.fit(data, x=x, y=y, params=pars, **kwargs)
|
||||||
pars_guess = fitResult.params
|
pars_guess = fitResult.params
|
||||||
|
|
||||||
amplitude = (pars_guess['A_amplitude'].value + pars_guess['B_amplitude'].value)
|
BEC_amplitude = pars_guess['A_amplitude'].value
|
||||||
# amplitude = amplitude / amplitude * np.max(data)
|
thermal_amplitude = pars_guess['B_amplitude'].value
|
||||||
condensateFraction = pars_guess['A_amplitude'].value / (pars_guess['A_amplitude'].value + pars_guess['B_amplitude'].value)
|
|
||||||
|
|
||||||
pars = self.make_params(amplitude=amplitude,
|
pars = self.make_params(BEC_amplitude=BEC_amplitude,
|
||||||
condensateFraction=condensateFraction,
|
thermal_amplitude=thermal_amplitude,
|
||||||
BEC_centerx=pars_guess['A_centerx'].value, BEC_centery=pars_guess['A_centery'].value,
|
BEC_centerx=pars_guess['A_centerx'].value, BEC_centery=pars_guess['A_centery'].value,
|
||||||
BEC_sigmax=(pars_guess['A_sigmax'].value / 2.355), BEC_sigmay=(pars_guess['A_sigmay'].value / 2.355),
|
BEC_sigmax=(pars_guess['A_sigmax'].value / 2.355), BEC_sigmay=(pars_guess['A_sigmay'].value / 2.355),
|
||||||
thermal_centerx=pars_guess['B_centerx'].value, thermal_centery=pars_guess['B_centery'].value,
|
thermal_centerx=pars_guess['B_centerx'].value, thermal_centery=pars_guess['B_centery'].value,
|
||||||
thermal_sigmax=(pars_guess['B_sigmax'].value * s2), thermal_sigmay=(pars_guess['B_sigmay'].value * s2))
|
thermal_sigmax=(pars_guess['B_sigmax'].value * s2),
|
||||||
|
thermalAspectRatio=(pars_guess['B_sigmax'].value * s2) / (pars_guess['B_sigmay'].value * s2)
|
||||||
|
# thermal_sigmay=(pars_guess['B_sigmay'].value * s2)
|
||||||
|
)
|
||||||
|
|
||||||
# BEC_amplitude = pars_guess['A_amplitude'].value
|
if BEC_amplitude / (thermal_amplitude + BEC_amplitude) > 0.5:
|
||||||
# thermal_amplitude = pars_guess['B_amplitude'].value
|
pars[f'{self.prefix}thermal_amplitude'].set(value=0)
|
||||||
|
pars[f'{self.prefix}BEC_amplitude'].set(value=(thermal_amplitude + BEC_amplitude))
|
||||||
# pars = self.make_params(BEC_amplitude=BEC_amplitude,
|
|
||||||
# thermal_amplitude=thermal_amplitude,
|
|
||||||
# BEC_centerx=pars_guess['A_centerx'].value, BEC_centery=pars_guess['A_centery'].value,
|
|
||||||
# BEC_sigmax=(pars_guess['A_sigmax'].value / 2.355), BEC_sigmay=(pars_guess['A_sigmay'].value / 2.355),
|
|
||||||
# thermal_centerx=pars_guess['B_centerx'].value, thermal_centery=pars_guess['B_centery'].value,
|
|
||||||
# thermal_sigmax=(pars_guess['B_sigmax'].value * s2), thermal_sigmay=(pars_guess['B_sigmay'].value * s2))
|
|
||||||
|
|
||||||
# pars[f'{self.prefix}BEC_sigmax'].set(min=0.0)
|
|
||||||
# pars[f'{self.prefix}BEC_sigmay'].set(min=0.0)
|
|
||||||
# pars[f'{self.prefix}thermal_sigmax'].set(min=0.0)
|
|
||||||
# pars[f'{self.prefix}thermal_sigmay'].set(min=0.0)
|
|
||||||
|
|
||||||
if condensateFraction < 0.3:
|
|
||||||
pars[f'{self.prefix}condensateFraction'].set(max=condensateFraction*1.5)
|
|
||||||
if condensateFraction > 0.5:
|
|
||||||
pars[f'{self.prefix}condensateFraction'].set(min=0.9)
|
|
||||||
|
|
||||||
# pars[f'{self.prefix}condensateFraction'].set(max=condensateFraction*1.5)
|
|
||||||
# pars[f'{self.prefix}condensateFraction'].set(min=condensateFraction*0.75)
|
|
||||||
|
|
||||||
return update_param_vals(pars, self.prefix, **kwargs)
|
return update_param_vals(pars, self.prefix, **kwargs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user