atomcloud.functions.funcs_sumfit module
A registry of all the sumfunctions used to convert between 1D and 2D functions. If a user has a custom function they must define both the 1D and 2D versions of the function as well as this sumfunction object. The user should inherit from the SumFunctionBase class and define the sumfunction and the inverse sumfunction. The user should then add the sumfunction to the SUMFUNCTIONS registry with a key. This function can then be called using the sumfit object.
from atomcloud.functions import SumFunctionBase, SUMFUNCTIONS
class Lorentz(SumFitBaseFunc):
- def convert_2d_sum(self, XY_tuple, params):
amp2d, x0, y0, sigmax, sigmay, theta = params amps1d = amps_2D_to_1D(amp2d, sigmax, sigmay, self.gaussian1D_amp) xsum_amp, ysum_amp = amps1d return [xsum_amp, sigmax, x0], [ysum_amp, sigmay, y0]
- def convert_sum_2D(self, XY_tuple, xparams, yparams):
ax, sigmax, x0 = xparams ay, sigmay, y0 = yparams amp = amps_1D_to_2D(ax, ay, sigmax, sigmay, self.gaussian1D_amp) return [amp, x0, y0, sigmax, sigmay, 0]
SUMFUNCTIONS.register(‘lorentz’, Lorentz)
- class atomcloud.functions.funcs_sumfit.FixedOffset[source]
Bases:
SumFitBaseFuncSee SumFitBaseFunc for documentation
- convert_2d_sum(XY_tuple, params)[source]
Converts 2D function parameters into two sets of 1D parameters along the x and y axes respectively. :param coords: The 2D coordinates of the data being fit :param params: The 2D parameters of the function being fit
- Returns:
The 1D function parameters along the x and y axes
- class atomcloud.functions.funcs_sumfit.Gaussian[source]
Bases:
SumFitBaseFuncSee SumFitBaseFunc for documentation
- convert_2d_sum(XY_tuple, params)[source]
Converts 2D function parameters into two sets of 1D parameters along the x and y axes respectively. :param coords: The 2D coordinates of the data being fit :param params: The 2D parameters of the function being fit
- Returns:
The 1D function parameters along the x and y axes
- convert_sum_2D(XY_tuple, xparams, yparams)[source]
Takes the 1D fit parameters of the sums along the x and y axes and converts them into 2D parameters. :param coords: The 2D coordinates of the data being fit :param xparams: The 1D sum fit parameters along the x axis :param yparams: The 1D sum fit parameters along the y axis
- Returns:
The 2D function parameters
- class atomcloud.functions.funcs_sumfit.Parabola[source]
Bases:
SumFitBaseFuncSee SumFitBaseFunc for documentation
- convert_2d_sum(XY_tuple, params)[source]
Converts 2D function parameters into two sets of 1D parameters along the x and y axes respectively. :param coords: The 2D coordinates of the data being fit :param params: The 2D parameters of the function being fit
- Returns:
The 1D function parameters along the x and y axes
- convert_sum_2D(XY_tuple, xparams, yparams)[source]
Takes the 1D fit parameters of the sums along the x and y axes and converts them into 2D parameters. :param coords: The 2D coordinates of the data being fit :param xparams: The 1D sum fit parameters along the x axis :param yparams: The 1D sum fit parameters along the y axis
- Returns:
The 2D function parameters
- class atomcloud.functions.funcs_sumfit.SumFitBaseFunc[source]
Bases:
ABC- abstract convert_2d_sum(coords, params)[source]
Converts 2D function parameters into two sets of 1D parameters along the x and y axes respectively. :param coords: The 2D coordinates of the data being fit :param params: The 2D parameters of the function being fit
- Returns:
The 1D function parameters along the x and y axes
- Parameters:
coords (Iterable[ndarray]) –
params (list[float]) –
- Return type:
tuple[list[float]]
- abstract convert_sum_2D(coords, xparams, yparams)[source]
Takes the 1D fit parameters of the sums along the x and y axes and converts them into 2D parameters. :param coords: The 2D coordinates of the data being fit :param xparams: The 1D sum fit parameters along the x axis :param yparams: The 1D sum fit parameters along the y axis
- Returns:
The 2D function parameters
- Parameters:
coords (Iterable[ndarray]) –
xparams (list[float]) –
yparams (list[float]) –
- Return type:
tuple[list[float]]
- class atomcloud.functions.funcs_sumfit.ThomasFermi[source]
Bases:
SumFitBaseFuncSee SumFitBaseFunc for documentation
- convert_2d_sum(XY_tuple, params)[source]
Converts 2D function parameters into two sets of 1D parameters along the x and y axes respectively. :param coords: The 2D coordinates of the data being fit :param params: The 2D parameters of the function being fit
- Returns:
The 1D function parameters along the x and y axes
- convert_sum_2D(XY_tuple, xparams, yparams)[source]
Takes the 1D fit parameters of the sums along the x and y axes and converts them into 2D parameters. :param coords: The 2D coordinates of the data being fit :param xparams: The 1D sum fit parameters along the x axis :param yparams: The 1D sum fit parameters along the y axis
- Returns:
The 2D function parameters
- atomcloud.functions.funcs_sumfit.amps_1D_to_2D(x_amp, y_amp, sigma_x, sigma_y, scalar_function)[source]
Converts 1D amplitudes to 2D sum amplitudes and averages them to get a single converted offset (see amps_1D_to_2D function for more details on the conversion).
- Parameters:
x_amp (float) – The 1D sum amplitude along the x axis
y_amp (float) – The 1D sum amplitude along the y axis
sigma_x (float) – The sigma along the x axis
sigma_y (float) – The sigma along the y axis
scalar_function (True) – A function that scales between sum and 2D amplitudes
- Returns:
The 2D amplitude
- Return type:
float
- atomcloud.functions.funcs_sumfit.amps_2D_to_1D(amp, sigma_x, sigma_y, scalar)[source]
Converts 2D amplitudes to 1D sum amplitudes. For the 1D equations used for fitting the atom cloud integrating along one axis means the 2D peak amplitude get’s multiplied by a scalar which is a function of the functions radius. These scalars have been calculated in mathematica and are found in the ConvertAmp object.
- Parameters:
amp (float) – The 2D amplitude
sigma_x (float) – The sigma along the x axis
sigma_y (float) – The sigma along the y axis
scalar (True) – A function scales between sum and 2D amplitudes
- Returns:
The 1D amplitudes along the x and y axes
- Return type:
tuple[float, float]