atomcloud.functions.func_base module

class atomcloud.functions.func_base.FunctionBase[source]

Bases: ABC

Base class for function objects

analyze_parameters(params)[source]

Analyzes the fit parameters of the function and returns a dictionary of the analysis parameters. :param params: The function parameters determined by the fit

Returns:

A dictionary of the analysis parameters

Parameters:

params (list[float]) –

Return type:

dict

abstract create_function(anp)[source]

Creates the function using the numpy or jax object given. This method must be overridden by the child class. :param anp: The numpy or jax object to use for the function

Returns:

The created function

Parameters:

anp (object) –

Return type:

callable

create_parameter_dict()[source]

Creates a dictionary of the parameters of the function

Return type:

None

default_bounds()[source]

Returns the default bounds for the fit. The default is to return (-np.inf, np.inf) for all parameters. This method can be overridden to return a different set of bounds if something more intelligent is desired. :returns: The default bounds for the fit

Return type:

tuple[list[float], …]

initial_seed(coords, data)[source]

Returns the initial seed parameters for the fit. The default is to return a list of ones for the parameters. This method can be overridden to return a different initial seed if something more intelligent is desired. :param coords: The coordinates to fit the function to :param data: The data to fit the function to

Returns:

The initial seed parameters for the fit

Parameters:
  • coords (ndarray | Iterable[ndarray]) –

  • data (ndarray) –

Return type:

list[float]

make_function(use_jax=False)[source]

Creates the class function. This function is created using the create_function method and will use jax if use_jax is True otherwise numpy will be used.

Parameters:

use_jax (bool) – Whether or not to use jax for the function.

Returns:

The jax or numpy function that is created

Return type:

callable

rescale_analysis_params(params, scales)[source]

Rescales the analysis parameters constructed from the fit parameters by the scales given for the x y and z axes. :param params: The analysis parameters constructed from the fit parameters :param scales: The scales for the x y and z axes

Returns:

The rescaled analysis parameters

Parameters:
  • params (dict) –

  • scales (list) –

Return type:

dict

rescale_parameters(params, scales)[source]

Rescales the parameters of the function determined by the fit by the scales given for the x y and z axes. :param params: The parameters of the function determined by the fit :param scales: The scales for the x y and z axes

Returns:

The rescaled fit parameters

Parameters:
  • params (list[float]) –

  • scales (list) –

Return type:

list[float]