casacore
|
#include <boost/python.hpp>
#include <numpy/arrayobject.h>
Go to the source code of this file.
Classes | |
struct | TypeConvTraits< T > |
struct | TypeConvTraits< casacore::Bool > |
struct | TypeConvTraits< casacore::uChar > |
struct | TypeConvTraits< casacore::Short > |
struct | TypeConvTraits< casacore::uShort > |
struct | TypeConvTraits< casacore::Int > |
struct | TypeConvTraits< casacore::uInt > |
struct | TypeConvTraits< casacore::Int64 > |
struct | TypeConvTraits< casacore::uInt64 > |
struct | TypeConvTraits< casacore::Float > |
struct | TypeConvTraits< casacore::Double > |
struct | TypeConvTraits< casacore::Complex > |
struct | TypeConvTraits< casacore::DComplex > |
struct | TypeConvTraits< casacore::String > |
struct | TypeConvTraits< signed char > |
This one is only used to convert numpy BYTE and SBYTE to casa short. More... | |
Functions | |
Bool | PycArrayCheck (PyObject *obj_ptr) |
Check if the PyObject is an array object. More... | |
Bool | isImported () |
Check if the API is or can be imported. More... | |
void | loadAPI () |
ValueHolder | makeArray (PyObject *obj_ptr, Bool copyData) |
Convert the python array to a Casacore array in the ValueHolder. More... | |
template boost::python::object | makePyArrayObject (casacore::Array< Bool > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< uChar > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< Short > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< uShort > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< Int > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< uInt > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< Int64 > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< Float > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< Double > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< Complex > const &arr) |
template boost::python::object | makePyArrayObject (casacore::Array< DComplex > const &arr) |
Bool isImported | ( | ) |
Check if the API is or can be imported.
PySys_GetObject uses char* instead of const char*, so use a cast.
Definition at line 44 of file PycArrayComCC.h.
References PYC_USE_PYARRAY.
Referenced by PycArrayCheck().
void loadAPI | ( | ) |
Definition at line 54 of file PycArrayComCC.h.
References importArray(), and PYC_USE_PYARRAY.
Referenced by PycArrayCheck().
ValueHolder makeArray | ( | PyObject * | obj_ptr, |
Bool | copyData | ||
) |
Convert the python array to a Casacore array in the ValueHolder.
If copyData is True, the array data is always copied. Otherwise only if needed.
incr refcount, because ~object decrements it
Swap axes, because Casacore has row minor and Python row major order. A scalar is treated as a vector with length 1.
Assert array is contiguous now. If the array is empty, numarray still sees it as non-contiguous.
&& PyArray_ISALIGNED(po) fails on MIPS (see issue 531)
Create the correct array.
Some types can be the same as other types, so they cannot be used in the switch (compiler complains). This is true for BYTE and SBYTE which can equal to BOOL in numarray. Similarly for STRING which exists for numpy and is set to INT for numarray.
Copy using signed char, because uChar is mapped to Short in the Traits.
Definition at line 278 of file PycArrayComCC.h.
References AlwaysAssert, ArrayCopyStr_toArray(), ArrayCopyUnicode_toArray(), casacore::False, PycArrayCheck(), and ArrayCopy< T >::toArray().
template boost::python::object makePyArrayObject | ( | casacore::Array< Bool > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< Complex > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< DComplex > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< Double > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< Float > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< Int > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< Int64 > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< Short > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< uChar > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< uInt > const & | arr | ) |
template boost::python::object makePyArrayObject | ( | casacore::Array< uShort > const & | arr | ) |
Bool PycArrayCheck | ( | PyObject * | obj_ptr | ) |
Check if the PyObject is an array object.
Definition at line 35 of file PycArrayComCC.h.
References casacore::False, isImported(), and loadAPI().
Referenced by makeArray().