|
@ -331,7 +331,10 @@ class DensityProfileBEC2dModel(Model): |
|
|
self._set_paramhints_prefix() |
|
|
self._set_paramhints_prefix() |
|
|
|
|
|
|
|
|
def _set_paramhints_prefix(self): |
|
|
def _set_paramhints_prefix(self): |
|
|
self.set_param_hint('BEC_sigmax', min=0) |
|
|
|
|
|
|
|
|
# self.set_param_hint('BEC_sigmax', min=0) |
|
|
|
|
|
self.set_param_hint('deltax', min=0) |
|
|
|
|
|
self.set_param_hint('BEC_sigmax', expr=f'3 * {self.prefix}thermal_sigmax - {self.prefix}deltax') |
|
|
|
|
|
|
|
|
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) |
|
@ -341,12 +344,26 @@ class DensityProfileBEC2dModel(Model): |
|
|
self.set_param_hint('thermalAspectRatio', min=0.8, max=1.2) |
|
|
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('thermal_sigmay', expr=f'{self.prefix}thermalAspectRatio * {self.prefix}thermal_sigmax') |
|
|
|
|
|
|
|
|
|
|
|
# self.set_param_hint('betax', value=0) |
|
|
|
|
|
# self.set_param_hint('BEC_centerx', expr=f'{self.prefix}thermal_sigmax - {self.prefix}betax') |
|
|
|
|
|
|
|
|
self.set_param_hint('condensate_fraction', expr=f'{self.prefix}BEC_amplitude / ({self.prefix}BEC_amplitude + {self.prefix}thermal_amplitude)') |
|
|
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, pureBECThreshold=0.5, noBECThThreshold=0.0, **kwargs): |
|
|
def guess(self, data, x, y, negative=False, pureBECThreshold=0.5, noBECThThreshold=0.0, **kwargs): |
|
|
"""Estimate initial model parameter values from data.""" |
|
|
"""Estimate initial model parameter values from data.""" |
|
|
fitModel = TwoGaussian2dModel() |
|
|
fitModel = TwoGaussian2dModel() |
|
|
pars = fitModel.guess(data, x=x, y=y, negative=negative) |
|
|
pars = fitModel.guess(data, x=x, y=y, negative=negative) |
|
|
|
|
|
pars['A_amplitude'].set(min=0) |
|
|
|
|
|
pars['B_amplitude'].set(min=0) |
|
|
|
|
|
pars['A_centerx'].set(min=pars['A_centerx'].value - 3 * pars['A_sigmax'], |
|
|
|
|
|
max=pars['A_centerx'].value + 3 * pars['A_sigmax'],) |
|
|
|
|
|
pars['A_centery'].set(min=pars['A_centery'].value - 3 * pars['A_sigmay'], |
|
|
|
|
|
max=pars['A_centery'].value + 3 * pars['A_sigmay'],) |
|
|
|
|
|
pars['B_centerx'].set(min=pars['B_centerx'].value - 3 * pars['B_sigmax'], |
|
|
|
|
|
max=pars['B_centerx'].value + 3 * pars['B_sigmax'],) |
|
|
|
|
|
pars['B_centery'].set(min=pars['B_centery'].value - 3 * pars['B_sigmay'], |
|
|
|
|
|
max=pars['B_centery'].value + 3 * pars['B_sigmay'],) |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
@ -356,25 +373,59 @@ class DensityProfileBEC2dModel(Model): |
|
|
pars = self.make_params(BEC_amplitude=BEC_amplitude, |
|
|
pars = self.make_params(BEC_amplitude=BEC_amplitude, |
|
|
thermal_amplitude=thermal_amplitude, |
|
|
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), |
|
|
|
|
|
deltax = 3 * (pars_guess['B_sigmax'].value * s2) - (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_sigmax=(pars_guess['B_sigmax'].value * s2), |
|
|
thermalAspectRatio=(pars_guess['B_sigmax'].value * s2) / (pars_guess['B_sigmay'].value * s2) |
|
|
thermalAspectRatio=(pars_guess['B_sigmax'].value * s2) / (pars_guess['B_sigmay'].value * s2) |
|
|
# thermal_sigmay=(pars_guess['B_sigmay'].value * s2) |
|
|
# thermal_sigmay=(pars_guess['B_sigmay'].value * s2) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
if BEC_amplitude / (thermal_amplitude + BEC_amplitude) > pureBECThreshold: |
|
|
|
|
|
if np.abs(1 - pars_guess['A_sigmax'].value / pars_guess['A_sigmay'].value) < 0.1: |
|
|
|
|
|
pars[f'{self.prefix}BEC_amplitude'].set(value=0) |
|
|
|
|
|
pars[f'{self.prefix}thermal_amplitude'].set(value=(thermal_amplitude + BEC_amplitude)) |
|
|
|
|
|
|
|
|
nBEC = pars[f'{self.prefix}BEC_amplitude'] / 2 / np.pi / 5.546 / pars[f'{self.prefix}BEC_sigmay'] / pars[f'{self.prefix}BEC_sigmax'] |
|
|
|
|
|
if (pars[f'{self.prefix}condensate_fraction']>0.95) and (np.max(data) > 1.05 * nBEC): |
|
|
|
|
|
temp = ((np.max(data) - nBEC) * s2pi * pars[f'{self.prefix}thermal_sigmay'] / pars[f'{self.prefix}thermal_sigmax']) |
|
|
|
|
|
if temp > pars[f'{self.prefix}BEC_amplitude']: |
|
|
|
|
|
pars[f'{self.prefix}thermal_amplitude'].set(value=pars[f'{self.prefix}BEC_amplitude'] / 2) |
|
|
else: |
|
|
else: |
|
|
pars[f'{self.prefix}thermal_amplitude'].set(value=0) |
|
|
|
|
|
pars[f'{self.prefix}BEC_amplitude'].set(value=(thermal_amplitude + BEC_amplitude)) |
|
|
|
|
|
|
|
|
pars[f'{self.prefix}thermal_amplitude'].set(value=temp * 10) |
|
|
|
|
|
|
|
|
|
|
|
if BEC_amplitude / (thermal_amplitude + BEC_amplitude) > pureBECThreshold: |
|
|
|
|
|
pars[f'{self.prefix}thermal_amplitude'].set(value=0) |
|
|
|
|
|
pars[f'{self.prefix}BEC_amplitude'].set(value=(thermal_amplitude + BEC_amplitude)) |
|
|
|
|
|
|
|
|
if BEC_amplitude / (thermal_amplitude + BEC_amplitude) < noBECThThreshold: |
|
|
if BEC_amplitude / (thermal_amplitude + BEC_amplitude) < noBECThThreshold: |
|
|
pars[f'{self.prefix}BEC_amplitude'].set(value=0) |
|
|
pars[f'{self.prefix}BEC_amplitude'].set(value=0) |
|
|
pars[f'{self.prefix}thermal_amplitude'].set(value=(thermal_amplitude + BEC_amplitude)) |
|
|
pars[f'{self.prefix}thermal_amplitude'].set(value=(thermal_amplitude + BEC_amplitude)) |
|
|
|
|
|
|
|
|
|
|
|
pars[f'{self.prefix}BEC_centerx'].set( |
|
|
|
|
|
min=pars[f'{self.prefix}BEC_centerx'].value - 10 * pars[f'{self.prefix}BEC_sigmax'].value, |
|
|
|
|
|
max=pars[f'{self.prefix}BEC_centerx'].value + 10 * pars[f'{self.prefix}BEC_sigmax'].value, |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
pars[f'{self.prefix}thermal_centerx'].set( |
|
|
|
|
|
min=pars[f'{self.prefix}thermal_centerx'].value - 3 * pars[f'{self.prefix}thermal_sigmax'].value, |
|
|
|
|
|
max=pars[f'{self.prefix}thermal_centerx'].value + 3 * pars[f'{self.prefix}thermal_sigmax'].value, |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
pars[f'{self.prefix}BEC_centery'].set( |
|
|
|
|
|
min=pars[f'{self.prefix}BEC_centery'].value - 10 * pars[f'{self.prefix}BEC_sigmay'].value, |
|
|
|
|
|
max=pars[f'{self.prefix}BEC_centery'].value + 10 * pars[f'{self.prefix}BEC_sigmay'].value, |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
pars[f'{self.prefix}thermal_centery'].set( |
|
|
|
|
|
min=pars[f'{self.prefix}thermal_centery'].value - 3 * pars[f'{self.prefix}thermal_sigmay'].value, |
|
|
|
|
|
max=pars[f'{self.prefix}thermal_centery'].value + 3 * pars[f'{self.prefix}thermal_sigmay'].value, |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
pars[f'{self.prefix}BEC_sigmay'].set( |
|
|
|
|
|
max=5 * pars[f'{self.prefix}BEC_sigmay'].value, |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
pars[f'{self.prefix}thermal_sigmax'].set( |
|
|
|
|
|
max=5 * pars[f'{self.prefix}thermal_sigmax'].value, |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
return update_param_vals(pars, self.prefix, **kwargs) |
|
|
return update_param_vals(pars, self.prefix, **kwargs) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|