atomcloud.process_fits.rescale module

class atomcloud.process_fits.rescale.RescaleFitDicts[source]

Bases: IterateFitDict

Class to rescale any fit dictionary including multi-level fits, 1d multi-function fits, 2d multi-function fits and 2d sum fits. It can automatically determine the type of fit dictionary if not specified.

process_fitdict1d(fit_dict, axis=None, axis_scale=None, xscale=1.0, yscale=1.0, zscale=1.0, *args, **kwargs)[source]

Rescale a 1d multi-function fit dictionary including the fit. Simply calls the rescale_1d_fit function and places it in the object for broader use.

Parameters:
  • fit_dict (dict) –

  • axis (str | None) –

  • axis_scale (str | None) –

  • xscale (float) –

  • yscale (float) –

  • zscale (float) –

Return type:

dict

process_fitdict2d(fit_dict, xscale=1.0, yscale=1.0, zscale=1.0, *args, **kwargs)[source]

Rescale a 2d multi-function fit dictionary including the fit. Simply calls the rescale_2d_fit function and places it in the object for broader use.

Parameters:
  • fit_dict (dict) –

  • xscale (float) –

  • yscale (float) –

  • zscale (float) –

Return type:

dict

rescale_fitdict(fit_dict, dict_type=None, xscale=1.0, yscale=1.0, zscale=1.0)[source]

Rescale any returned fit dictionary including multi-level fits, 1d multi-function fits, 2d multi-function fits and 2d sum fits. It can automatically determine the type of fit dictionary if not specified. It also scales the fit parameters, analysis parameters and data sums.

Parameters:
  • fit_dict (dict) – dictionary of multi-function fit dictionaries

  • dict_type (str | None) – type of fit dictionary

  • xscale (float) – scalar to rescale x parameters by

  • yscale (float) – scalar to rescale y parameters by

  • zscale (float) – scalar to rescale z parameters by

Returns:

rescaled fit dictionaries

Return type:

rescale_fit_dicts

atomcloud.process_fits.rescale.get_number_scale(xscale, yscale, zscale)[source]

Scalar to multiple integrated atom numbers by. Takes into account scaling on all axes.

Parameters:
  • xscale (float) – scalar to rescale x parameters by

  • yscale (float) – scalar to rescale y parameters by

  • zscale (float) – scalar to rescale z parameters by

Returns:

scalar to multiple integrated atom numbers by

Return type:

number_scale

atomcloud.process_fits.rescale.rescale_1d_fit(fit_dict, axis=None, axis_scale=None, xscale=1.0, yscale=1.0, zscale=1.0)[source]

Rescale a 1d multi-function fit dictionary including the fit parameters, analysis parameters and data sums.

Parameters:
  • fit_dict (dict) – 1d multi-function fit dictionary.

  • axis (str | None) – axis to rescale. Must be ‘x’ or ‘y’

  • axis_scale (str | None) – scale to rescale axis by. Must be ‘x’ or ‘y’

  • xscale (float) – scalar to rescale x parameters by

  • yscale (float) – scalar to rescale y parameters by

  • zscale (float) – scalar to rescale z parameters by

Returns:

rescaled fit dictionary

Return type:

rescale_fit_dict

atomcloud.process_fits.rescale.rescale_2d_fit(fit_dict, xscale=1.0, yscale=1.0, zscale=1.0)[source]

Rescale a 2d multi-function fit dictionary including the fit parameters, analysis parameters and data sums.

Parameters:
  • fit_dict (dict) – 2d multi-function fit dictionary.

  • xscale (float) – scalar to rescale x parameters by

  • yscale (float) – scalar to rescale y parameters by

  • zscale (float) – scalar to rescale z parameters by

Returns:

rescaled fit dictionary

Return type:

rescale_fit_dict

atomcloud.process_fits.rescale.rescale_fit_dict(fit_dict, number_scale, func_scale, func_registry)[source]

Rescale the parameters of a single multi-function fit dictionary including the fit parameters, analysis parameters and data sums.

Parameters:
  • fit_dict (dict) – dictionary for a single multi-function fit

  • number_scale (float) – scalar to multiply integrated atom numbers

  • func_scale (list) – list of scalars to multiply function parameters by

  • func_registry (object) – registry of function objects corresponding to the equations used in the fit

Returns:

rescaled fit dictionary

Return type:

rescale_fit_dict

atomcloud.process_fits.rescale.rescale_fitdict(fit_dicts, dict_type=None, xscale=1.0, yscale=1.0, zscale=1.0)[source]

Rescale a multi-function fit dictionary including the fit parameters, analysis parameters and data sums.

Parameters:
  • fit_dicts (dict) – dictionary of multi-function fit dictionaries

  • dict_type (str | None) – type of fit dictionary

  • xscale (float) – scalar to rescale x parameters by

  • yscale (float) – scalar to rescale y parameters by

  • zscale (float) – scalar to rescale z parameters by

Returns:

rescaled fit dictionaries

Return type:

rescale_fit_dicts

atomcloud.process_fits.rescale.rescale_params(func_registry, equations, params, func_scale, analysis_params=False)[source]

Rescales either the fit parameters or analysis parameters for a multi-function fit. Iterates through each individual function in the multi-function fit and rescales those functions parameters using the rescaling equations defined in the individual function objects (called from the function registry).

Parameters:
  • func_registry (object) – registry of function objects corresponding to the equations used in the fit

  • equations (list[str]) – list of equations used in the fit

  • params (list[list[float]] | list[dict[str, float]]) – list of lists of fit parameters or analysis parameters

  • func_scale (float) – list of scalars to multiply function parameters by

  • analysis_params (bool) – boolean to indicate if the parameters are fit parameters or analysis parameters

Returns:

rescaled fit parameters or analysis parameters

Return type:

rescaled_params