BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Histogram1D Class Reference

Description

One dimensional histogram.

Inheritance diagram for Histogram1D:

Public Member Functions

 Histogram1D (const Powerfield &data)
 Constructor for 1D histograms from basic Powerfield object. More...
 
 Histogram1D (std::vector< IAxis * > axes, const std::vector< CumulativeValue > &data)
 
Powerfield * avgPowerfield () const
 Returns new Powerfield with histogram's shape and averaged content. More...
 
double binContent (size_t i) const
 Returns content (accumulated value) of bin i. More...
 
std::vector< double > binValues () const
 Returns vector of bin content (the value accumulated by bins) More...
 
Histogram1D * clone () const override
 Returns clone of histogram. More...
 
const Frame & frame () const
 Returns Frame, which holds all axes. More...
 
bool hasSameShape (const IHistogram &other) const
 Returns true if objects a) have same dimensions b) bin boundaries of axes coincide. More...
 
bool hasSameSizes (const IHistogram &other) const
 Returns true if object have same rank and number of axes bins. More...
 
PyObject * npArray () const
 Returns numpy array with bin content (normalized values). More...
 
size_t rank () const
 Returns number of histogram dimensions. More...
 
size_t size () const
 Returns total number of histogram bins. For 2D histograms the result will be the product of bin numbers along X and Y axes. More...
 
const IAxis & xAxis () const
 Returns x-axis. More...
 
const IAxis & yAxis () const
 Returns y-axis for 2D histograms. More...
 

Protected Member Functions

std::vector< double > flatVector () const
 
std::vector< double > rawVector () const
 
std::vector< double > stdvVector () const
 

Protected Attributes

const std::unique_ptr< const Frame > m_frame
 
std::vector< CumulativeValue > m_vec
 

Constructor & Destructor Documentation

◆ Histogram1D() [1/2]

Histogram1D::Histogram1D ( const Powerfield &  data)

Constructor for 1D histograms from basic Powerfield object.

◆ Histogram1D() [2/2]

Histogram1D::Histogram1D ( std::vector< IAxis * >  axes,
const std::vector< CumulativeValue > &  data 
)

Member Function Documentation

◆ avgPowerfield()

Powerfield* IHistogram::avgPowerfield ( ) const
inherited

Returns new Powerfield with histogram's shape and averaged content.

◆ binContent()

double IHistogram::binContent ( size_t  i) const
inherited

Returns content (accumulated value) of bin i.

◆ binValues()

std::vector<double> Histogram1D::binValues ( ) const

Returns vector of bin content (the value accumulated by bins)

◆ clone()

Histogram1D* Histogram1D::clone ( ) const
overridevirtual

Returns clone of histogram.

Implements IHistogram.

◆ flatVector()

std::vector<double> IHistogram::flatVector ( ) const
protectedinherited

◆ frame()

const Frame& IHistogram::frame ( ) const
inherited

Returns Frame, which holds all axes.

◆ hasSameShape()

bool IHistogram::hasSameShape ( const IHistogram &  other) const
inherited

Returns true if objects a) have same dimensions b) bin boundaries of axes coincide.

◆ hasSameSizes()

bool IHistogram::hasSameSizes ( const IHistogram &  other) const
inherited

Returns true if object have same rank and number of axes bins.

◆ npArray()

PyObject* IHistogram::npArray ( ) const
inherited

Returns numpy array with bin content (normalized values).

◆ rank()

size_t IHistogram::rank ( ) const
inherited

Returns number of histogram dimensions.

◆ rawVector()

std::vector<double> IHistogram::rawVector ( ) const
protectedinherited

◆ size()

size_t IHistogram::size ( ) const
inherited

Returns total number of histogram bins. For 2D histograms the result will be the product of bin numbers along X and Y axes.

◆ stdvVector()

std::vector<double> IHistogram::stdvVector ( ) const
protectedinherited

◆ xAxis()

const IAxis& IHistogram::xAxis ( ) const
inherited

Returns x-axis.

◆ yAxis()

const IAxis& IHistogram::yAxis ( ) const
inherited

Returns y-axis for 2D histograms.

Member Data Documentation

◆ m_frame

const std::unique_ptr<const Frame> IHistogram::m_frame
protectedinherited

◆ m_vec

std::vector<CumulativeValue> IHistogram::m_vec
protectedinherited