Mantid
Loading...
Searching...
No Matches
MatrixWorkspace.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidAPI/DllConfig.h"
12#include "MantidAPI/ISpectrum.h"
15
16#include <atomic>
17#include <mutex>
18
19namespace Mantid {
20
21namespace Indexing {
22class IndexInfo;
23}
24
25namespace Types {
26namespace Core {
27class DateAndTime;
28}
29} // namespace Types
30
31namespace Geometry {
32class ParameterMap;
33}
34
35namespace API {
36class Axis;
37class SpectrumDetectorMapping;
38
40using MantidImage = std::vector<std::vector<double>>;
42using MantidImage_sptr = std::shared_ptr<MantidImage>;
44using MantidImage_const_sptr = std::shared_ptr<const MantidImage>;
45
46//----------------------------------------------------------------------
52class MANTID_API_DLL MatrixWorkspace : public IMDWorkspace, public ExperimentInfo {
53
54private:
55 using ExperimentInfo::toString;
56
57public:
58 // The Workspace Factory create-from-parent method needs direct access to the
59 // axes.
61
62 void initialize(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength);
63 void initialize(const std::size_t &NVectors, const HistogramData::Histogram &histogram);
64 void initialize(const Indexing::IndexInfo &indexInfo, const HistogramData::Histogram &histogram);
65
66 MatrixWorkspace &operator=(const MatrixWorkspace &other) = delete;
68 ~MatrixWorkspace() override;
69
71 MatrixWorkspace_uptr clone() const { return MatrixWorkspace_uptr(doClone()); }
72
74 MatrixWorkspace_uptr cloneEmpty() const { return MatrixWorkspace_uptr(doCloneEmpty()); }
75
76 const Indexing::IndexInfo &indexInfo() const;
77 void setIndexInfo(const Indexing::IndexInfo &indexInfo);
78
79 using IMDWorkspace::toString;
81 const std::string toString() const override;
82
85 std::shared_ptr<const Geometry::IDetector> getDetector(const size_t workspaceIndex) const;
86 double detectorTwoTheta(const Geometry::IDetector &det) const;
87 double detectorSignedTwoTheta(const Geometry::IDetector &det) const;
88
90
91 virtual void updateSpectraUsing(const SpectrumDetectorMapping &map);
94 void rebuildSpectraMapping(const bool includeMonitors = true, const specnum_t specNumOffset = 1);
95
96 // More mapping
97 spec2index_map getSpectrumToWorkspaceIndexMap() const;
98 detid2index_map getDetectorIDToWorkspaceIndexMap(bool throwIfMultipleDets = false,
99 bool ignoreIfNoValidDets = false) const;
100 virtual std::vector<size_t> getDetectorIDToWorkspaceIndexVector(detid_t &offset,
101 bool throwIfMultipleDets = false) const;
102
103 virtual std::vector<size_t> getSpectrumToWorkspaceIndexVector(specnum_t &offset) const;
104 std::vector<size_t> getIndicesFromSpectra(const std::vector<specnum_t> &spectraList) const;
105 size_t getIndexFromSpectrumNumber(const specnum_t specNo) const;
106 std::vector<size_t> getIndicesFromDetectorIDs(const std::vector<detid_t> &detIdList) const;
107 std::vector<specnum_t> getSpectraFromDetectorIDs(const std::vector<detid_t> &detIdList) const;
108
109 bool hasGroupedDetectors() const;
110
112 virtual bool isRaggedWorkspace() const = 0;
113
115 size_t getMemorySize() const override;
116 virtual size_t getMemorySizeForXAxes() const;
117
118 // Section required for iteration
120 virtual std::size_t size() const = 0;
124 virtual std::size_t blocksize() const = 0;
126 virtual std::size_t getNumberBins(const std::size_t &index) const = 0;
128 virtual std::size_t getMaxNumberBins() const = 0;
130 virtual std::size_t getNumberHistograms() const = 0;
131
133 void setTitle(const std::string &) override;
135 const std::string getTitle() const override;
136
137 virtual Types::Core::DateAndTime getFirstPulseTime() const;
138 Types::Core::DateAndTime getLastPulseTime() const;
139
141 std::size_t yIndexOfX(const double xValue, const std::size_t &index = 0,
142 [[maybe_unused]] const double tolerance = 0.0) const;
143
144 //----------------------------------------------------------------------
145 // DATA ACCESSORS
146 //----------------------------------------------------------------------
147
149 virtual ISpectrum &getSpectrum(const size_t index) = 0;
152 virtual const ISpectrum &getSpectrum(const size_t index) const = 0;
153
155 HistogramData::Histogram histogram(const size_t index) const { return getSpectrum(index).histogram(); }
156 template <typename... T> void setHistogram(const size_t index, T &&...data) & {
157 getSpectrum(index).setHistogram(std::forward<T>(data)...);
158 }
159 void convertToCounts(const size_t index) { getSpectrumWithoutInvalidation(index).convertToCounts(); }
160 void convertToFrequencies(const size_t index) { getSpectrumWithoutInvalidation(index).convertToFrequencies(); }
161 HistogramData::BinEdges binEdges(const size_t index) const { return getSpectrum(index).binEdges(); }
162 HistogramData::Points points(const size_t index) const { return getSpectrum(index).points(); }
163 HistogramData::PointStandardDeviations pointStandardDeviations(const size_t index) const {
164 return getSpectrum(index).pointStandardDeviations();
165 }
166 template <typename... T> void setBinEdges(const size_t index, T &&...data) & {
167 getSpectrum(index).setBinEdges(std::forward<T>(data)...);
168 }
169 template <typename... T> void setPoints(const size_t index, T &&...data) & {
170 getSpectrum(index).setPoints(std::forward<T>(data)...);
171 }
172 template <typename... T> void setPointVariances(const size_t index, T &&...data) & {
173 getSpectrumWithoutInvalidation(index).setPointVariances(std::forward<T>(data)...);
174 }
175 template <typename... T> void setPointStandardDeviations(const size_t index, T &&...data) & {
176 getSpectrumWithoutInvalidation(index).setPointStandardDeviations(std::forward<T>(data)...);
177 }
178 HistogramData::Counts counts(const size_t index) const { return getSpectrum(index).counts(); }
179 HistogramData::CountVariances countVariances(const size_t index) const { return getSpectrum(index).countVariances(); }
180 HistogramData::CountStandardDeviations countStandardDeviations(const size_t index) const {
181 return getSpectrum(index).countStandardDeviations();
182 }
183 HistogramData::Frequencies frequencies(const size_t index) const { return getSpectrum(index).frequencies(); }
184 HistogramData::FrequencyVariances frequencyVariances(const size_t index) const {
185 return getSpectrum(index).frequencyVariances();
186 }
187 HistogramData::FrequencyStandardDeviations frequencyStandardDeviations(const size_t index) const {
188 return getSpectrum(index).frequencyStandardDeviations();
189 }
190 template <typename... T> void setCounts(const size_t index, T &&...data) & {
191 getSpectrumWithoutInvalidation(index).setCounts(std::forward<T>(data)...);
192 }
193 template <typename... T> void setCountVariances(const size_t index, T &&...data) & {
194 getSpectrumWithoutInvalidation(index).setCountVariances(std::forward<T>(data)...);
195 }
196 template <typename... T> void setCountStandardDeviations(const size_t index, T &&...data) & {
197 getSpectrumWithoutInvalidation(index).setCountStandardDeviations(std::forward<T>(data)...);
198 }
199 template <typename... T> void setFrequencies(const size_t index, T &&...data) & {
200 getSpectrumWithoutInvalidation(index).setFrequencies(std::forward<T>(data)...);
201 }
202 template <typename... T> void setFrequencyVariances(const size_t index, T &&...data) & {
203 getSpectrumWithoutInvalidation(index).setFrequencyVariances(std::forward<T>(data)...);
204 }
205 template <typename... T> void setFrequencyStandardDeviations(const size_t index, T &&...data) & {
206 getSpectrumWithoutInvalidation(index).setFrequencyStandardDeviations(std::forward<T>(data)...);
207 }
208 const HistogramData::HistogramX &x(const size_t index) const { return getSpectrum(index).x(); }
209 const HistogramData::HistogramY &y(const size_t index) const { return getSpectrum(index).y(); }
210 const HistogramData::HistogramE &e(const size_t index) const { return getSpectrum(index).e(); }
211 const HistogramData::HistogramDx &dx(const size_t index) const { return getSpectrum(index).dx(); }
212 HistogramData::HistogramX &mutableX(const size_t index) & { return getSpectrum(index).mutableX(); }
213 HistogramData::HistogramDx &mutableDx(const size_t index) & {
214 return getSpectrumWithoutInvalidation(index).mutableDx();
215 }
216 HistogramData::HistogramY &mutableY(const size_t index) & { return getSpectrumWithoutInvalidation(index).mutableY(); }
217 HistogramData::HistogramE &mutableE(const size_t index) & { return getSpectrumWithoutInvalidation(index).mutableE(); }
218 Kernel::cow_ptr<HistogramData::HistogramX> sharedX(const size_t index) const { return getSpectrum(index).sharedX(); }
219 Kernel::cow_ptr<HistogramData::HistogramY> sharedY(const size_t index) const { return getSpectrum(index).sharedY(); }
220 Kernel::cow_ptr<HistogramData::HistogramE> sharedE(const size_t index) const { return getSpectrum(index).sharedE(); }
222 return getSpectrum(index).sharedDx();
223 }
225 getSpectrum(index).setSharedX(x);
226 }
228 getSpectrumWithoutInvalidation(index).setSharedDx(dx);
229 }
231 getSpectrumWithoutInvalidation(index).setSharedY(y);
232 }
234 getSpectrumWithoutInvalidation(index).setSharedE(e);
235 }
236 // Methods for getting read-only access to the data.
237 // Just passes through to the virtual dataX/Y/E function (const version)
241 const MantidVec &readX(std::size_t const index) const { return getSpectrum(index).dataX(); }
245 const MantidVec &readY(std::size_t const index) const { return getSpectrum(index).dataY(); }
249 const MantidVec &readE(std::size_t const index) const { return getSpectrum(index).dataE(); }
253 const MantidVec &readDx(size_t const index) const { return getSpectrum(index).dataDx(); }
254
256 virtual MantidVec &dataX(const std::size_t index) { return getSpectrum(index).dataX(); }
258 virtual MantidVec &dataY(const std::size_t index) { return getSpectrumWithoutInvalidation(index).dataY(); }
260 virtual MantidVec &dataE(const std::size_t index) { return getSpectrumWithoutInvalidation(index).dataE(); }
262 virtual MantidVec &dataDx(const std::size_t index) { return getSpectrumWithoutInvalidation(index).dataDx(); }
263
265 virtual const MantidVec &dataX(const std::size_t index) const { return getSpectrum(index).dataX(); }
267 virtual const MantidVec &dataY(const std::size_t index) const { return getSpectrum(index).dataY(); }
269 virtual const MantidVec &dataE(const std::size_t index) const { return getSpectrum(index).dataE(); }
271 virtual const MantidVec &dataDx(const std::size_t index) const { return getSpectrum(index).dataDx(); }
272
273 virtual double getXMin() const;
274 virtual double getXMax() const;
275 virtual void getXMinMax(double &xmin, double &xmax) const;
276
278 virtual Kernel::cow_ptr<HistogramData::HistogramX> refX(const std::size_t index) const {
279 return getSpectrum(index).ptrX();
280 }
281
284 virtual void setX(const std::size_t index, const Kernel::cow_ptr<HistogramData::HistogramX> &X) {
285 getSpectrum(index).setX(X);
286 }
287
290 virtual void setX(const std::size_t index, const std::shared_ptr<HistogramData::HistogramX> &X) {
291 getSpectrum(index).setX(X);
292 }
293
298 virtual bool hasDx(const std::size_t index) const { return getSpectrum(index).hasDx(); }
299
301 virtual void generateHistogram(const std::size_t index, const MantidVec &X, MantidVec &Y, MantidVec &E,
302 bool skipError = false) const = 0;
303
306 virtual void getIntegratedSpectra(std::vector<double> &out, const double minX, const double maxX,
307 const bool entireRange) const;
308
310 std::pair<size_t, double> getXIndex(size_t i, double x, bool isLeft = true, size_t start = 0) const;
311
312 //----------------------------------------------------------------------
313
314 int axes() const;
315 virtual Axis *getAxis(const std::size_t &axisIndex) const;
316 void replaceAxis(const std::size_t &axisIndex, std::unique_ptr<Axis> newAxis);
317
320 size_t numberOfAxis() const;
321
323 virtual bool isCommonLogBins() const;
324
327 virtual bool isHistogramData() const;
328
330 virtual bool isCommonBins() const;
331
333 virtual bool isIntegerBins() const;
334
335 std::string YUnit() const;
336 void setYUnit(const std::string &newUnit);
337 std::string YUnitLabel(bool useLatex = false, bool plotAsDistribution = false) const;
338 void setYUnitLabel(const std::string &newLabel);
339
341 bool isDistribution() const;
342 void setDistribution(bool newValue);
343
344 // Methods to set and access masked bins
345 void maskBin(const size_t &workspaceIndex, const size_t &binIndex, const double &weight = 1.0);
346 void flagMasked(const size_t &index, const size_t &binIndex, const double &weight = 1.0);
347 bool hasMaskedBins(const size_t &workspaceIndex) const;
348 bool hasAnyMaskedBins() const;
351 using MaskList = std::map<size_t, double>;
352 const MaskList &maskedBins(const size_t &workspaceIndex) const;
353 std::vector<size_t> maskedBinsIndices(const size_t &workspaceIndex) const;
354 void setMaskedBins(const size_t workspaceIndex, const MaskList &maskedBins);
355 void setUnmaskedBins(const size_t workspaceIndex);
356
357 // Methods handling the internal monitor workspace
358 virtual void setMonitorWorkspace(const std::shared_ptr<MatrixWorkspace> &monitorWS);
359 std::shared_ptr<MatrixWorkspace> monitorWorkspace() const;
360
361 void loadInstrumentNexus(::NeXus::File *file);
362
363 //=====================================================================================
364 // MD Geometry methods
365 //=====================================================================================
366 size_t getNumDims() const override;
367 std::shared_ptr<const Mantid::Geometry::IMDDimension> getDimension(size_t index) const override;
368 std::shared_ptr<const Mantid::Geometry::IMDDimension> getDimensionWithId(std::string id) const override;
369 //=====================================================================================
370 // End MD Geometry methods
371 //=====================================================================================
372
373 //=====================================================================================
374 // IMDWorkspace methods
375 //=====================================================================================
376
378 uint64_t getNPoints() const override;
380 uint64_t getNEvents() const override { return this->getNPoints(); }
382 static const std::string xDimensionId;
384 static const std::string yDimensionId;
386 LinePlot getLinePlot(const Mantid::Kernel::VMD &start, const Mantid::Kernel::VMD &end,
387 Mantid::API::MDNormalization normalize) const override;
389 signal_t getSignalAtCoord(const coord_t *coords, const Mantid::API::MDNormalization &normalization) const override;
391 signal_t getSignalWithMaskAtCoord(const coord_t *coords,
392 const Mantid::API::MDNormalization &normalization) const override;
395 std::vector<std::unique_ptr<IMDIterator>>
396 createIterators(size_t suggestedNumCores = 1,
397 Mantid::Geometry::MDImplicitFunction *function = nullptr) const override;
398
400 void setMDMasking(std::unique_ptr<Mantid::Geometry::MDImplicitFunction> maskingRegion) override;
402 void clearMDMasking() override;
403
405 Mantid::Kernel::SpecialCoordinateSystem getSpecialCoordinateSystem() const override;
406
407 // Check if this class has an oriented lattice on a sample object
408 virtual bool hasOrientedLattice() const override;
409
414 virtual std::pair<int64_t, int64_t> findY(double value, const std::pair<int64_t, int64_t> &idx = {0, 0}) const;
415
416 //=====================================================================================
417 // End IMDWorkspace methods
418 //=====================================================================================
419
420 //=====================================================================================
421 // Image methods
422 //=====================================================================================
423
425 std::pair<size_t, size_t> getImageStartEndXIndices(size_t i, double startX, double endX) const;
427 MantidImage_sptr getImageY(size_t start = 0, size_t stop = 0, size_t width = 0, double startX = EMPTY_DBL(),
428 double endX = EMPTY_DBL()) const;
430 MantidImage_sptr getImageE(size_t start = 0, size_t stop = 0, size_t width = 0, double startX = EMPTY_DBL(),
431 double endX = EMPTY_DBL()) const;
433 virtual void setImageY(const MantidImage &image, size_t start = 0, bool parallelExecution = true);
435 virtual void setImageE(const MantidImage &image, size_t start = 0, bool parallelExecution = true);
436
437 //=====================================================================================
438 // End image methods
439 //=====================================================================================
440
441 void invalidateCachedSpectrumNumbers();
442
445 void invalidateCommonBinsFlag() { m_isCommonBinsFlagValid.store(false); }
446
447protected:
449 MatrixWorkspace(const MatrixWorkspace &other);
450
451 MatrixWorkspace(const Parallel::StorageMode storageMode = Parallel::StorageMode::Cloned);
452
455 virtual void init(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength) = 0;
456 virtual void init(const HistogramData::Histogram &histogram) = 0;
457
459
460 void updateCachedDetectorGrouping(const size_t index) const override;
461
463 std::vector<std::unique_ptr<Axis>> m_axes;
464
465private:
466 std::size_t binIndexOfValue(Mantid::HistogramData::HistogramX const &xValues, const double xValue,
467 const bool ascendingOrder) const;
468 std::size_t xIndexOfValue(const Mantid::HistogramData::HistogramX &xValues, const double xValue,
469 const double tolerance) const;
470
471 MatrixWorkspace *doClone() const override = 0;
472 MatrixWorkspace *doCloneEmpty() const override = 0;
473
475 MantidImage_sptr getImage(const MantidVec &(MatrixWorkspace::*read)(std::size_t const) const, size_t start,
476 size_t stop, size_t width, size_t indexStart, size_t indexEnd) const;
478 void setImage(MantidVec &(MatrixWorkspace::*dataVec)(const std::size_t), const MantidImage &image, size_t start,
479 [[maybe_unused]] bool parallelExecution);
480
481 void setIndexInfoWithoutISpectrumUpdate(const Indexing::IndexInfo &indexInfo);
482 void buildDefaultSpectrumDefinitions();
483 void rebuildDetectorIDGroupings();
484
485 virtual bool isHistogramDataByIndex(std::size_t index = 0) const;
486
487 std::unique_ptr<Indexing::IndexInfo> m_indexInfo;
488
490 bool m_isInitialized{false};
491
493 std::string m_YUnit;
495 std::string m_YUnitLabel;
496
498 mutable std::atomic<bool> m_isCommonBinsFlagValid{false};
500 mutable bool m_isCommonBinsFlag{false};
502 mutable std::mutex m_isCommonBinsMutex;
503
505 std::map<int64_t, MaskList> m_masks;
506
509 std::shared_ptr<MatrixWorkspace> m_monitorWorkspace;
510
511 mutable std::atomic<bool> m_indexInfoNeedsUpdate{true};
512 mutable std::mutex m_indexInfoMutex;
513
514protected:
516 std::string getDimensionIdFromAxis(const int &axisIndex) const;
517};
518
520using MatrixWorkspace_sptr = std::shared_ptr<MatrixWorkspace>;
522using MatrixWorkspace_const_sptr = std::shared_ptr<const MatrixWorkspace>;
523
524} // namespace API
525} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
double tolerance
Class to represent the axis of a workspace.
Definition: Axis.h:30
This class is shared by a few Workspace types and holds information related to a particular experimen...
Basic MD Workspace Abstract Class.
Definition: IMDWorkspace.h:40
A "spectrum" is an object that holds the data for a particular spectrum, in particular:
Definition: ISpectrum.h:39
Base MatrixWorkspace Abstract Class.
HistogramData::CountVariances countVariances(const size_t index) const
void convertToFrequencies(const size_t index)
uint64_t getNEvents() const override
Get the number of points available on the workspace.
MatrixWorkspace_uptr clone() const
Returns a clone of the workspace.
void setFrequencyStandardDeviations(const size_t index, T &&...data) &
MatrixWorkspace & operator=(const MatrixWorkspace &other)=delete
const MantidVec & readE(std::size_t const index) const
Deprecated, use e() instead.
void setSharedDx(const size_t index, const Kernel::cow_ptr< HistogramData::HistogramDx > &dx) &
virtual ISpectrum & getSpectrum(const size_t index)=0
Return the underlying ISpectrum ptr at the given workspace index.
std::vector< std::unique_ptr< Axis > > m_axes
A vector of pointers to the axes for this workspace.
const HistogramData::HistogramE & e(const size_t index) const
virtual const MantidVec & dataX(const std::size_t index) const
Deprecated, use x() instead. Returns the x data const.
void setSharedX(const size_t index, const Kernel::cow_ptr< HistogramData::HistogramX > &x) &
HistogramData::CountStandardDeviations countStandardDeviations(const size_t index) const
const MantidVec & readDx(size_t const index) const
Deprecated, use dx() instead.
virtual MantidVec & dataDx(const std::size_t index)
Deprecated, use mutableDx() instead. Returns the x error data.
HistogramData::BinEdges binEdges(const size_t index) const
std::unique_ptr< Indexing::IndexInfo > m_indexInfo
void setPoints(const size_t index, T &&...data) &
static const std::string xDimensionId
Dimension id for x-dimension.
HistogramData::Points points(const size_t index) const
virtual const MantidVec & dataY(const std::size_t index) const
Deprecated, use y() instead. Returns the y data const.
HistogramData::HistogramX & mutableX(const size_t index) &
std::string m_YUnit
The unit for the data values (e.g. Counts)
const HistogramData::HistogramDx & dx(const size_t index) const
virtual std::size_t blocksize() const =0
Returns the size of each block of data returned by the dataY accessors.
MatrixWorkspace_uptr cloneEmpty() const
Returns a default-initialized clone of the workspace.
virtual const ISpectrum & getSpectrum(const size_t index) const =0
Return the underlying ISpectrum ptr (const version) at the given workspace index.
std::shared_ptr< MatrixWorkspace > m_monitorWorkspace
A workspace holding monitor data relating to the main data in the containing workspace (null if none)...
virtual MantidVec & dataX(const std::size_t index)
Deprecated, use mutableX() instead. Returns the x data.
virtual std::size_t getNumberHistograms() const =0
Returns the number of histograms in the workspace.
void setCounts(const size_t index, T &&...data) &
HistogramData::FrequencyStandardDeviations frequencyStandardDeviations(const size_t index) const
virtual const MantidVec & dataDx(const std::size_t index) const
Deprecated, use dx() instead. Returns the error const.
void setHistogram(const size_t index, T &&...data) &
void setSharedE(const size_t index, const Kernel::cow_ptr< HistogramData::HistogramE > &e) &
Kernel::cow_ptr< HistogramData::HistogramY > sharedY(const size_t index) const
std::map< size_t, double > MaskList
Masked bins for each spectrum are stored as a set of pairs containing <bin index, weight>
std::mutex m_isCommonBinsMutex
A mutex protecting the update of m_isCommonBinsFlag.
MatrixWorkspace * doCloneEmpty() const override=0
Virtual cloneEmpty method.
const HistogramData::HistogramX & x(const size_t index) const
void setSharedY(const size_t index, const Kernel::cow_ptr< HistogramData::HistogramY > &y) &
~MatrixWorkspace() override
Delete.
std::map< int64_t, MaskList > m_masks
The set of masked bins in a map keyed on workspace index.
virtual MantidVec & dataE(const std::size_t index)
Deprecated, use mutableE() instead. Returns the error data.
virtual Kernel::cow_ptr< HistogramData::HistogramX > refX(const std::size_t index) const
Deprecated, use sharedX() instead. Returns a pointer to the x data.
void setFrequencyVariances(const size_t index, T &&...data) &
Kernel::cow_ptr< HistogramData::HistogramX > sharedX(const size_t index) const
HistogramData::Counts counts(const size_t index) const
void loadInstrumentNexus(::NeXus::File *file)
virtual bool isRaggedWorkspace() const =0
Returns true if the workspace is ragged (has differently sized spectra).
void invalidateCommonBinsFlag()
Invalidates the commons bins flag.
void convertToCounts(const size_t index)
HistogramData::Histogram histogram(const size_t index) const
Returns the Histogram at the given workspace index.
void setPointVariances(const size_t index, T &&...data) &
Kernel::cow_ptr< HistogramData::HistogramDx > sharedDx(const size_t index) const
void setCountStandardDeviations(const size_t index, T &&...data) &
virtual bool hasDx(const std::size_t index) const
Probes if DX (X Error) values were set on a particular spectrum.
virtual std::size_t getMaxNumberBins() const =0
Returns the maximum number of bins in a workspace (works on ragged data).
const MantidVec & readY(std::size_t const index) const
Deprecated, use y() instead.
HistogramData::PointStandardDeviations pointStandardDeviations(const size_t index) const
HistogramData::FrequencyVariances frequencyVariances(const size_t index) const
virtual std::size_t getNumberBins(const std::size_t &index) const =0
Returns the number of bins for a given histogram index.
HistogramData::HistogramE & mutableE(const size_t index) &
static const std::string yDimensionId
Dimensin id for y-dimension.
virtual void setX(const std::size_t index, const std::shared_ptr< HistogramData::HistogramX > &X)
Deprecated, use setSharedX() instead.
HistogramData::Frequencies frequencies(const size_t index) const
void setPointStandardDeviations(const size_t index, T &&...data) &
Kernel::cow_ptr< HistogramData::HistogramE > sharedE(const size_t index) const
HistogramData::HistogramDx & mutableDx(const size_t index) &
const MantidVec & readX(std::size_t const index) const
Deprecated, use x() instead.
virtual void generateHistogram(const std::size_t index, const MantidVec &X, MantidVec &Y, MantidVec &E, bool skipError=false) const =0
Generate the histogram or rebin the existing histogram.
virtual std::size_t size() const =0
Returns the number of single indexable items in the workspace.
virtual void init(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength)=0
Initialises the workspace.
MatrixWorkspace * doClone() const override=0
Virtual clone method. Not implemented to force implementation in children.
virtual MantidVec & dataY(const std::size_t index)
Deprecated, use mutableY() instead. Returns the y data.
HistogramData::HistogramY & mutableY(const size_t index) &
virtual ISpectrum & getSpectrumWithoutInvalidation(const size_t index)=0
void setFrequencies(const size_t index, T &&...data) &
virtual const MantidVec & dataE(const std::size_t index) const
Deprecated, use e() instead. Returns the error const.
virtual void init(const HistogramData::Histogram &histogram)=0
const HistogramData::HistogramY & y(const size_t index) const
std::string m_YUnitLabel
A text label for use when plotting spectra.
void setBinEdges(const size_t index, T &&...data) &
void setCountVariances(const size_t index, T &&...data) &
virtual void setX(const std::size_t index, const Kernel::cow_ptr< HistogramData::HistogramX > &X)
Deprecated, use setSharedX() instead.
A minimal class to hold the mapping between the spectrum number and its related detector ID numbers f...
The WorkspaceFactory class is in charge of the creation of all types of workspaces.
Interface class for detector objects.
Definition: IDetector.h:43
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
Implements a copy on write data template.
Definition: cow_ptr.h:41
Axis
Axis choice.
Definition: GraphOptions.h:23
std::shared_ptr< const MantidImage > MantidImage_const_sptr
shared pointer to const MantidImage
std::unique_ptr< MatrixWorkspace > MatrixWorkspace_uptr
unique pointer to Mantid::API::MatrixWorkspace
std::vector< std::vector< double > > MantidImage
typedef for the image type
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
MDNormalization
Enum describing different ways to normalize the signal in a MDWorkspace.
Definition: IMDIterator.h:25
std::shared_ptr< MantidImage > MantidImage_sptr
shared pointer to MantidImage
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
SpecialCoordinateSystem
Special coordinate systems for Q3D.
Helper class which provides the Collimation Length for SANS instruments.
std::unordered_map< specnum_t, size_t > spec2index_map
Map with key = spectrum number, value = workspace index.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Definition: MDTypes.h:27
std::unordered_map< detid_t, size_t > detid2index_map
Map with key = detector ID, value = workspace index.
double signal_t
Typedef for the signal recorded in a MDBox, etc.
Definition: MDTypes.h:36
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
Definition: cow_ptr.h:172
int32_t specnum_t
Typedef for a spectrum Number.
Definition: IDTypes.h:16
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
Definition: EmptyValues.h:43
Holds X, Y, E for a line plot.
Definition: IMDWorkspace.h:48