Mantid
Loading...
Searching...
No Matches
DataProcessorAlgorithm.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 +
10#include <boost/python/class.hpp>
11#include <boost/python/overloads.hpp>
12
13using namespace Mantid::API;
15using namespace boost::python;
16
17namespace {
18template <class Base>
19using loadOverload = Workspace_sptr (DataProcessorAdapter<Base>::*)(const std::string &, const bool);
20
21template <class Base> void do_export(const std::string &name) {
22 // for strings will actually create a list
24 using Adapter = DataProcessorAdapter<Base>;
25
26 class_<GenericDataProcessorAlgorithm<Base>, bases<Base>, std::shared_ptr<Adapter>, boost::noncopyable>(
27 name.c_str(), "Base class workflow-type algorithms")
28
29 .def("setLoadAlg", &Adapter::setLoadAlgProxy, (arg("self"), arg("alg")),
30 "Set the name of the algorithm called using the load() method "
31 "[Default=Load]")
32
33 .def("setLoadAlgFileProp", &Adapter::setLoadAlgFilePropProxy, (arg("self"), arg("file_prop_name")),
34 "Set the name of the file property for the load algorithm when "
35 "using "
36 "the load() method [Default=Filename]")
37
38 .def("setAccumAlg", &Adapter::setAccumAlgProxy, (arg("self"), arg("alg")),
39 "Set the name of the algorithm called to accumulate a chunk of "
40 "processed data [Default=Plus]")
41
42 .def("copyProperties", &Adapter::copyPropertiesProxy,
43 (arg("self"), arg("alg"), arg("properties") = boost::python::object(), arg("version") = -1),
44 "Copy properties from another algorithm")
45
46 .def("determineChunk", &Adapter::determineChunkProxy, (arg("self"), arg("file_name")),
47 "Return a TableWorkspace containing the information on how to split "
48 "the "
49 "input file when processing in chunks")
50
51 .def("loadChunk", &Adapter::loadChunkProxy, (arg("self"), arg("row_index")), "Load a chunk of data")
52
53 .def("load", (loadOverload<Base>)&Adapter::loadProxy, (arg("self"), arg("input_data"), arg("load_quiet") = false),
54 "Loads the given file or workspace data and returns the workspace. "
55 "If loadQuiet=True then output is not stored in the "
56 "AnalysisDataService.")
57
58 .def("splitInput", &Adapter::splitInputProxy, (arg("self"), arg("input")), return_value_policy<VectorToNumpy>())
59
60 .def("forwardProperties", &Adapter::forwardPropertiesProxy, arg("self"))
61
62 .def("getProcessProperties", &Adapter::getProcessPropertiesProxy, (arg("self"), arg("property_manager")),
63 "Returns the named property manager from the service or creates "
64 "a new one if it does not exist")
65
66 .def("saveNexus", &Adapter::saveNexusProxy, (arg("self"), arg("output_wsname"), arg("output_filename")),
67 "Save a workspace as a nexus file");
68}
69} // namespace
70
71void export_DataProcessorAlgorithm() { do_export<Algorithm>("DataProcessorAlgorithm"); }
std::string name
Definition Run.cpp:60
void export_DataProcessorAlgorithm()
Provides a layer class for boost::python to allow C++ virtual functions to be overridden in a Python ...
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
STL namespace.
Implements a return value policy that returns a numpy array from a function returning a std::vector b...