15 if (ymode == HistogramData::Histogram::YMode::Counts) {
18 }
else if (ymode == HistogramData::Histogram::YMode::Frequencies) {
22 throw std::logic_error(
"Histogram1D: YMode must be Counts or Frequencies");
44 std::fill(yValues.begin(), yValues.end(), 0.0);
46 std::fill(eValues.begin(), eValues.end(), 0.0);
79 throw std::invalid_argument(
"Histogram1D: invalid input: Y data set to nullptr");
82 throw std::invalid_argument(
"Histogram1D: invalid input: E data set to nullptr");
const std::vector< double > & rhs
A "spectrum" is an object that holds the data for a particular spectrum, in particular:
virtual HistogramData::Histogram histogram() const
Returns the Histogram associated with this spectrum.
virtual void copyDataInto(DataObjects::EventList &) const
Override in child classes for polymorphic copying of data.
ISpectrum & operator=(const ISpectrum &other)
Copy assignment.
1D histogram implementation.
void checkAndSanitizeHistogram(HistogramData::Histogram &histogram) override
Makes sure a histogram has valid Y and E data.
Kernel::cow_ptr< HistogramData::HistogramX > ptrX() const override
Deprecated, use sharedX() instead. Returns a pointer to the x data.
const MantidVec & readDx() const override
Deprecated, use dx() instead.
HistogramData::Histogram m_histogram
Histogram object holding the histogram data.
const MantidVec & dataE() const override
Deprecated, use e() instead. Returns the error data const.
const MantidVec & dataY() const override
Deprecated, use y() instead. Returns the y data const.
void copyDataInto(Histogram1D &sink) const override
Used by copyDataFrom for dynamic dispatch for its source.
void setX(const Kernel::cow_ptr< HistogramData::HistogramX > &X) override
Deprecated, use setSharedX() instead.
MantidVec & dataX() override
Deprecated, use mutableX() instead. Returns the x data.
const MantidVec & readX() const override
Deprecated, use x() instead. Returns the x data const.
Histogram1D & operator=(const Histogram1D &)=default
MantidVec & dataDx() override
Deprecated, use mutableDx() instead.
void clearData() override
Zero the data (Y&E) in this spectrum.
Histogram1D(HistogramData::Histogram::XMode xmode, HistogramData::Histogram::YMode ymode)
Construct empty.
void copyDataFrom(const ISpectrum &source) override
Copy data from a Histogram1D or EventList, via ISpectrum reference.
Implements a copy on write data template.
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces