33 useAlgorithm(
"CompareWorkspaces");
34 deprecatedDate(
"2015-10-27");
37using namespace Kernel;
39using namespace DataObjects;
40using namespace Geometry;
45 "The name of the first input workspace.");
47 "The name of the second input workspace.");
49 declareProperty(
"Tolerance", 0.0,
"The maximum amount by which values may differ between the workspaces.");
52 "Whether to check that the data types "
53 "(Workspace2D vs EventWorkspace) match.");
54 declareProperty(
"CheckAxes",
true,
"Whether to check that the axes match.");
55 declareProperty(
"CheckSpectraMap",
true,
"Whether to check that the spectra-detector maps match. ");
56 declareProperty(
"CheckInstrument",
true,
"Whether to check that the instruments match. ");
57 declareProperty(
"CheckMasking",
true,
"Whether to check that the bin masking matches. ");
59 "Whether to check that the sample (e.g. logs).");
66 "Treat tolerance as relative error rather then the absolute error.\n"
67 "This is only applicable to Matrix workspaces.");
69 "Usually checking data ends when first mismatch occurs. This "
70 "forces algorithm to check all data and print mismatch to "
72 "Very often such logs are huge so making it true should be "
76 declareProperty(
"NumberMismatchedSpectraToPrint", 1,
"Number of mismatched spectra from lowest to be listed. ");
88 g_log.
notice() <<
"The workspaces did not match: " << result <<
'\n';
131 compare->setRethrows(
true);
137 compare->setProperty(
"Workspace1", ws1);
138 compare->setProperty(
"Workspace2", ws2);
141 const std::vector<Property *> &allProps = this->
getProperties();
142 auto propCount = allProps.size();
143 for (
size_t i = 0; i < propCount; ++i) {
145 const std::string &pname = prop->
name();
147 if (!prop->
isDefault() && pname !=
"Workspace1" && pname !=
"Workspace2" && pname !=
"Result")
155 if (!
compare->getProperty(
"Result")) {
157 auto rowcount = table->rowCount();
158 for (
size_t i = 0; i < rowcount; ++i) {
159 result += table->cell<std::string>(i, 0);
163 table->cell<std::string>(i, 0) !=
"Type mismatch. One workspace is a group, the other is not." &&
164 table->cell<std::string>(i, 0) !=
"GroupWorkspaces size mismatch.") {
166 result +=
". Inputs=[" + table->cell<std::string>(i, 1) +
"," + table->cell<std::string>(i, 2) +
"]";
169 if (i < (rowcount - 1))
#define DECLARE_ALGORITHM(classname)
Base class from which all concrete algorithm classes should be derived.
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
const std::vector< Kernel::Property * > & getProperties() const override
Get the list of managed properties.
Class for marking algorithms as deprecated.
A property class for workspaces.
Compares two workspaces for equality.
std::string runCompareWorkspaces(bool group_compare=false)
This algorithm is now deprecated and calls CompareWorkspaces instead.
void exec() override
Called when comparing two individual workspaces.
bool processGroups() override
Called when comparing workspace groups.
static std::string successString()
The string that is returned when comparison is successful.
void init() override
Initialisation code.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void notice(const std::string &msg)
Logs at notice level.
Base class for properties.
virtual bool isDefault() const =0
Overriden function that returns if property has the same value that it was initialised with,...
const std::string & name() const
Get the property's name.
virtual std::string value() const =0
Returns the value of the property as a string.
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
std::shared_ptr< Algorithm > Algorithm_sptr
Typedef for a shared pointer to an Algorithm.
bool compare(const mypair &left, const mypair &right)
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
@ Input
An input workspace.
@ Output
An output workspace.