Mantid
Loading...
Searching...
No Matches
Functions
Mantid::PythonInterface::Converters::Impl Namespace Reference

Functions

template<>
MANTID_PYTHONINTERFACE_CORE_DLL PyObject * clone1D (const std::vector< bool > &cvector)
 Specialisation for vector<bool> that stores the underlying data differently Returns a new numpy array with the a copy of the data vector of booleans. More...
 
template<typename ElementType >
PyObject * clone1D (const std::vector< ElementType > &cvector)
 Returns a new numpy array with the a copy of the data from 1D vector with the exception of string elements where a Python list is produced. More...
 
template<>
MANTID_PYTHONINTERFACE_CORE_DLL PyObject * clone1D (const std::vector< Types::Core::DateAndTime > &cvector)
 Specialisation for vector<DateAndTime> that stores the underlying data differently Returns a new numpy array with the a copy of the data vector of np.datetime64. More...
 
template<typename ElementType >
PyObject * cloneND (const ElementType *carray, const int ndims, Py_intptr_t *dims)
 Returns a new numpy array with the a copy of the data from array. More...
 
template<>
PyObject * cloneND (const std::string *carray, const int ndims, Py_intptr_t *dims)
 Returns a new python list of strings from the given array of strings. More...
 
MANTID_PYTHONINTERFACE_CORE_DLL PyArray_Descrfunc_PyArray_Descr (const char *datadescr)
 
MANTID_PYTHONINTERFACE_CORE_DLL PyObject * func_PyArray_IterNew (PyArrayObject *arr)
 equivalent to macro PyArray_IterNew More...
 
MANTID_PYTHONINTERFACE_CORE_DLL PyArrayObjectfunc_PyArray_NewFromDescr (const char *datadescr, int ndims, Py_intptr_t *dims)
 
MANTID_PYTHONINTERFACE_CORE_DLL PyArrayObjectfunc_PyArray_NewFromDescr (int datatype, int ndims, Py_intptr_t *dims)
 equivalent to macro PyArray_NewFromDescr More...
 
 INSTANTIATE_MATRIX_WRAP (double)
 
 INSTANTIATE_MATRIX_WRAP (float)
 
 INSTANTIATE_MATRIX_WRAP (int)
 
template<typename ContainerType >
PyObject * wrapWithNDArray (const ContainerType &cdata, const NumpyWrapMode mode)
 Defines the wrapWithNDArray specialization for Matrix container types. More...
 
template<typename ElementType >
PyObject * wrapWithNDArray (const ElementType *carray, const int ndims, Py_intptr_t *dims, const NumpyWrapMode mode, const OwnershipMode oMode)
 Defines the wrapWithNDArray specialization for C array types. More...
 

Function Documentation

◆ clone1D() [1/3]

template<>
MANTID_PYTHONINTERFACE_CORE_DLL PyObject * Mantid::PythonInterface::Converters::Impl::clone1D ( const std::vector< bool > &  cvector)

Specialisation for vector<bool> that stores the underlying data differently Returns a new numpy array with the a copy of the data vector of booleans.

Parameters
cvector:: A reference to the cvector to clone
Returns
The new cloned array

Definition at line 75 of file CloneToNDArray.cpp.

References clone1D(), and func_PyArray_NewFromDescr().

◆ clone1D() [2/3]

template<typename ElementType >
PyObject * Mantid::PythonInterface::Converters::Impl::clone1D ( const std::vector< ElementType > &  cvector)

Returns a new numpy array with the a copy of the data from 1D vector with the exception of string elements where a Python list is produced.

Parameters
cvector:: A reference to the cvector to clone
Returns
The new cloned array

Definition at line 42 of file CloneToNDArray.cpp.

References clone1D(), and cloneND().

Referenced by clone1D().

◆ clone1D() [3/3]

template<>
MANTID_PYTHONINTERFACE_CORE_DLL PyObject * Mantid::PythonInterface::Converters::Impl::clone1D ( const std::vector< Types::Core::DateAndTime > &  cvector)

Specialisation for vector<DateAndTime> that stores the underlying data differently Returns a new numpy array with the a copy of the data vector of np.datetime64.

Definition at line 52 of file CloneToNDArray.cpp.

References clone1D(), Mantid::PythonInterface::Converters::descr_ns(), and Mantid::PythonInterface::Converters::to_npy_datetime().

◆ cloneND() [1/2]

template<typename ElementType >
PyObject * Mantid::PythonInterface::Converters::Impl::cloneND ( const ElementType *  carray,
const int  ndims,
Py_intptr_t *  dims 
)

Returns a new numpy array with the a copy of the data from array.

