25using namespace Kernel;
26using namespace Geometry;
34 "Input QENS data as MatrixWorkspace");
36 declareProperty(
"RaiseMode",
false,
37 "Set to True if an Exception, instead of "
38 "any empty list of Q values, is "
48 std::map<std::string, std::string> issues;
53 issues[
"InputWorkspace"] =
"InputWorkspace is not a MatrixWorkspace";
67 }
catch (std::exception &e) {
88 size_t numSpectra =
workspace->getNumberHistograms();
93 }
catch (std::exception &) {
94 throw std::runtime_error(
"Vertical axis is empty");
100 if (qAxis->
unit()->unitID() ==
"MomentumTransfer") {
103 for (
size_t i = 0; i < qAxis->
length(); i++) {
108 if (qValues.size() == numSpectra + 1) {
111 qValues.erase(qValues.begin());
112 using std::placeholders::_1;
113 std::transform(qValues.begin(), qValues.end(), qValues.begin(), std::bind(std::divides<double>(), _1, 2.0));
120 for (
size_t i = 0; i < numSpectra; i++) {
123 double theta = 0.5 *
workspace->detectorTwoTheta(*detector);
126 }
catch (std::exception &) {
127 throw std::runtime_error(
"Detectors are missing from the input workspace");
#define DECLARE_ALGORITHM(classname)
IPeaksWorkspace_sptr workspace
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Class to represent the axis of a workspace.
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.
A property class for workspaces.
Extracts Q-values from a workspace containing QENS data.
MantidVec extractQValues(const Mantid::API::MatrixWorkspace_sptr &workspace)
Extracts Q-values from the specified matrix workspace.
std::map< std::string, std::string > validateInputs() override
Cross-check properties with each other.
void exec() override
Execution code.
Support for a property that holds an array of values.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
The Logger class is in charge of the publishing messages from the framework through various channels.
void error(const std::string &msg)
Logs at error level.
static double convertToElasticQ(const double theta, const double efixed)
Convert to ElasticQ from Energy.
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< const Mantid::Geometry::IDetector > IDetector_const_sptr
Shared pointer to IDetector (const version)
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
@ Input
An input workspace.
@ Output
An output workspace.