Mantid
|
Stores numeric values that are assumed to be bin edge values. More...
#include <BinEdgeAxis.h>
Public Member Functions | |
BinEdgeAxis (const std::size_t &length) | |
Constructor taking a length. More... | |
BinEdgeAxis (const std::vector< double > &edges) | |
Constructor taking a list of edge values. More... | |
Axis * | clone (const MatrixWorkspace *const parentWorkspace) override |
Virtual constructor. More... | |
Axis * | clone (const std::size_t length, const MatrixWorkspace *const parentWorkspace) override |
Virtual constructor. More... | |
std::vector< double > | createBinBoundaries () const override |
Return the values axis as they are. More... | |
size_t | indexOfValue (const double value) const override |
Treats values as bin edges and returns the index of the bin, which the value falls into. More... | |
std::string | label (const std::size_t &index) const override |
Returns a text label which shows the value at the given bin index. More... | |
void | setValue (const std::size_t &index, const double &value) override |
Sets the axis value at a given position. More... | |
Public Member Functions inherited from Mantid::API::NumericAxis | |
Axis * | clone (const MatrixWorkspace *const parentWorkspace) override |
Virtual constructor. More... | |
Axis * | clone (const std::size_t length, const MatrixWorkspace *const parentWorkspace) override |
Virtual constructor for axis of different length. More... | |
virtual std::vector< double > | createBinBoundaries () const |
Create bin boundaries from the point values. More... | |
virtual bool | equalWithinTolerance (const Axis &axis2, const double tolerance) const |
Check if two numeric axis are equivalent to a given tolerance. More... | |
double | getMax () const override |
returns max value defined on axis More... | |
double | getMin () const override |
returns min value defined on axis More... | |
virtual const std::vector< double > & | getValues () const |
Return a const reference to the values. More... | |
size_t | indexOfValue (const double value) const override |
Returns the index of the value wrt bin edge representation of the axis. More... | |
bool | isNumeric () const override |
Is the axis numeric - always true for this class. More... | |
std::string | label (const std::size_t &index) const override |
Returns a text label which shows the value corresponding to a bin index. More... | |
std::size_t | length () const override |
Get the length of the axis. More... | |
NumericAxis (const std::size_t &length) | |
Constructor. More... | |
NumericAxis (std::vector< double > centres) | |
Constructor taking a set of centre point values. More... | |
double | operator() (const std::size_t &index, const std::size_t &verticalIndex=0) const override |
Get a value at the specified index. More... | |
bool | operator== (const Axis &) const override |
Check if two axis defined as spectra or numeric axis are equivalent. More... | |
void | setValue (const std::size_t &index, const double &value) override |
Set the value at a specific index. More... | |
Public Member Functions inherited from Mantid::API::Axis | |
Axis () | |
Constructor. More... | |
virtual Axis * | clone (const MatrixWorkspace *const parentWorkspace)=0 |
Virtual constructor. More... | |
virtual Axis * | clone (const std::size_t length, const MatrixWorkspace *const parentWorkspace)=0 |
Virtual constructor for axis of different length. More... | |
virtual double | getMax () const =0 |
returns max value defined on axis More... | |
virtual double | getMin () const =0 |
returns min value defined on axis More... | |
double | getValue (const std::size_t &index, const std::size_t &verticalIndex=0) const |
Gets the value at the specified index. More... | |
virtual size_t | indexOfValue (const double value) const =0 |
Find the index of the given double value. More... | |
virtual bool | isNumeric () const |
Returns true if the axis is numeric. More... | |
virtual bool | isSpectra () const |
Returns true is the axis is a Spectra axis. More... | |
virtual bool | isText () const |
Returns true if the axis is Text. More... | |
virtual std::string | label (const std::size_t &index) const =0 |
Returns a text label of for a value Note that the index here is not the index of a value, but the effective index of the bin. More... | |
virtual std::size_t | length () const =0 |
Get the length of the axis. More... | |
virtual double | operator() (const std::size_t &index, const std::size_t &verticalIndex=0) const =0 |
Returns the value at a specified index. More... | |
virtual bool | operator== (const Axis &) const =0 |
Check whether two axis are the same, i.e same length and same spectra_values for all elements in the axis. More... | |
virtual const std::shared_ptr< Kernel::Unit > & | setUnit (const std::string &unitName) |
Set the unit on the Axis. More... | |
virtual void | setValue (const std::size_t &index, const double &value)=0 |
Sets the value at the specified index. More... | |
virtual specnum_t | spectraNo (const std::size_t &index) const |
Get the spectrum number. More... | |
std::string & | title () |
Returns a reference to the user-defined title for this axis. More... | |
const std::string & | title () const |
Returns the user-defined title for this axis. More... | |
std::shared_ptr< Kernel::Unit > & | unit () |
The unit object for this workspace (non const version) More... | |
const std::shared_ptr< Kernel::Unit > & | unit () const |
The unit for this axis. More... | |
virtual | ~Axis ()=default |
Additional Inherited Members | |
Protected Member Functions inherited from Mantid::API::NumericAxis | |
std::string | formatLabel (const double value) const |
Get number label. More... | |
NumericAxis () | |
Default constructor. More... | |
Protected Member Functions inherited from Mantid::API::Axis | |
Axis (const Axis &)=default | |
Axis & | operator= (const Axis &)=default |
Protected Attributes inherited from Mantid::API::NumericAxis | |
std::vector< double > | m_values |
A vector holding the centre values. More... | |
Stores numeric values that are assumed to be bin edge values.
It overrides indexOfValue to search using the values as bin edges are than centre points
Definition at line 20 of file BinEdgeAxis.h.
Mantid::API::BinEdgeAxis::BinEdgeAxis | ( | const std::size_t & | length | ) |
Constructor taking a length.
length | The length of the axis |
Definition at line 18 of file BinEdgeAxis.cpp.
References Mantid::API::NumericAxis::length(), and Mantid::API::NumericAxis::m_values.
Mantid::API::BinEdgeAxis::BinEdgeAxis | ( | const std::vector< double > & | edges | ) |
Constructor taking a list of edge values.
edges | A list of bin boundaries |
Definition at line 28 of file BinEdgeAxis.cpp.
References Mantid::API::NumericAxis::m_values.
|
overridevirtual |
Virtual constructor.
parentWorkspace | :: The workspace is not used in this implementation |
Implements Mantid::API::Axis.
Definition at line 39 of file BinEdgeAxis.cpp.
References UNUSED_ARG.
|
overridevirtual |
Virtual constructor.
length | A new length for the axis. The values are cleared. |
parentWorkspace | The workspace is not used in this implementation |
Implements Mantid::API::Axis.
Definition at line 49 of file BinEdgeAxis.cpp.
References Mantid::API::NumericAxis::length(), and UNUSED_ARG.
|
overridevirtual |
Return the values axis as they are.
Reimplemented from Mantid::API::NumericAxis.
Definition at line 61 of file BinEdgeAxis.cpp.
References Mantid::API::NumericAxis::getValues().
|
overridevirtual |
Treats values as bin edges and returns the index of the bin, which the value falls into.
The maximum value will always be length() - 1
value | A value on the axis |
Implements Mantid::API::Axis.
Definition at line 82 of file BinEdgeAxis.cpp.
References Mantid::Kernel::VectorHelper::indexOfValueFromEdges(), Mantid::API::NumericAxis::m_values, and value.
|
overridevirtual |
Returns a text label which shows the value at the given bin index.
Note that the bin index doesn't match the index in the value array for this type of axis. The value array has one more element than number of bins.
index | :: The bin index of the bin edge axis |
IndexError | if the bin index is out of range |
Implements Mantid::API::Axis.
Definition at line 93 of file BinEdgeAxis.cpp.
References Mantid::API::NumericAxis::formatLabel(), index, and Mantid::API::NumericAxis::length().
Referenced by Mantid::DataHandling::SaveAscii2::createSpectrumFilename(), and Mantid::DataHandling::SaveCanSAS1D2::exec().
|
overridevirtual |
Sets the axis value at a given position.
index | :: The position along the axis for which to set the value |
value | :: The new value |
IndexError | If the index requested is not in the range of this axis |
Implements Mantid::API::Axis.
Definition at line 68 of file BinEdgeAxis.cpp.
References index, Mantid::API::NumericAxis::length(), Mantid::API::NumericAxis::m_values, and value.