26 :
Axis(), m_parentWS(parentWorkspace), m_edges() {
27 this->
unit() = std::make_shared<Kernel::Units::Label>(
"Spectrum",
"");
37 newAxis->title() = this->
title();
38 newAxis->unit() = this->
unit();
51 return clone(parentWorkspace);
80 throw std::domain_error(
"setValue method cannot be used on a SpectraAxis.");
93 const size_t npts =
m_edges.size() - 1;
94 for (
size_t i = 0; i < npts - 1; ++i) {
125 throw std::runtime_error(
"getSpectraIndexMap(), zero elements");
127 for (
size_t i = 0; i < nel; ++i) {
141 const auto *spec2 =
dynamic_cast<const SpectraAxis *
>(&axis2);
145 for (
size_t i = 0; i <
length(); ++i) {
double value
The value of the point.
std::map< DeltaEMode::Type, std::string > index
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Class to represent the axis of a workspace.
const std::string & title() const
Returns the user-defined title for this axis.
virtual specnum_t spectraNo(const std::size_t &index) const
Get the spectrum number.
virtual std::size_t length() const =0
Get the length of the axis.
const std::shared_ptr< Kernel::Unit > & unit() const
The unit for this axis.
double getValue(const std::size_t &index, const std::size_t &verticalIndex=0) const
Gets the value at the specified index.
specnum_t getSpectrumNo() const
Base MatrixWorkspace Abstract Class.
virtual ISpectrum & getSpectrum(const size_t index)=0
Return the underlying ISpectrum ptr at the given workspace index.
virtual std::size_t getNumberHistograms() const =0
Returns the number of histograms in the workspace.
Class to represent the spectra axis of a workspace.
size_t indexOfValue(const double value) const override
Finds the index of the given value on the axis.
spec2index_map getSpectraIndexMap() const
Returns a map where spectra is the key and index is the value This is used for efficient search of sp...
specnum_t spectraNo(const std::size_t &index) const override
Returns the spectrum number at the position given (Spectra axis only)
double operator()(const std::size_t &index, const std::size_t &verticalIndex=0) const override
Get the axis value at the position given.
double getMin() const override
returns min value defined on axis
std::string label(const std::size_t &index) const override
Returns a text label which shows the value at index and identifies the type of the axis.
Axis * clone(const MatrixWorkspace *const parentWorkspace) override
Virtual constructor.
std::vector< double > m_edges
List of edge values for quick searching of values as if this is binned data.
double getMax() const override
returns max value defined on axis
const MatrixWorkspace *const m_parentWS
A pointer to the workspace holding the axis.
SpectraAxis()
Default constructor.
void setValue(const std::size_t &index, const double &value) override
Sets the axis value at a given position.
bool operator==(const Axis &) const override
Check if two axis defined as spectra or numeric axis are equivalent.
std::size_t length() const override
Get the length of the axis.
Exception for index errors.
size_t MANTID_KERNEL_DLL indexOfValueFromEdges(const std::vector< double > &bin_edges, const double value)
Gets the bin of a value from a vector of bin edges.
std::unordered_map< specnum_t, size_t > spec2index_map
Map with key = spectrum number, value = workspace index.
int32_t specnum_t
Typedef for a spectrum Number.
std::string to_string(const wide_integer< Bits, Signed > &n)