Mantid
|
A class to represent the axis of a 2D (or more) workspace where the value at a given point on the axis varies along the other dimension. More...
#include <RefAxis.h>
Public Member Functions | |
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... | |
std::vector< double > | createBinBoundaries () const override |
Create bin boundaries from the point values. More... | |
bool | equalWithinTolerance (const Axis &axis2, const double tolerance) const override |
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... | |
const std::vector< double > & | getValues () const override |
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... | |
std::size_t | length () const override |
Get the length of the axis. More... | |
double | operator() (const std::size_t &index, const std::size_t &verticalIndex) 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... | |
RefAxis (const MatrixWorkspace *const parentWorkspace) | |
Constructor. More... | |
void | setValue (const std::size_t &index, const double &value) override |
Method not available for RefAxis. 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 |
Private Member Functions | |
const RefAxis & | operator= (const RefAxis &) |
Private, undefined copy assignment operator. More... | |
RefAxis (const RefAxis &) | |
Private, undefined 'regular' copy constructor. More... | |
RefAxis (const RefAxis &right, const MatrixWorkspace *const parentWorkspace) | |
Private, specialised copy constructor. More... | |
Private Attributes | |
const MatrixWorkspace *const | m_parentWS |
A pointer to the workspace holding the axis. More... | |
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... | |
A class to represent the axis of a 2D (or more) workspace where the value at a given point on the axis varies along the other dimension.
This class does not hold the axis values itself; they are held by the X vectors of the workspace itself. An axis of this kind is always of numeric type.
Mantid::API::RefAxis::RefAxis | ( | const MatrixWorkspace *const | parentWorkspace | ) |
Constructor.
parentWorkspace | :: A pointer to the workspace that holds this axis |
Definition at line 17 of file RefAxis.cpp.
|
private |
Private, specialised copy constructor.
Needed because it's necessary to pass in a pointer to the parent of the new workspace, rather than having the copy point to the parent of the copied axis.
right | :: The axis to copy |
parentWorkspace | :: A pointer to the parent workspace of the new axis |
Definition at line 27 of file RefAxis.cpp.
|
private |
Private, undefined 'regular' copy constructor.
|
overridevirtual |
Virtual constructor.
parentWorkspace | :: A pointer to the workspace that will hold the new axis |
Reimplemented from Mantid::API::NumericAxis.
Definition at line 35 of file RefAxis.cpp.
Referenced by clone().
|
overridevirtual |
Virtual constructor for axis of different length.
Reimplemented from Mantid::API::NumericAxis.
Definition at line 37 of file RefAxis.cpp.
|
overridevirtual |
Create bin boundaries from the point values.
Create a set of bin boundaries from the centre point values.
Reimplemented from Mantid::API::NumericAxis.
Definition at line 99 of file RefAxis.cpp.
|
overridevirtual |
Check if two numeric axis are equivalent to a given tolerance.
axis2 | :: Reference to the axis to compare to |
tolerance | :: Tolerance to compare to |
Reimplemented from Mantid::API::NumericAxis.
Definition at line 89 of file RefAxis.cpp.
References operator==(), tolerance, and UNUSED_ARG.
|
overridevirtual |
returns max value defined on axis
Reimplemented from Mantid::API::NumericAxis.
Definition at line 111 of file RefAxis.cpp.
|
overridevirtual |
returns min value defined on axis
Reimplemented from Mantid::API::NumericAxis.
Definition at line 107 of file RefAxis.cpp.
|
overridevirtual |
Return a const reference to the values.
Get a const reference to the vector of values in this axis.
Reimplemented from Mantid::API::NumericAxis.
Definition at line 103 of file RefAxis.cpp.
|
overridevirtual |
Returns the index of the value wrt bin edge representation of the axis.
value | A value to find in a bin |
Reimplemented from Mantid::API::NumericAxis.
Definition at line 94 of file RefAxis.cpp.
References UNUSED_ARG, and value.
|
overridevirtual |
Get the length of the axis.
Reimplemented from Mantid::API::NumericAxis.
Definition at line 42 of file RefAxis.cpp.
References m_parentWS, and Mantid::API::MatrixWorkspace::x().
Referenced by clone(), and operator==().
|
overridevirtual |
Get a value at the specified index.
Get the axis value at the position given.
In this case, the values are held in the X vectors of the workspace itself.
index | The position along the axis for which the value is required |
verticalIndex | The position along the orthogonal axis |
IndexError | If 'index' is not in the range of this axis |
std::range_error | If 'verticalIndex' is not in the range of the parent workspace |
Reimplemented from Mantid::API::NumericAxis.
Definition at line 54 of file RefAxis.cpp.
References index, m_parentWS, Mantid::API::MatrixWorkspace::x(), and Mantid::Geometry::x.
Private, undefined copy assignment operator.
|
overridevirtual |
Check if two axis defined as spectra or numeric axis are equivalent.
axis2 | :: Reference to the axis to compare to |
Reimplemented from Mantid::API::NumericAxis.
Definition at line 76 of file RefAxis.cpp.
References Mantid::API::Axis::length(), and length().
Referenced by equalWithinTolerance().
|
overridevirtual |
Method not available for RefAxis.
Will always throw.
index | location for setting |
value | the value to set |
Reimplemented from Mantid::API::NumericAxis.
Definition at line 66 of file RefAxis.cpp.
References index, UNUSED_ARG, and value.
|
private |
A pointer to the workspace holding the axis.
Definition at line 51 of file RefAxis.h.
Referenced by length(), and operator()().