Mantid
Loading...
Searching...
No Matches
NDArray.h
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 +
7#pragma once
9
10#include <boost/python/object.hpp>
11
12namespace Mantid {
13namespace PythonInterface {
14
15// It is important that the numpy/arrayobject header
16// does not appear in any of our headers as it
17// contains some static definitions that cannot be
18// allowed to be defined in other translation units
19
21
23
31class MANTID_PYTHONINTERFACE_CORE_DLL NDArray : public boost::python::object {
32public:
33 static bool check(const boost::python::object &obj);
34
35 NDArray(const boost::python::object &obj);
37
38 Py_intptr_t const *get_shape() const;
39 int get_nd() const;
40 void *get_data() const;
41 char get_typecode() const;
42
43 NDArray astype(char dtype, bool copy = true) const;
44};
45
46} // end namespace PythonInterface
47} // end namespace Mantid
48
49namespace boost {
50namespace python {
51namespace converter {
55template <> struct MANTID_PYTHONINTERFACE_CORE_DLL object_manager_traits<Mantid::PythonInterface::NDArray> {
56 BOOST_STATIC_CONSTANT(bool, is_specialized = true);
57 static bool check(PyObject *obj);
58 static python::detail::new_reference adopt(PyObject *obj);
59 static PyTypeObject const *get_pytype();
60};
61} // end namespace converter
62} // end namespace python
63} // end namespace boost
std::string dtype(Mantid::Kernel::PropertyWithValue< HeldType > &self)
double obj
the value of the quadratic function
Thin object wrapper around a numpy array.
Definition: NDArray.h:31
BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(NDArray, boost::python::object)
#define MANTID_PYTHONINTERFACE_CORE_DLL
Definition: DllConfig.h:17
MANTID_PYTHONINTERFACE_CORE_DLL void importNumpy()
Initialize the numpy array api for this DLL.
Definition: NDArray.cpp:22
MANTID_PYTHONINTERFACE_CORE_DLL PyTypeObject * ndarrayType()
Return the type object for a numpy.NDArray.
Definition: NDArray.cpp:38
Helper class which provides the Collimation Length for SANS instruments.
Definition: NDArray.h:49