atomcloud.plots.plot_base module

class atomcloud.plots.plot_base.PlotBase[source]

Bases: object

get_data(data, mask, fit_dicts, verbose=True)[source]

Get the fit info and processed data for plotting.

Parameters:
  • data – The original data which was fit using the multi-function to determine the parameters (params).

  • mask – The mask to be applied to the data.

  • fit_dicts – Dictionary containing the fit results for a multi-function fit.

  • verbose – If True, the data for each function will be returned.

handle_title(title, base_title, base_save_name)[source]
mask_data(data, mask=None)[source]

Mask the data if a mask is provided.

Parameters:
  • data (ndarray) – The data to be masked.

  • mask (ndarray | None) – The mask to be applied to the data.

Returns:

The masked data

Return type:

ndarray

plot_data(multi_func, coords, data, params, func_strs, verbose=True)[source]

Gets the data for the plot.

Parameters:
  • multi_func (object) – The multi-function used to create the fit data.

  • x – The x coordinates of the data.

  • data (ndarray) – The original data which was fit using the multi-function to determine the parameters (params).

  • params (list[list[float]]) – The fit parameters to create the multi-function fit data.

  • func_strs (list[str]) – The function strings used in the multi-function.

  • verbose (bool) – If True, the data for each function will be returned.

  • coords (ndarray | Iterable[ndarray]) –

Returns:

A dictionary containing the original data, the total fit data, and the fit data for each function which comprises the multi-function fit.

Return type:

dict

save_plot(path, img_name)[source]

Save the current plot to a file.

Parameters:
  • path (str | Path) – The path to the directory where the image will be saved.

  • img_name (str) – The name of the image file.

  • Returns – None

Return type:

None

title_string(constraints=None, init_str='')[source]

Create a title string for a plot.

Parameters:
  • constraints (Iterable[str] | None) – A list of constraints which will be applied to the the functions in the multi-function (see ConstrainedMultiFunction for more details)

  • init_str (str) – The initial string which will be used in the title. This is useful if you want to add a title to a plot which already has a title.

Returns:

The title string

Return type:

str