15 #ifndef BORNAGAIN_CORE_INTENSITY_HISTOGRAM2D_H
16 #define BORNAGAIN_CORE_INTENSITY_HISTOGRAM2D_H
34 Histogram2D(
int nbinsx,
double xlow,
double xup,
int nbinsy,
double ylow,
double yup);
43 Histogram2D(
int nbinsx,
const std::vector<double>& xbins,
int nbinsy,
44 const std::vector<double>& ybins);
62 int fill(
double x,
double y,
double weight = 1.0);
98 void setContent(
const std::vector<std::vector<double>>& data);
101 void addContent(
const std::vector<std::vector<double>>& data);
118 const size_t nrows = shape.first;
119 const size_t ncols = shape.second;
121 if (nrows == 0 || ncols == 0)
123 "Not a two-dimensional numpy array");
Defines various functions to interact from numpy on Python side.
Defines class IHistogram.
Axis with fixed bin size.
One dimensional histogram.
Two dimensional histogram.
Histogram1D * create_projectionY(int xbinlow, int xbinup)
Creates projection along Y.
void setContent(const std::vector< std::vector< double >> &data)
Sets the values in histograms channels from numpy array,.
int fill(double x, double y, double weight=1.0)
Increment bin with abscissa x and ordinate y with a weight.
void addContent(const std::vector< std::vector< double >> &data)
Add to values in histograms channels from numpy array,.
Histogram1D * projectionY()
Project a 2D histogram into 1D histogram along Y.
void initFromShape(const T &data)
Histogram2D * crop(double xmin, double ymin, double xmax, double ymax)
Creates new histogram by applying rectangular clip.
Histogram1D * projectionX()
Project a 2D histogram into 1D histogram along X.
Histogram2D(int nbinsx, double xlow, double xup, int nbinsy, double ylow, double yup)
Constructor for fix bin size histograms.
Histogram1D * create_projectionX(int ybinlow, int ybinup)
Creates projection along X.
Histogram2D * clone() const
Returns clone of other histogram.
size_t getRank() const
Returns the number of histogram dimensions.
Interface for one-dimensional axes.
Base class for 1D and 2D histograms holding values of double type.
OutputData< CumulativeValue > m_data
void addAxis(const IAxis &new_axis)
std::pair< size_t, size_t > getShape(const T &data)
Returns shape nrows, ncols of 2D array.