BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Two dimensional histogram. More...
Public Member Functions | |
Histogram2D (const IAxis &axis_x, const IAxis &axis_y) | |
Constructor for 2D histogram with custom axes. | |
Histogram2D (const OutputData< double > &data) | |
Constructor for 2D histograms from basic OutputData object. | |
Histogram2D (int nbinsx, const std::vector< double > &xbins, int nbinsy, const std::vector< double > &ybins) | |
Constructor for variable bin size histograms. More... | |
Histogram2D (int nbinsx, double xlow, double xup, int nbinsy, double ylow, double yup) | |
Constructor for fix bin size histograms. More... | |
Histogram2D (std::vector< std::vector< double >> data) | |
Constructor for 2D histograms from numpy array (thanks to swig) | |
void | addContent (const std::vector< std::vector< double >> &data) |
Add to values in histograms channels from numpy array,. | |
Histogram2D * | clone () const |
Returns clone of other histogram. | |
Histogram2D * | crop (double xmin, double ymin, double xmax, double ymax) |
Creates new histogram by applying rectangular clip. | |
int | fill (double x, double y, double weight=1.0) |
Increment bin with abscissa x and ordinate y with a weight. | |
Histogram1D * | projectionX () |
Project a 2D histogram into 1D histogram along X. More... | |
Histogram1D * | projectionX (double ylow, double yup) |
Project a 2D histogram into 1D histogram along X. More... | |
Histogram1D * | projectionX (double yvalue) |
Project a 2D histogram into 1D histogram along X. More... | |
Histogram1D * | projectionY () |
Project a 2D histogram into 1D histogram along Y. More... | |
Histogram1D * | projectionY (double xlow, double xup) |
Project a 2D histogram into 1D histogram along Y. More... | |
Histogram1D * | projectionY (double xvalue) |
Project a 2D histogram into 1D histogram along Y. More... | |
size_t | rank () const |
Returns the number of histogram dimensions. | |
void | setContent (const std::vector< std::vector< double >> &data) |
Sets the values in histograms channels from numpy array,. | |
Protected Member Functions | |
Histogram1D * | create_projectionX (int ybinlow, int ybinup) |
Creates projection along X. More... | |
Histogram1D * | create_projectionY (int xbinlow, int xbinup) |
Creates projection along Y. More... | |
template<typename T > | |
void | initFromShape (const T &data) |
Two dimensional histogram.
Histogram2D::Histogram2D | ( | int | nbinsx, |
double | xlow, | ||
double | xup, | ||
int | nbinsy, | ||
double | ylow, | ||
double | yup | ||
) |
Constructor for fix bin size histograms.
nbinsx | number of bins on X-axis |
xlow | low edge of the first bin of X-axis |
xup | upper edge of the last bin of X-axis |
nbinsy | number of bins on Y axis |
ylow | low edge of the first bin of Y-axis |
yup | upper edge of the last bin of Y-axis |
Histogram2D::Histogram2D | ( | int | nbinsx, |
const std::vector< double > & | xbins, | ||
int | nbinsy, | ||
const std::vector< double > & | ybins | ||
) |
Constructor for variable bin size histograms.
nbinsx | number of bins on X-axis |
xbins | Array of size nbins+1 containing low-edges for each bin and upper edge of last bin. |
nbinsy | number of bins on Y-axis |
ybins | Array of size nbins+1 containing low-edges for each bin and upper edge of last bin. |
|
protected |
Creates projection along X.
The projections is made by collecting the data in the range between [ybinlow, ybinup].
|
protected |
Creates projection along Y.
The projections is made by collecting the data in the range between [xbinlow, xbinup].
Histogram1D * Histogram2D::projectionX | ( | ) |
Project a 2D histogram into 1D histogram along X.
The projection is made from all bins along y-axis.
Histogram1D * Histogram2D::projectionX | ( | double | ylow, |
double | yup | ||
) |
Project a 2D histogram into 1D histogram along X.
The projection is made from all y-bins corresponding to ordinate between ylow and yup.
ylow | lower edje on y-axis |
yup | upper edje on y-axis |
Histogram1D * Histogram2D::projectionX | ( | double | yvalue | ) |
Project a 2D histogram into 1D histogram along X.
The projection is made from the y-bin closest to given ordinate yvalue.
yvalue | the value on y-axis at which projection is taken |
Histogram1D * Histogram2D::projectionY | ( | ) |
Project a 2D histogram into 1D histogram along Y.
The projection is made from all bins along x-axis.
Histogram1D * Histogram2D::projectionY | ( | double | xlow, |
double | xup | ||
) |
Project a 2D histogram into 1D histogram along Y.
The projection is made from all x-bins corresponding to abscissa between xlow and xup.
xlow | lower edje on x-axis |
xup | upper edje on x-axis |
Histogram1D * Histogram2D::projectionY | ( | double | xvalue | ) |
Project a 2D histogram into 1D histogram along Y.
The projection is made from the x-bin closest to given abscissa xvalue.
xvalue | the value on x-axis at which projection is taken |