Mantid
|
Namespaces | |
namespace | Converters |
namespace | detail |
namespace | Policies |
namespace | Registry |
Classes | |
class | AlgorithmAdapter |
Provides a layer class for boost::python to allow C++ virtual functions to be overridden in a Python object that is derived an Algorithm. More... | |
class | AlgorithmFactoryObserverAdapter |
A wrapper class helping to export AnalysisDataServiceObserver to python. More... | |
struct | AlgorithmIDProxy |
Provides a concrete type to wrap & return AlgorithmIDs that are actually just typedefs for void*. More... | |
class | AlgorithmObserverAdapter |
A wrapper class helping to export AlgorithmObserver to python. More... | |
class | AnalysisDataServiceObserverAdapter |
A wrapper class helping to export AnalysisDataServiceObserver to python. More... | |
class | DataProcessorAdapter |
Provides a layer class for boost::python to allow C++ virtual functions to be overridden in a Python object that is derived an DataProcessorAlgorithm. More... | |
struct | DataServiceExporter |
A helper struct to export templated DataService<> types to Python. More... | |
struct | ExtractSharedPtr |
struct | GILSharedPtrDeleter |
Special shared_ptr::deleter object that locks the GIL while deleting the underlying Python object. More... | |
struct | GILState |
class | GlobalInterpreterLock |
Defines a structure for acquiring/releasing the Python GIL using the RAII pattern. More... | |
class | IFunction1DAdapter |
Provides a layer class for boost::python to allow C++ virtual functions to be overridden in a Python object that is derived from IFunction1D. More... | |
class | IFunctionAdapter |
Provides a layer to hook into the protected functions of IFunction. More... | |
class | IPeakFunctionAdapter |
Provides a layer class for boost::python to allow C++ virtual functions to be overridden in a Python object that is derived from IPeakFunction. More... | |
class | IPyTypeVisitor |
class | NDArray |
Thin object wrapper around a numpy array. More... | |
struct | PropertyWithValueExporter |
A helper struct to export PropertyWithValue<> types to Python. More... | |
struct | PyNativeTypeExtractor |
class | PythonException |
Exception type that captures the current Python error state as a generic C++ exception for any general Python exception. More... | |
class | PythonObjectInstantiator |
class | ReleaseGlobalInterpreterLock |
Defines a structure for releasing the Python GIL using the RAII pattern. More... | |
class | RunPythonScript |
class | SpectrumInfoPythonIterator |
SpectrumInfoPythonIterator. More... | |
struct | std_set_exporter |
std::set wrapper More... | |
struct | std_vector_exporter |
A struct to help export std::vector types. More... | |
struct | TypedValidatorExporter |
Declares a simple static struct to export a TypedValidator to Python. More... | |
struct | UndefinedAttributeError |
Defines an exception for an undefined attribute. More... | |
class | UninstallTrace |
RAII handler to temporarily remove and reinstall a Python trace function. More... | |
struct | WorkspacePropertyExporter |
A helper struct to export WorkspaceProperty<> types to Python. More... | |
Functions | |
template<typename ReturnType , typename... Args> | |
ReturnType | callMethod (PyObject *obj, const char *methodName, const Args &...args) |
Wrapper around boost::python::call_method to acquire GIL for duration of call. More... | |
template<typename ReturnType , typename... Args> | |
ReturnType | callMethodNoCheck (const boost::python::object &obj, const char *methodName, const Args &...args) |
Wrapper around boost::python::call_method to acquire GIL for duration of call. More... | |
template<typename ReturnType , typename... Args> | |
ReturnType | callMethodNoCheck (PyObject *obj, const char *methodName, const Args &...args) |
Wrapper around boost::python::call_method to acquire GIL for duration of call. More... | |
PyObject * | cloneDx (const API::MatrixWorkspace &self) |
Create a numpy array from the E values of the given workspace reference. More... | |
PyObject * | cloneE (const API::MatrixWorkspace &self) |
Create a numpy array from the E values of the given workspace reference. More... | |
PyObject * | cloneX (const API::MatrixWorkspace &self) |
{ Create a numpy array from the X values of the given workspace reference More... | |
PyObject * | cloneY (const API::MatrixWorkspace &self) |
Create a numpy array from the Y values of the given workspace reference. More... | |
template<typename Copyable > | |
boost::python::object | generic__copy__ (const bp::object ©able) |
Create a shallow copy of type Copyable providing Copyable is newable and has a public copy constructor. More... | |
template<typename Copyable > | |
bp::object | generic__deepcopy__ (const bp::object ©able, bp::dict &memo) |
Create a deep copy of type Copyable providing Copyable is newable and has a public copy constructor. More... | |
MANTID_PYTHONINTERFACE_CORE_DLL void | importNumpy () |
Initialize the numpy array api for this DLL. More... | |
bool | isNone (const boost::python::object &obj) |
bool | isNone (PyObject *ptr) |
template<typename T > | |
PyObject * | managingPyObject (T *p) |
Create a new object handle around arg. More... | |
MANTID_PYTHONINTERFACE_CORE_DLL PyTypeObject * | ndarrayType () |
Return the type object for a numpy.NDArray. More... | |
template IMDHistoWorkspace_sptr | performBinaryOp (const IMDHistoWorkspace_sptr, const IMDHistoWorkspace_sptr, const std::string &, const std::string &name, bool, bool) |
template IMDHistoWorkspace_sptr | performBinaryOp (const IMDHistoWorkspace_sptr, const MatrixWorkspace_sptr, const std::string &, const std::string &name, bool, bool) |
template IMDWorkspace_sptr | performBinaryOp (const IMDWorkspace_sptr, const IMDWorkspace_sptr, const std::string &, const std::string &name, bool, bool) |
template WorkspaceGroup_sptr | performBinaryOp (const IMDWorkspace_sptr, const WorkspaceGroup_sptr, const std::string &, const std::string &name, bool, bool) |
template WorkspaceGroup_sptr | performBinaryOp (const WorkspaceGroup_sptr, const IMDWorkspace_sptr, const std::string &, const std::string &name, bool, bool) |
template WorkspaceGroup_sptr | performBinaryOp (const WorkspaceGroup_sptr, const WorkspaceGroup_sptr, const std::string &, const std::string &name, bool, bool) |
template IMDHistoWorkspace_sptr | performBinaryOpWithDouble (const IMDHistoWorkspace_sptr, const double, const std::string &op, const std::string &, bool, bool) |
template IMDWorkspace_sptr | performBinaryOpWithDouble (const IMDWorkspace_sptr, const double, const std::string &op, const std::string &, bool, bool) |
template WorkspaceGroup_sptr | performBinaryOpWithDouble (const WorkspaceGroup_sptr, const double, const std::string &op, const std::string &, bool, bool) |
template<typename ElementType > | |
std::string | toString (const ElementType &value) |
Convert an element type within a sequence to a string for printing. More... | |
template<typename SequenceType , typename ElementType > | |
std::string | toString (const SequenceType &values) |
Convert a sequence of values to a string for printing. More... | |
template<> | |
std::string | toString (const std::string &value) |
Convert a string element within a sequence to a string for printing. More... | |
bool MANTID_PYTHONINTERFACE_CORE_DLL | typeHasAttribute (const boost::python::detail::wrapper_base &wrapper, const char *attr) |
An overload for the above taking a wrapper reference. More... | |
bool MANTID_PYTHONINTERFACE_CORE_DLL | typeHasAttribute (PyObject *obj, const char *attr) |
This namespace contains helper functions for classes that are overridden in Python. More... | |
Binary operation helpers | |
Defines helpers to run the binary operation algorithms | |
template<typename LHSType , typename RHSType , typename ResultType > | |
ResultType | performBinaryOp (const LHSType lhs, const RHSType rhs, const std::string &op, const std::string &name, bool inplace, bool reverse) |
Binary op for two workspaces. More... | |
template<typename LHSType , typename RHSType , typename ResultType > | |
ResultType | performBinaryOpMD (const LHSType lhs, const RHSType rhs, const std::string &op, const std::string &name, bool inplace, bool reverse) |
Binary op for two MDworkspaces. More... | |
template<typename LHSType , typename ResultType > | |
ResultType | performBinaryOpWithDouble (const LHSType inputWS, const double value, const std::string &op, const std::string &name, bool inplace, bool reverse) |
Binary op for a workspace and a double. More... | |
template<typename LHSType , typename ResultType > | |
ResultType | performBinaryOpMDWithDouble (const LHSType lhs, const double value, const std::string &op, const std::string &name, bool inplace, bool reverse) |
Binary op for MDworkspaces + double. More... | |
ReturnType Mantid::PythonInterface::callMethod | ( | PyObject * | obj, |
const char * | methodName, | ||
const Args &... | args | ||
) |
Wrapper around boost::python::call_method to acquire GIL for duration of call.
If the attribute does not exist then an UndefinedAttributeError is thrown, if the call raises a Python error then this is translated to a C++ exception object inheriting from std::exception or std::runtime_error depending on the type of Python error.
obj | Pointer to Python object |
methodName | Name of the method call |
args | A list of arguments to forward to call_method |
Definition at line 87 of file CallMethod.h.
References callMethod(), Mantid::PythonInterface::detail::callMethodImpl(), obj, and typeHasAttribute().
Referenced by callMethod().
ReturnType Mantid::PythonInterface::callMethodNoCheck | ( | const boost::python::object & | obj, |
const char * | methodName, | ||
const Args &... | args | ||
) |
Wrapper around boost::python::call_method to acquire GIL for duration of call.
If the call raises a Python error then this is translated to a C++ exception object inheriting from std::exception or std::runtime_error depending on the type of Python error. Overload for boost::python::object
obj | Reference to boost.python.object wrapper |
methodName | Name of the method call |
args | A list of arguments to forward to call_method |
Definition at line 71 of file CallMethod.h.
References Mantid::PythonInterface::detail::callMethodImpl(), callMethodNoCheck(), and obj.
ReturnType Mantid::PythonInterface::callMethodNoCheck | ( | PyObject * | obj, |
const char * | methodName, | ||
const Args &... | args | ||
) |
Wrapper around boost::python::call_method to acquire GIL for duration of call.
If the call raises a Python error then this is translated to a C++ exception object inheriting from std::exception or std::runtime_error depending on the type of Python error.
obj | Pointer to Python object |
methodName | Name of the method call |
args | A list of arguments to forward to call_method |
Definition at line 56 of file CallMethod.h.
References Mantid::PythonInterface::detail::callMethodImpl(), callMethodNoCheck(), and obj.
Referenced by callMethodNoCheck().
PyObject * Mantid::PythonInterface::cloneDx | ( | const API::MatrixWorkspace & | self | ) |
Create a numpy array from the E values of the given workspace reference.
Definition at line 114 of file CloneMatrixWorkspace.cpp.
References Mantid::API::MatrixWorkspace::getNumberHistograms().
Referenced by export_MatrixWorkspace().
PyObject * Mantid::PythonInterface::cloneE | ( | const API::MatrixWorkspace & | self | ) |
Create a numpy array from the E values of the given workspace reference.
Definition at line 105 of file CloneMatrixWorkspace.cpp.
References Mantid::API::MatrixWorkspace::getNumberHistograms().
Referenced by export_MatrixWorkspace().
PyObject * Mantid::PythonInterface::cloneX | ( | const API::MatrixWorkspace & | self | ) |
{ Create a numpy array from the X values of the given workspace reference
Definition at line 88 of file CloneMatrixWorkspace.cpp.
References Mantid::API::MatrixWorkspace::getNumberHistograms().
Referenced by export_MatrixWorkspace().
PyObject * Mantid::PythonInterface::cloneY | ( | const API::MatrixWorkspace & | self | ) |
Create a numpy array from the Y values of the given workspace reference.
Definition at line 96 of file CloneMatrixWorkspace.cpp.
References Mantid::API::MatrixWorkspace::getNumberHistograms().
Referenced by export_MatrixWorkspace().
boost::python::object Mantid::PythonInterface::generic__copy__ | ( | const bp::object & | copyable | ) |
Create a shallow copy of type Copyable providing Copyable is newable and has a public copy constructor.
Definition at line 31 of file Copyable.h.
References managingPyObject().
bp::object Mantid::PythonInterface::generic__deepcopy__ | ( | const bp::object & | copyable, |
bp::dict & | memo | ||
) |
Create a deep copy of type Copyable providing Copyable is newable and has a public copy constructor.
Definition at line 44 of file Copyable.h.
References managingPyObject().
void Mantid::PythonInterface::importNumpy | ( | ) |
Initialize the numpy array api for this DLL.
runtime_error | if Python is not initialized |
Definition at line 22 of file NDArray.cpp.
Referenced by PythonInterpreterGlobalFixture::setUpWorld().
|
inline |
|
inline |
ptr | A * to a raw PyObject |
Definition at line 26 of file IsNone.h.
References isNone().
Referenced by Mantid::PythonInterface::DataProcessorAdapter< Base >::copyPropertiesProxy(), Mantid::PythonInterface::Registry::TypedPropertyValueHandler< std::shared_ptr< T >, std::enable_if< std::is_base_of< API::Workspace, T >::value >::type >::create(), Mantid::PythonInterface::Registry::SequenceTypeHandler< ContainerType >::create(), Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ValueType, Enable >::create(), Mantid::PythonInterface::RunPythonScript::extractOutputWorkspace(), and isNone().
|
inline |
Create a new object handle around arg.
Caller is owner.
Definition at line 23 of file Copyable.h.
Referenced by generic__copy__(), and generic__deepcopy__().
PyTypeObject * Mantid::PythonInterface::ndarrayType | ( | ) |
Return the type object for a numpy.NDArray.
Definition at line 38 of file NDArray.cpp.
template IMDHistoWorkspace_sptr Mantid::PythonInterface::performBinaryOp | ( | const | IMDHistoWorkspace_sptr, |
const | IMDHistoWorkspace_sptr, | ||
const std::string & | , | ||
const std::string & | name, | ||
bool | , | ||
bool | |||
) |
template IMDHistoWorkspace_sptr Mantid::PythonInterface::performBinaryOp | ( | const | IMDHistoWorkspace_sptr, |
const | MatrixWorkspace_sptr, | ||
const std::string & | , | ||
const std::string & | name, | ||
bool | , | ||
bool | |||
) |
template IMDWorkspace_sptr Mantid::PythonInterface::performBinaryOp | ( | const | IMDWorkspace_sptr, |
const | IMDWorkspace_sptr, | ||
const std::string & | , | ||
const std::string & | name, | ||
bool | , | ||
bool | |||
) |
template WorkspaceGroup_sptr Mantid::PythonInterface::performBinaryOp | ( | const | IMDWorkspace_sptr, |
const | WorkspaceGroup_sptr, | ||
const std::string & | , | ||
const std::string & | name, | ||
bool | , | ||
bool | |||
) |
ResultType Mantid::PythonInterface::performBinaryOp | ( | const LHSType | lhs, |
const RHSType | rhs, | ||
const std::string & | op, | ||
const std::string & | name, | ||
bool | inplace, | ||
bool | reverse | ||
) |
Binary op for two workspaces.
Binary operation for two workspaces.
Generic for IMDWorkspaces or MatrixWorkspaces... Called by python overloads for _binary_op (see api_exports.cpp)
lhs | :: the left hand side workspace of the operation |
rhs | :: the right hand side workspace of the operation |
op | :: The operation |
name | :: The output name |
inplace | :: is this is an inplace operation (i.e. does the output overwrite the lhs |
reverse | :: Unused parameter. Here for consistent interface |
Definition at line 84 of file BinaryOperations.cpp.
Referenced by export_BinaryOperations().
template WorkspaceGroup_sptr Mantid::PythonInterface::performBinaryOp | ( | const | WorkspaceGroup_sptr, |
const | IMDWorkspace_sptr, | ||
const std::string & | , | ||
const std::string & | name, | ||
bool | , | ||
bool | |||
) |
template WorkspaceGroup_sptr Mantid::PythonInterface::performBinaryOp | ( | const | WorkspaceGroup_sptr, |
const | WorkspaceGroup_sptr, | ||
const std::string & | , | ||
const std::string & | name, | ||
bool | , | ||
bool | |||
) |
ResultType Mantid::PythonInterface::performBinaryOpMD | ( | const LHSType | lhs, |
const RHSType | rhs, | ||
const std::string & | op, | ||
const std::string & | name, | ||
bool | inplace, | ||
bool | reverse | ||
) |
Binary op for two MDworkspaces.
ResultType Mantid::PythonInterface::performBinaryOpMDWithDouble | ( | const LHSType | lhs, |
const double | value, | ||
const std::string & | op, | ||
const std::string & | name, | ||
bool | inplace, | ||
bool | reverse | ||
) |
Binary op for MDworkspaces + double.
template IMDHistoWorkspace_sptr Mantid::PythonInterface::performBinaryOpWithDouble | ( | const | IMDHistoWorkspace_sptr, |
const double | , | ||
const std::string & | op, | ||
const std::string & | , | ||
bool | , | ||
bool | |||
) |
template IMDWorkspace_sptr Mantid::PythonInterface::performBinaryOpWithDouble | ( | const | IMDWorkspace_sptr, |
const double | , | ||
const std::string & | op, | ||
const std::string & | , | ||
bool | , | ||
bool | |||
) |
ResultType Mantid::PythonInterface::performBinaryOpWithDouble | ( | const LHSType | inputWS, |
const double | value, | ||
const std::string & | op, | ||
const std::string & | name, | ||
bool | inplace, | ||
bool | reverse | ||
) |
Binary op for a workspace and a double.
Perform the given binary operation on a workspace and a double.
Generic to MDWorkspaces. Called by python overloads for _binary_op (see api_exports.cpp)
inputWS | :: The input workspace |
value | :: The input value |
op | :: The operation |
name | :: The output name |
inplace | :: If true, then the lhs argument is replaced by the result of the operation. |
reverse | :: If true then the double is the lhs argument |
Definition at line 132 of file BinaryOperations.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and value.
Referenced by export_BinaryOperations().
template WorkspaceGroup_sptr Mantid::PythonInterface::performBinaryOpWithDouble | ( | const | WorkspaceGroup_sptr, |
const double | , | ||
const std::string & | op, | ||
const std::string & | , | ||
bool | , | ||
bool | |||
) |
|
inline |
Convert an element type within a sequence to a string for printing.
value | :: The elements value |
Definition at line 31 of file StlExportDefinitions.h.
References value.
std::string Mantid::PythonInterface::toString | ( | const SequenceType & | values | ) |
Convert a sequence of values to a string for printing.
Definition at line 51 of file StlExportDefinitions.h.
|
inline |
Convert a string element within a sequence to a string for printing.
value | :: The elements value |
Definition at line 44 of file StlExportDefinitions.h.
References value.
bool Mantid::PythonInterface::typeHasAttribute | ( | const boost::python::detail::wrapper_base & | wrapper, |
const char * | attr | ||
) |
An overload for the above taking a wrapper reference.
Same as above but taking a wrapper reference instead.
wrapper | :: A reference to a Wrapper object |
attr | :: A string containin the attribute name |
Definition at line 43 of file WrapperHelpers.cpp.
References typeHasAttribute().
bool Mantid::PythonInterface::typeHasAttribute | ( | PyObject * | obj, |
const char * | attr | ||
) |
This namespace contains helper functions for classes that are overridden in Python.
Checks whether the given object's type dictionary contains the named attribute.
Usually boost::python::get_override is used for this check but if the object's overridden function is declared on a superclass of the wrapped class then get_override always returns true, regardless of whether the method has been overridden in Python.
An example is the algorithm hierachy. We export the IAlgorithm interface with the name method attach to it. If a class in Python does not override the name method then get_override still claims that the override exists because it has found the IAlgorithm one
obj | :: A pointer to a PyObject |
attr | :: A string containin the attribute name |
Definition at line 32 of file WrapperHelpers.cpp.
References obj.
Referenced by Mantid::PythonInterface::AlgorithmAdapter< BaseAlgorithm >::AlgorithmAdapter(), callMethod(), Mantid::PythonInterface::IFunctionAdapter::IFunctionAdapter(), and typeHasAttribute().