Mantid
Loading...
Searching...
No Matches
Goniometer.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 +
12
14#include <boost/python/class.hpp>
15#include <boost/python/overloads.hpp>
16
19using namespace Mantid::PythonInterface;
20using namespace boost::python;
21
22namespace //<unnamed>
23{
25GNU_DIAG_OFF("unused-local-typedef")
26// Ignore -Wconversion warnings coming from boost::python
27// Seen with GCC 7.1.1 and Boost 1.63.0
28GNU_DIAG_OFF("conversion")
29// define overloaded functions
30BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getEulerAngles_overloads, Goniometer::getEulerAngles, 0, 1)
31GNU_DIAG_ON("conversion")
32GNU_DIAG_ON("unused-local-typedef")
34
36void setR(Goniometer &self, const object &data) { self.setR(Converters::PyObjectToMatrix(data)()); }
37
39void calcFromQSampleAndWavelength(Goniometer &self, const object &position, double wavelength, bool flip_x,
40 bool inner) {
41 self.calcFromQSampleAndWavelength(Converters::PyObjectToV3D(position)(), wavelength, flip_x, inner);
42}
43} // namespace
44
46
47 // return_value_policy for read-only numpy array
48 using return_readonly_numpy = return_value_policy<Policies::MatrixRefToNumpy<Converters::WrapReadOnly>>;
49
50 class_<Goniometer>("Goniometer", init<>(arg("self")))
51 .def(init<Goniometer const &>((arg("self"), arg("other"))))
52 .def(init<DblMatrix>((arg("self"), arg("rot"))))
53 .def("getEulerAngles", (&Goniometer::getEulerAngles),
54 getEulerAngles_overloads(args("self", "convention"), "Default convention is \'YZX\'. Universal "
55 "goniometer is \'YZY\'"))
56 .def("getR", &Goniometer::getR, arg("self"), return_readonly_numpy())
57 .def("setR", &setR, (arg("self"), arg("rot")))
58 .def("calcFromQSampleAndWavelength", &calcFromQSampleAndWavelength,
59 (arg("self"), arg("positions"), arg("wavelength"), arg("flip_x") = false, arg("inner") = false));
60}
double position
Definition: GetAllEi.cpp:154
void export_Goniometer()
Definition: Goniometer.cpp:45
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(valueAsPrettyStrOverloader, valueAsPrettyStr, 0, 2) void export_Property()
Definition: Property.cpp:102
#define GNU_DIAG_ON(x)
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
Class to represent a particular goniometer setting, which is described by the rotation matrix.
Definition: Goniometer.h:55
std::vector< double > getEulerAngles(const std::string &convention="YZX")
Return Euler angles acording to a convention.
Definition: Goniometer.cpp:282
const Kernel::DblMatrix & getR() const
Return global rotation matrix.
Definition: Goniometer.cpp:80
void calcFromQSampleAndWavelength(const Mantid::Kernel::V3D &Q, double wavelength, bool flip_x=false, bool inner=false)
Calculate goniometer for rotation around y-asix for constant wavelength from Q Sample.
Definition: Goniometer.cpp:197
Takes a Python object and if it supports indexing and is two dimensional it attempts to convert it to...
Takes a Python object and if it supports indexing and is of length 3 then it will attempt to convert ...
Definition: PyObjectToV3D.h:22