9#include "MantidAPI/DllConfig.h"
11#include "MantidHistogramData/Histogram.h"
19namespace DataObjects {
45 void copyInfoFrom(
const ISpectrum &other);
72 virtual std::pair<double, double> getXDataRange()
const;
74 void addDetectorID(
const detid_t detID);
75 void addDetectorIDs(
const std::set<detid_t> &detIDs);
76 void addDetectorIDs(
const std::vector<detid_t> &detIDs);
77 void setDetectorID(
const detid_t detID);
78 void setDetectorIDs(
const std::set<detid_t> &detIDs);
79 void setDetectorIDs(std::set<detid_t> &&detIDs);
81 bool hasDetectorID(
const detid_t detID)
const;
82 const std::set<detid_t> &getDetectorIDs()
const;
84 void clearDetectorIDs();
95 virtual HistogramData::Histogram
histogram()
const {
return histogramRef(); }
98 HistogramData::Histogram hist(std::forward<T>(data)...);
101 checkAndSanitizeHistogram(hist);
102 mutableHistogramRef() = std::move(hist);
105 HistogramData::Histogram::YMode
yMode()
const {
return histogramRef().yMode(); }
106 void setYMode(HistogramData::Histogram::YMode ymode) { mutableHistogramRef().setYMode(ymode); }
108 checkIsYAndEWritable();
109 mutableHistogramRef().convertToCounts();
112 checkIsYAndEWritable();
113 mutableHistogramRef().convertToFrequencies();
116 HistogramData::BinEdges
binEdges()
const {
return histogramRef().binEdges(); }
117 HistogramData::Points
points()
const {
return histogramRef().points(); }
119 return histogramRef().pointStandardDeviations();
122 mutableHistogramRef().setBinEdges(std::forward<T>(data)...);
124 template <
typename... T>
void setPoints(T &&...data) & {
126 checkWorksWithPoints();
127 mutableHistogramRef().setPoints(std::forward<T>(data)...);
132 mutableHistogramRef().setPointVariances(std::forward<T>(data)...);
135 mutableHistogramRef().setPointStandardDeviations(std::forward<T>(data)...);
137 virtual HistogramData::Counts
counts()
const {
return histogramRef().counts(); }
138 virtual HistogramData::CountVariances
countVariances()
const {
return histogramRef().countVariances(); }
140 return histogramRef().countStandardDeviations();
142 virtual HistogramData::Frequencies
frequencies()
const {
return histogramRef().frequencies(); }
143 virtual HistogramData::FrequencyVariances
frequencyVariances()
const {
return histogramRef().frequencyVariances(); }
145 return histogramRef().frequencyStandardDeviations();
147 template <
typename... T>
void setCounts(T &&...data) & {
149 checkIsYAndEWritable();
150 mutableHistogramRef().setCounts(std::forward<T>(data)...);
153 checkIsYAndEWritable();
154 mutableHistogramRef().setCountVariances(std::forward<T>(data)...);
157 checkIsYAndEWritable();
158 mutableHistogramRef().setCountStandardDeviations(std::forward<T>(data)...);
161 checkIsYAndEWritable();
162 mutableHistogramRef().setFrequencies(std::forward<T>(data)...);
165 checkIsYAndEWritable();
166 mutableHistogramRef().setFrequencyVariances(std::forward<T>(data)...);
169 checkIsYAndEWritable();
170 mutableHistogramRef().setFrequencyStandardDeviations(std::forward<T>(data)...);
172 const HistogramData::HistogramX &
x()
const {
return histogramRef().x(); }
173 virtual const HistogramData::HistogramY &
y()
const {
return histogramRef().y(); }
174 virtual const HistogramData::HistogramE &
e()
const {
return histogramRef().e(); }
175 const HistogramData::HistogramDx &
dx()
const {
return histogramRef().dx(); }
176 HistogramData::HistogramX &
mutableX() & {
return mutableHistogramRef().mutableX(); }
177 HistogramData::HistogramDx &
mutableDx() & {
return mutableHistogramRef().mutableDx(); }
179 checkIsYAndEWritable();
180 return mutableHistogramRef().mutableY();
183 checkIsYAndEWritable();
184 return mutableHistogramRef().mutableE();
193 checkIsYAndEWritable();
194 mutableHistogramRef().setSharedY(
y);
197 checkIsYAndEWritable();
198 mutableHistogramRef().setSharedE(e);
223 void invalidateCachedSpectrumNumbers()
const;
224 void invalidateSpectrumDefinition()
const;
std::map< DeltaEMode::Type, std::string > index
A "spectrum" is an object that holds the data for a particular spectrum, in particular:
void setHistogram(T &&...data)
Sets the Histogram associated with this spectrum.
virtual HistogramData::FrequencyVariances frequencyVariances() const
void setFrequencyVariances(T &&...data) &
HistogramData::Histogram::YMode yMode() const
virtual HistogramData::FrequencyStandardDeviations frequencyStandardDeviations() const
HistogramData::HistogramY & mutableY() &
HistogramData::Points points() const
virtual const MantidVec & dataX() const =0
const HistogramData::HistogramX & x() const
virtual const HistogramData::HistogramE & e() const
void setSharedDx(const Kernel::cow_ptr< HistogramData::HistogramDx > &dx) &
virtual MantidVec & dataY()=0
virtual const MantidVec & readX() const =0
void setPointStandardDeviations(T &&...data) &
void setCountVariances(T &&...data) &
virtual MantidVec & dataE()=0
std::set< detid_t > detectorIDs
Set of the detector IDs associated with this spectrum.
void setSharedY(const Kernel::cow_ptr< HistogramData::HistogramY > &y) &
void setCountStandardDeviations(T &&...data) &
virtual const MantidVec & dataDx() const =0
virtual HistogramData::Frequencies frequencies() const
void setPointVariances(T &&...data) &
virtual void setX(const Kernel::cow_ptr< HistogramData::HistogramX > &X)=0
void setBinEdges(T &&...data) &
virtual HistogramData::Histogram & mutableHistogramRef()=0
virtual size_t getMemorySize() const =0
const HistogramData::HistogramDx & dx() const
HistogramData::HistogramDx & mutableDx() &
void convertToFrequencies()
virtual void checkWorksWithPoints() const
virtual const MantidVec & readDx() const =0
virtual ~ISpectrum()=default
virtual HistogramData::Histogram histogram() const
Returns the Histogram associated with this spectrum.
virtual HistogramData::Counts counts() const
void setYMode(HistogramData::Histogram::YMode ymode)
Kernel::cow_ptr< HistogramData::HistogramX > sharedX() const
void setFrequencies(T &&...data) &
virtual const HistogramData::HistogramY & y() const
virtual HistogramData::CountStandardDeviations countStandardDeviations() const
void setSharedE(const Kernel::cow_ptr< HistogramData::HistogramE > &e) &
HistogramData::BinEdges binEdges() const
void setCounts(T &&...data) &
virtual MantidVec & dataDx()=0
virtual void clearData()=0
virtual const HistogramData::Histogram & histogramRef() const =0
virtual Kernel::cow_ptr< HistogramData::HistogramY > sharedY() const
virtual Kernel::cow_ptr< HistogramData::HistogramE > sharedE() const
virtual void checkAndSanitizeHistogram(HistogramData::Histogram &)
virtual HistogramData::CountVariances countVariances() const
void setPoints(T &&...data) &
virtual const MantidVec & dataE() const =0
virtual Kernel::cow_ptr< HistogramData::HistogramX > ptrX() const =0
Kernel::cow_ptr< HistogramData::HistogramDx > sharedDx() const
virtual void copyDataFrom(const ISpectrum &source)=0
Copy data from another ISpectrum with double-dynamic dispatch.
void setSharedX(const Kernel::cow_ptr< HistogramData::HistogramX > &x) &
HistogramData::HistogramX & mutableX() &
HistogramData::HistogramE & mutableE() &
void setFrequencyStandardDeviations(T &&...data) &
virtual MantidVec & dataX()=0
virtual void checkIsYAndEWritable() const
virtual const MantidVec & dataY() const =0
HistogramData::PointStandardDeviations pointStandardDeviations() const
Base MatrixWorkspace Abstract Class.
1D histogram implementation.
Implements a copy on write data template.
Helper class that implements ISpectrum.
Helper class which provides the Collimation Length for SANS instruments.
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
int32_t specnum_t
Typedef for a spectrum Number.