Mantid
Loading...
Searching...
No Matches
MultipleExperimentInfos.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 +
11#include <boost/python/class.hpp>
12
18using namespace boost::python;
19
20namespace {
21void addExperimentInfo(MultipleExperimentInfos &self, const boost::python::object &item) {
22 auto workspaceExtractor = ExtractSharedPtr<Workspace>(item);
23 if (!workspaceExtractor.check())
24 throw std::invalid_argument("Incorrect type. Expected a workspace.");
25
26 if (auto exptInfo = std::dynamic_pointer_cast<ExperimentInfo>(workspaceExtractor()))
27 self.addExperimentInfo(exptInfo);
28 else
29 throw std::invalid_argument("Incorrect type. Expected a workspace type derived from ExperimentInfo.");
30}
31} // namespace
32
34 class_<MultipleExperimentInfos, boost::noncopyable>("MultipleExperimentInfos", no_init)
35 .def("getExperimentInfo",
36 (ExperimentInfo_sptr(MultipleExperimentInfos::*)(const uint16_t)) &
38 (arg("self"), arg("expInfoIndex")), "Return the experiment info at the given index.")
39 .def("addExperimentInfo", addExperimentInfo, (arg("self"), arg("ExperimentalInfo")),
40 "Add a new :class:`~mantid.api.ExperimentInfo` to this "
41 ":class:`~mantid.api.IMDWorkspace`")
42 .def("getNumExperimentInfo", &MultipleExperimentInfos::getNumExperimentInfo, arg("self"),
43 "Return the number of :class:`~mantid.api.ExperimentInfo` objects,")
44 .def("copyExperimentInfos", &MultipleExperimentInfos::copyExperimentInfos,
45 (arg("self"), arg("MultipleExperimentInfos")), "Copy the :class:`~mantid.api.ExperimentInfo` from another");
46}
void export_MultipleExperimentInfos()
This class is shared by a few Workspace types and holds information related to a particular experimen...
Small class that allows a MDEventWorkspace or a MDHistoWorkspace to hold several ExperimentInfo class...
void copyExperimentInfos(const MultipleExperimentInfos &other)
Copy the experiment infos from another.
ExperimentInfo_sptr getExperimentInfo(const uint16_t expInfoIndex)
Get the ExperimentInfo for the given Experiment-Info Index.
uint16_t addExperimentInfo(const ExperimentInfo_sptr &ei)
Add a new ExperimentInfo to this MDEventWorkspace.
Base Workspace Abstract Class.
Definition: Workspace.h:30
std::shared_ptr< ExperimentInfo > ExperimentInfo_sptr
Shared pointer to ExperimentInfo.