atomcloud.plots.plot_2d module

Created on Tue Mar 22 23:03:21 2022

@author: hofer

class atomcloud.plots.plot_2d.Plot2DBase[source]

Bases: PlotBase

fig_axes(func_strs, verbose, ax_size=4.5)[source]

Generates the figure and axes for the 2D fit plot.

Parameters:
  • func_strs (list[str]) – The list of function strings used in the fit.

  • verbose (bool) – If True, the data for each function in the multi-function fit will be plotted.

  • ax_size (float) – The size of the each axis.

Returns:

A tuple containing the figure, a dictionary of the 2D axes, a dictionary of the 1D axes, and the colorbar axis. The keys for the 2D axes are ‘data’, ‘total’, and the function strings. The keys for the 1D axes are ‘x’ and ‘y’.

Return type:

tuple[matplotlib.pyplot.Figure, dict, dict, matplotlib.pyplot.Axes]

plot_1d(x, y, xdata_dict, ydata_dict, ax_dict, ptype)[source]

Plots the 1D sum data for the x and y axes.

Parameters:
  • x (ndarray) – The x coordinates of the data.

  • y (ndarray) – The y coordinates of the data.

  • xdata_dict (dict[str, numpy.ndarray]) – The dictionary containing the x-axis data.

  • ydata_dict (dict[str, numpy.ndarray]) – The dictionary containing the y-axis data.

  • ax_dict (dict[str, matplotlib.pyplot.Axes]) – The dictionary containing the x and y axes.

  • ptype (str) –

plot_2d(coords, data_dict, axes_2d, cax)[source]

Plots the 2D fit data including the original data, the total fit data, and the individual function fit data both for the sum data and the full 2d data.

Parameters:
  • coords (tuple[numpy.ndarray, numpy.ndarray]) – The tuple containing the x and y coordinates of the data.

  • data_dict (dict[str, numpy.ndarray]) – The dictionary containing the 2d data, total 2d fit data and the individual function 2d fit data.

  • axes_2d (dict[str, matplotlib.pyplot.Axes]) – The dictionary containing the 2d axes in the figure.

  • cax (matplotlib.pyplot.Axes) – The colorbar axis.

Return type:

None

set_colorbar_position(axes, cax)[source]

Set the position of the colorbar axis.

Parameters:
  • axes (list[list[matplotlib.pyplot.Axes]]) – The list of data axes in the figure.

  • cax (matplotlib.pyplot.Axes) – The colorbar axis.

class atomcloud.plots.plot_2d.Plot2DFit[source]

Bases: Plot2DBase

make a more general plotting class that can be used in a variety of objects

get_data1d(XY_tuple, data_dict, mask=None)[source]

Get the 1D data for the x and y axes for the sum data, total fit sum data, and the individual function sum data.

Parameters:
  • XY_tuple (tuple[numpy.ndarray, numpy.ndarray]) – The tuple containing the x and y coordinates of the data.

  • data_dict (dict[str, numpy.ndarray]) – The dictionary containing the 2d data, total 2d fit data

  • data. (and the individual function 2d fit) –

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

Returns:

A tuple containing the x and y coordinates of the data, and the x and y data dictionaries for the sum data, total fit sum data, and the individual function sum data.

Return type:

tuple[numpy.ndarray, numpy.ndarray, dict[str, numpy.ndarray], dict[str, numpy.ndarray]]

plot_fit(fit_dicts, XY_tuple, data, mask=None, title='', savepath=None, verbose=True, *args, **kwargs)[source]
Parameters:
  • fit_dicts (dict) –

  • XY_tuple (tuple[numpy.ndarray, numpy.ndarray]) –

  • data (ndarray) –

  • mask (ndarray | None) –

  • title (str) –

  • savepath (str | Path | None) –

  • verbose (bool) –

sum_data_mask(XY_tuple, data, mask)[source]

Sum the data in the masked region, but particularly for the case of weird masks this is a hacky way to do this, but it works for now