casacore
|
Go to the source code of this file.
Classes | |
struct | ArrayCopy< T > |
Copy/convert the array data as needed. More... | |
struct | ArrayCopy< Complex > |
struct | ArrayCopy< DComplex > |
struct | ArrayCopy< String > |
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... | |
Bool | canImport () |
Bool | importArray () |
void | loadAPI () |
ValueHolder | makeArray (PyObject *obj_ptr, Bool copyData) |
Convert the python array to a Casacore array in the ValueHolder. More... | |
Array< String > | ArrayCopyStr_toArray (const IPosition &shape, void *data, size_t slen) |
Array< String > | ArrayCopyUnicode_toArray (const IPosition &shape, void *data, size_t slen) |
template<typename T > | |
boost::python::object | makePyArrayObject (casacore::Array< T > const &arr) |
Convert a Casacore array to a Python array object. More... | |
Array<String> ArrayCopyStr_toArray | ( | const IPosition & | shape, |
void * | data, | ||
size_t | slen | ||
) |
Referenced by makeArray().
Array<String> ArrayCopyUnicode_toArray | ( | const IPosition & | shape, |
void * | data, | ||
size_t | slen | ||
) |
Referenced by makeArray().
|
inline |
Definition at line 34 of file PycArrayComH.h.
References casacore::True.
Bool importArray | ( | ) |
Referenced by casacore::python::numpy::loadAPI().
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.
void loadAPI | ( | ) |
Definition at line 54 of file PycArrayComCC.h.
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 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, casacore::python::PycArrayCheck(), and ArrayCopy< T >::toArray().
boost::python::object makePyArrayObject | ( | casacore::Array< T > const & | arr | ) |
Convert a Casacore array to a Python array object.