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) + 1Note
If you want to initialize a
Hist1dfrom centers instead of edges, useHist1d.from_centers().- title
str, default “” Optional title of the data.
- xlabel
str, default “” Optional x-label of the data.
- ylabel
str, default “” Optional y-label of the data.
- **plot_kwargs
Other keyword parameters will be stored in
DataXY.plot_kwargs, which is used byDataXY.plot().
- Attributes:
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
DataXYfrom a text file.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).
Return the data normalized to
DataXY.integrate().Return the data normalized to
DataXY.max().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.