24 m_convention(Kernel::
ConfigService::Instance().getString(
"Q.convention")) {}
35 std::vector<std::unique_ptr<IMDIterator>> iterators = this->
createIterators(1, function);
36 if (iterators.empty())
37 throw std::runtime_error(
"IMDWorkspace::createIterator(): iterator "
38 "creation was not successful. No iterators "
41 return std::move(iterators[0]);
93 std::ostringstream os;
98 os <<
"Dim " << i <<
": (" << dim->getName() <<
") " << dim->getMinimum() <<
" to " << dim->getMaximum() <<
" in "
99 << dim->getNBins() <<
" bins";
101 if (dim->getDimensionId() != dim->getName())
102 os <<
". Id=" << dim->getDimensionId();
110 os <<
"Crystallography: kf-ki";
112 os <<
"Inelastic: ki-kf";
127 std::vector<signal_t> &e)
const {
129 y.emplace_back(std::numeric_limits<signal_t>::quiet_NaN());
130 e.emplace_back(std::numeric_limits<signal_t>::quiet_NaN());
150 size_t numPoints = 200;
152 VMD step = (end - start) /
double(numPoints);
153 double stepLength = step.
norm();
157 for (
size_t i = 0; i < numPoints; i++) {
159 VMD coord = start + step * double(i);
161 line.
x.emplace_back(
static_cast<coord_t>(stepLength *
double(i)));
164 line.
y.emplace_back(yVal);
165 line.
e.emplace_back(0.0);
168 line.
x.emplace_back((end - start).norm());
190IPropertyManager::getValue<Mantid::API::IMDWorkspace_sptr>(
const std::string &name)
const {
195 std::string message =
196 "Attempt to assign property " + name +
" to incorrect type. Expected shared_ptr<IMDWorkspace>.";
197 throw std::runtime_error(message);
205IPropertyManager::getValue<Mantid::API::IMDWorkspace_const_sptr>(
const std::string &name)
const {
208 return prop->operator()();
210 std::string message =
211 "Attempt to assign property " + name +
" to incorrect type. Expected const shared_ptr<IMDWorkspace>.";
212 throw std::runtime_error(message);
signal_t getSignalWithMaskAtVMD(const Mantid::Kernel::VMD &coords, const Mantid::API::MDNormalization &normalization=Mantid::API::VolumeNormalization) const
Returns the signal (normalized by volume) at a given coordinates or 0 if masked.
virtual signal_t getSignalAtCoord(const coord_t *coords, const Mantid::API::MDNormalization &normalization) const =0
Returns the (normalized) signal at a given coordinates.
std::string changeQConvention()
IMDWorkspace(const Parallel::StorageMode storageMode=Parallel::StorageMode::Cloned)
Default constructor.
virtual signal_t getSignalWithMaskAtCoord(const coord_t *coords, const Mantid::API::MDNormalization &normalization) const =0
Returns the (normalized) signal at a given coordinates or 0 if the value.
const std::string toString() const override
Serializes the object to a string.
virtual MDNormalization displayNormalizationHisto() const
std::string getConvention() const
std::unique_ptr< IMDIterator > createIterator(Mantid::Geometry::MDImplicitFunction *function=nullptr) const
Creates a single iterator and returns it.
signal_t getSignalAtVMD(const Mantid::Kernel::VMD &coords, const Mantid::API::MDNormalization &normalization=Mantid::API::VolumeNormalization) const
Returns the signal (normalized by volume) at a given coordinates.
virtual MDNormalization displayNormalization() const
virtual LinePlot getLinePlot(const Mantid::Kernel::VMD &start, const Mantid::Kernel::VMD &end, Mantid::API::MDNormalization normalize) const
Method to generate a line plot through a MD-workspace.
virtual std::vector< std::unique_ptr< IMDIterator > > createIterators(size_t suggestedNumCores=1, Mantid::Geometry::MDImplicitFunction *function=nullptr) const =0
Creates a new iterator pointing to the first cell in the workspace.
void makeSinglePointWithNaN(std::vector< coord_t > &x, std::vector< signal_t > &y, std::vector< signal_t > &e) const
Make a single point with NaN as the signal and error This can be returned when there would otherwise ...
void setConvention(std::string convention)
Describes the geometry (i.e.
virtual std::shared_ptr< const Mantid::Geometry::IMDDimension > getDimension(size_t index) const
Get a dimension.
virtual size_t getNumDims() const
bool hasOriginalWorkspace(size_t index=0) const
std::shared_ptr< Workspace > getOriginalWorkspace(size_t index=0) const
Get the "original" workspace (the workspace that was the source for a binned MDWorkspace).
Base Workspace Abstract Class.
virtual const std::string getTitle() const
Get the workspace title.
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
virtual const std::string id() const =0
A string ID for the class.
The concrete, templated class for properties.
Manage the lifetime of a class intended to be a singleton.
const TYPE * getBareArray() const
std::shared_ptr< const IMDWorkspace > IMDWorkspace_const_sptr
Shared pointer to the IMDWorkspace base class (const version)
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
MDNormalization
Enum describing different ways to normalize the signal in a MDWorkspace.
@ NoNormalization
Don't normalize = return raw counts.
MANTID_KERNEL_DLL V3D normalize(V3D v)
Normalizes a V3D.
Helper class which provides the Collimation Length for SANS instruments.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
double signal_t
Typedef for the signal recorded in a MDBox, etc.
Holds X, Y, E for a line plot.
std::vector< signal_t > y
std::vector< signal_t > e