A specialization exists for strings so that they simply create a standard python list.

Parameters
carray:: A reference to a carray
ndims:: The dimensionality of the array
dims:: The length of the arrays in each dimension
Returns

Definition at line 98 of file CloneToNDArray.cpp.

References cloneND(), and func_PyArray_NewFromDescr().

Referenced by clone1D(), and cloneND().

◆ cloneND() [2/2]

template<>
PyObject * Mantid::PythonInterface::Converters::Impl::cloneND ( const std::string *  carray,
const int  ndims,
Py_intptr_t *  dims 
)

Returns a new python list of strings from the given array of strings.

Parameters
carray:: A reference to a std::vector
ndims:: The dimensionality of the array
dims:: The length of the arrays in each dimension
Returns

Definition at line 123 of file CloneToNDArray.cpp.

References cloneND().

◆ func_PyArray_Descr()

PyArray_Descr * Mantid::PythonInterface::Converters::Impl::func_PyArray_Descr ( const char *  datadescr)

Definition at line 38 of file NumpyFunctions.cpp.

References func_PyArray_Descr().

Referenced by func_PyArray_Descr(), and func_PyArray_NewFromDescr().

◆ func_PyArray_IterNew()

PyObject * Mantid::PythonInterface::Converters::Impl::func_PyArray_IterNew ( PyArrayObject arr)

equivalent to macro PyArray_IterNew

Definition at line 17 of file NumpyFunctions.cpp.

◆ func_PyArray_NewFromDescr() [1/2]

PyArrayObject * Mantid::PythonInterface::Converters::Impl::func_PyArray_NewFromDescr ( const char *  datadescr,
int  ndims,
Py_intptr_t *  dims 
)

Definition at line 26 of file NumpyFunctions.cpp.

References func_PyArray_Descr().

◆ func_PyArray_NewFromDescr() [2/2]

PyArrayObject * Mantid::PythonInterface::Converters::Impl::func_PyArray_NewFromDescr ( int  datatype,
int  ndims,
Py_intptr_t *  dims 
)

equivalent to macro PyArray_NewFromDescr

Definition at line 19 of file NumpyFunctions.cpp.

Referenced by clone1D(), and cloneND().

◆ INSTANTIATE_MATRIX_WRAP() [1/3]

Mantid::PythonInterface::Converters::Impl::INSTANTIATE_MATRIX_WRAP ( double  )

◆ INSTANTIATE_MATRIX_WRAP() [2/3]

Mantid::PythonInterface::Converters::Impl::INSTANTIATE_MATRIX_WRAP ( float  )

◆ INSTANTIATE_MATRIX_WRAP() [3/3]

Mantid::PythonInterface::Converters::Impl::INSTANTIATE_MATRIX_WRAP ( int  )

◆ wrapWithNDArray() [1/2]

template<typename ContainerType >
PyObject * Mantid::PythonInterface::Converters::Impl::wrapWithNDArray ( const ContainerType &  cdata,
const NumpyWrapMode  mode 
)

Defines the wrapWithNDArray specialization for Matrix container types.

Wraps a vector in a numpy array structure without copying the data

Parameters
cdata:: A reference to the Matrix wrap
mode:: A mode switch to define whether the final array is read only/read-write
Returns
A pointer to a numpy ndarray object

Definition at line 30 of file MatrixToNDArray.cpp.

References Mantid::PythonInterface::Converters::ReadOnly.

◆ wrapWithNDArray() [2/2]

template<typename ElementType >
PyObject * Mantid::PythonInterface::Converters::Impl::wrapWithNDArray ( const ElementType *  carray,
const int  ndims,
Py_intptr_t *  dims,
const NumpyWrapMode  mode,
const OwnershipMode  oMode 
)

Defines the wrapWithNDArray specialization for C array types.

Wraps an array in a numpy array structure without copying the data

Parameters
carray:: A pointer to the HEAD of the array
ndims:: The dimensionality of the array
dims:: The length of the arrays in each dimension
mode:: A mode switch to define whether the final array is read only/read-write
oMode:: A mode switch defining whether to transfer ownership of the returned array to python
Returns
A pointer to a numpy ndarray object

Definition at line 79 of file WrapWithNDArray.cpp.

References Mantid::PythonInterface::Converters::Python, Mantid::PythonInterface::Converters::ReadOnly, and wrapWithNDArray().

Referenced by Mantid::PythonInterface::Converters::WrapReadOnly::apply< ElementType >::createFromArray(), Mantid::PythonInterface::Converters::WrapReadWrite::apply< ElementType >::createFromArray(), wrapMeshWithNDArray(), and wrapWithNDArray().