Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Mantid::API::Axis Class Referenceabstract

Class to represent the axis of a workspace. More...

#include <Axis.h>

Inheritance diagram for Mantid::API::Axis:
Mantid::API::NumericAxis Mantid::API::SpectraAxis Mantid::API::TextAxis Mantid::API::BinEdgeAxis Mantid::API::RefAxis

Public Member Functions

 Axis ()
 Constructor. More...
 
virtual Axisclone (const MatrixWorkspace *const parentWorkspace)=0
 Virtual constructor. More...
 
virtual Axisclone (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
 

Protected Member Functions

 Axis (const Axis &)=default
 
Axisoperator= (const Axis &)=default
 

Private Attributes

std::string m_title
 The user-defined title for this axis. More...
 
std::shared_ptr< Kernel::Unitm_unit
 The unit for this axis. More...
 

Detailed Description

Class to represent the axis of a workspace.

Author
Russell Taylor, Tessella Support Services plc
Date
16/05/2008

Definition at line 30 of file Axis.h.

Constructor & Destructor Documentation

◆ Axis() [1/2]

Mantid::API::Axis::Axis ( )

Constructor.

Definition at line 17 of file Axis.cpp.

References Mantid::DataObjects::create().

◆ ~Axis()

virtual Mantid::API::Axis::~Axis ( )
virtualdefault

◆ Axis() [2/2]

Mantid::API::Axis::Axis ( const Axis )
protecteddefault

Member Function Documentation

◆ clone() [1/2]

virtual Axis * Mantid::API::Axis::clone ( const MatrixWorkspace *const  parentWorkspace)
pure virtual

◆ clone() [2/2]

virtual Axis * Mantid::API::Axis::clone ( const std::size_t  length,
const MatrixWorkspace *const  parentWorkspace 
)
pure virtual

Virtual constructor for axis of different length.

Implemented in Mantid::API::BinEdgeAxis, Mantid::API::NumericAxis, Mantid::API::RefAxis, Mantid::API::SpectraAxis, and Mantid::API::TextAxis.

◆ getMax()

virtual double Mantid::API::Axis::getMax ( ) const
pure virtual

◆ getMin()

virtual double Mantid::API::Axis::getMin ( ) const
pure virtual

◆ getValue()

double Mantid::API::Axis::getValue ( const std::size_t &  index,
const std::size_t &  verticalIndex = 0 
) const

Gets the value at the specified index.

Just calls operator() but is easier to use with Axis pointers

Easier to use with pointers than the operator()

Parameters
index:: The index along the axis direction
verticalIndex:: The verticalIndex (used in RefAxis)
Returns
The double value at the given index

Definition at line 51 of file Axis.cpp.

References index.

Referenced by Mantid::Algorithms::ConvertAxisByFormula::exec(), Mantid::Algorithms::MagFormFactorCorrection::exec(), Mantid::MDAlgorithms::ConvertToDetectorFaceMD::exec(), export_Axis(), Mantid::Algorithms::GetQsInQENSData::extractQValues(), Mantid::DataHandling::AxisHelper::AxisProxy::getCentre(), Mantid::DataHandling::AxisHelper::BinEdgeAxisProxy::getCentre(), and Mantid::API::SpectraAxis::indexOfValue().

◆ indexOfValue()

virtual size_t Mantid::API::Axis::indexOfValue ( const double  value) const
pure virtual

◆ isNumeric()

virtual bool Mantid::API::Axis::isNumeric ( ) const
inlinevirtual

◆ isSpectra()

virtual bool Mantid::API::Axis::isSpectra ( ) const
inlinevirtual

◆ isText()

virtual bool Mantid::API::Axis::isText ( ) const
inlinevirtual

◆ label()

virtual std::string Mantid::API::Axis::label ( const std::size_t &  index) const
pure virtual

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.

Implemented in Mantid::API::BinEdgeAxis, Mantid::API::NumericAxis, Mantid::API::SpectraAxis, and Mantid::API::TextAxis.

Referenced by Mantid::Algorithms::ExtractSpectra2::exec(), export_Axis(), and Mantid::NeXus::NexusFileIO::writeNexusProcessedData2D().

◆ length()

virtual std::size_t Mantid::API::Axis::length ( ) const
pure virtual

◆ operator()()

virtual double Mantid::API::Axis::operator() ( const std::size_t &  index,
const std::size_t &  verticalIndex = 0 
) const
pure virtual

Returns the value at a specified index.

Parameters
index:: the index
verticalIndex:: The verticalIndex

Implemented in Mantid::API::RefAxis, Mantid::API::NumericAxis, Mantid::API::SpectraAxis, and Mantid::API::TextAxis.

◆ operator=()

Axis & Mantid::API::Axis::operator= ( const Axis )
protecteddefault

◆ operator==()

virtual bool Mantid::API::Axis::operator== ( const Axis ) const
pure virtual

Check whether two axis are the same, i.e same length and same spectra_values for all elements in the axis.

Implemented in Mantid::API::NumericAxis, Mantid::API::RefAxis, Mantid::API::SpectraAxis, and Mantid::API::TextAxis.

◆ setUnit()

const Kernel::Unit_sptr & Mantid::API::Axis::setUnit ( const std::string &  unitName)
virtual

Set the unit on the Axis.

Sets the Unit that is in use on this axis.

Parameters
unitName:: name of the unit as known to the UnitFactory
Returns
The new unit instance

Definition at line 39 of file Axis.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance(), m_unit, and unit().

Referenced by export_Axis(), and Mantid::Algorithms::ExportTimeSeriesLog::setupWorkspace2D().

◆ setValue()

virtual void Mantid::API::Axis::setValue ( const std::size_t &  index,
const double &  value 
)
pure virtual

◆ spectraNo()

specnum_t Mantid::API::Axis::spectraNo ( const std::size_t &  index) const
virtual

Get the spectrum number.

Returns the spectrum number at the position given (Spectra axis only)

Parameters
indexThe position for which the value is required
Returns
The spectrum number as an int
Exceptions
domain_errorIf this method is called on a numeric axis

Reimplemented in Mantid::API::SpectraAxis.

Definition at line 60 of file Axis.cpp.

References index, and UNUSED_ARG.

Referenced by Mantid::Algorithms::DiffractionFocussing::exec(), Mantid::CurveFitting::Algorithms::getWorkspaceIndicesFromAxes(), and Mantid::API::SpectraAxis::operator==().

◆ title() [1/2]

std::string & Mantid::API::Axis::title ( )

Returns a reference to the user-defined title for this axis.

Definition at line 23 of file Axis.cpp.

References m_title.

◆ title() [2/2]

const std::string & Mantid::API::Axis::title ( ) const

◆ unit() [1/2]

Kernel::Unit_sptr & Mantid::API::Axis::unit ( )

The unit object for this workspace (non const version)

Returns
A shared pointer to the unit object

Definition at line 33 of file Axis.cpp.

References m_unit.

◆ unit() [2/2]

const Kernel::Unit_sptr & Mantid::API::Axis::unit ( ) const

The unit for this axis.

Returns
A shared pointer to the unit object

Definition at line 28 of file Axis.cpp.

References m_unit.

Referenced by Mantid::DataHandling::LoadMuonNexusV2::applyTimeAxisUnitCorrection(), Mantid::Algorithms::CompareWorkspaces::checkAxes(), Mantid::Algorithms::WorkspaceJoiners::checkCompatibility(), Mantid::API::SpectraAxis::clone(), Mantid::Algorithms::CompareWorkspaces::compareEventWorkspaces(), Mantid::Algorithms::ConvertAxisByFormula::exec(), Mantid::Algorithms::DiffractionFocussing2::exec(), Mantid::Algorithms::MagFormFactorCorrection::exec(), Mantid::CurveFitting::Algorithms::PawleyFit::exec(), Mantid::DataHandling::LoadMcStasNexus::exec(), Mantid::MDAlgorithms::ConvertToDetectorFaceMD::exec(), export_Axis(), Mantid::CurveFitting::Functions::FunctionQDepends::extractQValues(), Mantid::Algorithms::GetQsInQENSData::extractQValues(), Mantid::API::MWDimension::getName(), Mantid::API::MWXDimension::getName(), Mantid::API::MWDimension::getUnits(), Mantid::API::MWXDimension::getUnits(), Mantid::MDAlgorithms::UnitsConversionHelper::initialize(), Mantid::MDAlgorithms::MDTransfNoQ::inputUnitID(), Mantid::MDAlgorithms::MDTransfNoQ::outputUnitID(), Mantid::DataHandling::LoadMcStas::readHistogramData(), Mantid::CurveFitting::Functions::PawleyFunction::setMatrixWorkspace(), setUnit(), Mantid::API::SpectraAxis::SpectraAxis(), Mantid::API::MatrixWorkspace::toString(), Mantid::NeXus::NexusFileIO::writeNexusProcessedData2D(), and Mantid::DataHandling::SaveSPE::writeSPEFile().

Member Data Documentation

◆ m_title

std::string Mantid::API::Axis::m_title
private

The user-defined title for this axis.

Definition at line 95 of file Axis.h.

Referenced by title().

◆ m_unit

std::shared_ptr<Kernel::Unit> Mantid::API::Axis::m_unit
private

The unit for this axis.

Definition at line 97 of file Axis.h.

Referenced by setUnit(), and unit().


The documentation for this class was generated from the following files: