DataXY#

class atompy.DataXY(x, y, title='', xlabel='', ylabel='', **plot_kwargs)[source]#

A class representing xy-data.

Parameters:
xarray_like

The histogram values, e.g., counts.

yarray_like

The edges of the histogram bins. Note that len(values) = len(edges) + 1

Note

If you want to initialize a Hist1d from centers instead of edges, use Hist1d.from_centers().

titlestr, default “”

Optional title of the data.

xlabelstr, default “”

Optional x-label of the data.

ylabelstr, default “”

Optional y-label of the data.

**plot_kwargs

Other keyword parameters will be stored in DataXY.plot_kwargs, which is used by DataXY.plot().

Attributes:
xndarray

x-data of the data set.

yndarray

y-data of the data set.

xytuple[ndarray, ndarray]

Tuple (x, y) data.

titlestr

Title of the data.

xlabelstr

X label of the data.

ylabelstr

Y label of the data.

plot_kwargsdict

Keyword arguments for matplotlib.pyplot.plot().

Methods

asarray([copy])

Return a 2d ndarray of the data.

copy()

Return a copy of data.

from_function(f, x[, title, xlabel, ylabel])

Instantiate from a function.

from_txt(fname[, data_layout, idx_x, idx_y, ...])

Initiate DataXY from a text file.

integrate()

Integrate data.

keep_x(xmin, xmax[, squeeze, ysetval])

Only keep data within [xmin, xmax).

keep_y(ymin, ymax[, squeeze, ysetval])

Only keep data within [ymin, ymax).

norm_to_integral()

Return the data normalized to DataXY.integrate().

norm_to_max()

Return the data normalized to DataXY.max().

norm_to_sum()

Return the data normalized to DataXY.sum().

plot([ax, fname, xlabel, ylabel, title, ...])

Plot the data using matplotlib.axes.Axes.plot().

remove_x(xmin, xmax[, squeeze, ysetval])

Remove data within [xmin, xmax).

remove_y(ymin, ymax[, squeeze, ysetval])

Remove data within [ymin, ymax).

sum()

Calculate sum of y values.

xlims()

Get (xmin, xmax).

xmax()

Get the maximum x-value.

xmin()

Get the minimum x-value.

ylims()

Get (ymin, ymax).

ymax()

Get the maximum y-value.

ymin()

Get the minimum y-value.