Mantid
|
Takes a Python object and if it supports indexing and is two dimensional it attempts to convert it to a Kernel::Matrix object. More...
#include <PyObjectToMatrix.h>
Public Member Functions | |
Kernel::Matrix< double > | operator() () |
Produces a V3D object from the given PyObject. More... | |
PyObjectToMatrix (const boost::python::object &p) | |
Construct the converter object with the given Python object. More... | |
Private Attributes | |
bool | m_alreadyMatrix |
Is the object a wrapped instance of Matrix<double> More... | |
const boost::python::object & | m_obj |
A reference to the object. More... | |
Takes a Python object and if it supports indexing and is two dimensional it attempts to convert it to a Kernel::Matrix object.
Note, this currently only suuports Matrix<double>
Definition at line 22 of file PyObjectToMatrix.h.
Mantid::PythonInterface::Converters::PyObjectToMatrix::PyObjectToMatrix | ( | const boost::python::object & | p | ) |
Construct the converter object with the given Python object.
p | :: A boost::python object is either a wrapped Kernel::Matrix or 2D numpy array Throws std::invalid_argument if not if that is not the case. |
Definition at line 31 of file PyObjectToMatrix.cpp.
References Mantid::PythonInterface::NDArray::check(), and m_alreadyMatrix.
Kernel::Matrix< double > Mantid::PythonInterface::Converters::PyObjectToMatrix::operator() | ( | ) |
Produces a V3D object from the given PyObject.
Returns a V3D object from the Python object given to the converter.
Definition at line 60 of file PyObjectToMatrix.cpp.
References m_alreadyMatrix, and m_obj.
|
private |
Is the object a wrapped instance of Matrix<double>
Definition at line 31 of file PyObjectToMatrix.h.
Referenced by operator()(), and PyObjectToMatrix().
|
private |
A reference to the object.
Definition at line 29 of file PyObjectToMatrix.h.
Referenced by operator()().