Mantid
Loading...
Searching...
No Matches
WorkspaceValidators.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
16#include <boost/python/class.hpp>
17
19using Mantid::Kernel::TypedValidator;
21using namespace boost::python;
22
29
30 class_<MatrixWorkspaceValidator, bases<TypedValidator<MatrixWorkspace_sptr>>, boost::noncopyable>(
31 "MatrixWorkspaceValidator", no_init);
32
33 class_<TypedValidator<IMDWorkspace_sptr>, boost::noncopyable>("IMDWorkspaceValidator", no_init);
34}
37#define EXPORT_WKSP_VALIDATOR_NO_ARG(ValidatorType, DocString) \
38 class_<ValidatorType, bases<MatrixWorkspaceValidator>, boost::noncopyable>(#ValidatorType, init<>(DocString));
41#define EXPORT_WKSP_VALIDATOR_ARG(ValidatorType, ArgType, ArgName, DocString) \
42 class_<ValidatorType, bases<MatrixWorkspaceValidator>, boost::noncopyable>(#ValidatorType, \
43 init<ArgType>(arg(ArgName), DocString));
47#define EXPORT_WKSP_VALIDATOR_DEFAULT_ARG(ValidatorType, ArgType, ArgName, DefaultValue, DocString) \
48 class_<ValidatorType, bases<MatrixWorkspaceValidator>, boost::noncopyable>( \
49 #ValidatorType, init<ArgType>(arg(ArgName) = DefaultValue, DocString));
50
52 using namespace Mantid::API;
53
55 "Checks the workspace has the given unit along the X-axis");
56 EXPORT_WKSP_VALIDATOR_DEFAULT_ARG(HistogramValidator, bool, "mustBeHistogram", true,
57 "If mustBeHistogram=True then the "
58 "workspace must be a histogram "
59 "otherwise it must be point data.");
60 EXPORT_WKSP_VALIDATOR_DEFAULT_ARG(RawCountValidator, bool, "mustNotBeDistribution", true,
61 "If mustNotBeDistribution=True then the workspace must not have been "
62 "divided by the bin-width");
63 EXPORT_WKSP_VALIDATOR_NO_ARG(CommonBinsValidator, "A tentative check that the bins are common across the workspace");
65 "Checks whether the axis specified by axisNumber is a SpectraAxis");
67 "Checks whether the axis specified by axisNumber is a NumericAxis");
68
69 class_<MDFrameValidator, bases<TypedValidator<IMDWorkspace_sptr>>, boost::noncopyable>(
70 "MDFrameValidator", init<std::string>(arg("frameName"), "Checks the MD workspace has the given frame along all "
71 "dimensions. Accepted values for the `frameName` are "
72 "currently: `HKL`, `QLab`, `QSample`, `Time of "
73 "Flight`, `Distance`, `General frame`, `Unknown "
74 "frame` "));
75}
#define EXPORT_WKSP_VALIDATOR_NO_ARG(ValidatorType, DocString)
Export a validator derived from a MatrixWorkspaceValidator that has a no-arg constructor.
#define EXPORT_WKSP_VALIDATOR_ARG(ValidatorType, ArgType, ArgName, DocString)
Export a validator derived from a MatrixWorkspaceValidator that has a single-arg constructor.
void export_WorkspaceValidators()
#define EXPORT_WKSP_VALIDATOR_DEFAULT_ARG(ValidatorType, ArgType, ArgName, DefaultValue, DocString)
Export a validator derived from a MatrixWorkspaceValidator that has a single-arg constructor with a d...
void export_MatrixWorkspaceValidator()
This is the base TypedValidator for most of the WorkspaceValidators.
A validator which provides a TENTATIVE check that a workspace contains common bins in each spectrum.
A validator which checks that a workspace contains histogram data (the default) or point data as requ...
An interface for those validators that require the MatrixWorkspace interface.
A validator which checks whether the input workspace has the Numeric data in the axis.
A validator which checks that a workspace contains raw counts in its bins.
A validator which checks whether the input workspace has the Spectra number in the axis.
A validator which checks that the unit of the workspace referred to by a WorkspaceProperty is the exp...
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
Definition: IMDWorkspace.h:146
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Declares a simple static struct to export a TypedValidator to Python.
static void define(const char *pythonClassName)