20using namespace Geometry;
21using namespace Kernel;
32 std::vector<std::string> outputs;
33 for (
const auto &input : inputs) {
37 std::vector<std::string> group = wsgroup->
getNames();
38 outputs.insert(outputs.end(), group.begin(), group.end());
43 outputs.emplace_back(matrixws->getName());
45 throw(std::runtime_error(
"The input " + input +
" is neither a WorkspaceGroup nor a MatrixWorkspace"));
59 m_xUnit = ref->getAxis(0)->unit()->unitID();
69 m_hasDx.emplace_back(ref->hasDx(i));
81 if (ws->getNumberHistograms() !=
m_numberSpectra && checkNumberHistograms)
82 errors +=
"different number of histograms; ";
83 if (ws->getAxis(0)->unit()->unitID() !=
m_xUnit)
84 errors +=
"different X units; ";
86 errors +=
"different spectrum axis units; ";
88 errors +=
"different Y units; ";
90 errors +=
"different data type (Histogram Data vs Point Data); ";
92 errors +=
"different distribution flag (Histogrm vs Distribution); ";
94 errors +=
"a mix of workspaces with and without detector scans; ";
96 errors +=
"workspaces with detectors scans have different number of "
99 errors +=
"different instrument names; ";
103 if (
m_hasDx[i] != ws->hasDx(i)) {
104 errors +=
"spectra must have either Dx values or not; ";
123std::list<API::MatrixWorkspace_sptr>
125 std::list<MatrixWorkspace_sptr> inWS;
127 for (
size_t i = 0; i < inputWorkspaces.size(); ++i) {
132 throw std::runtime_error(
"Could not find a MatrixWorkspace with the name " + inputWorkspaces[i]);
134 inWS.emplace_back(ws);
136 if (!inWS.back()->isCommonBins()) {
137 g_log.
error(
"Input workspaces must have common binning for all spectra");
138 throw std::invalid_argument(
"Input workspaces must have common binning for all spectra");
145 if (!compatibility.empty()) {
146 g_log.
error(
"Input workspaces are not compatible: " + compatibility);
147 throw std::invalid_argument(
"Input workspaces are not compatible: " + compatibility);
Base MatrixWorkspace Abstract Class.
Class to hold a set of workspaces.
std::vector< std::string > getNames() const
Returns the names of workspaces that make up this group.
std::string m_spectrumAxisUnit
std::vector< bool > m_hasDx
static std::vector< std::string > unWrapGroups(const std::vector< std::string > &)
Flattens the list of group workspaces (if any) into list of workspaces.
std::list< API::MatrixWorkspace_sptr > validateInputWorkspaces(const std::vector< std::string > &inputWorkspaces, Kernel::Logger &g_log)
Checks that the input workspace all exist, that they are the same size, have the same units and the s...
void setReferenceProperties(const API::MatrixWorkspace_sptr &)
Sets the properties of the reference (usually first) workspace, to later check the compatibility of t...
std::string checkCompatibility(const API::MatrixWorkspace_sptr &, bool checkNumberHistograms=false)
Compares the properties of the input workspace with the reference.
std::string m_instrumentName
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 T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class