casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
PycArrayComH.h File Reference

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...
 

Function Documentation

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().

Bool canImport ( )
inline

Definition at line 34 of file PycArrayComH.h.

References casacore::True.

Bool importArray ( )

Referenced by 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.

References PYC_USE_PYARRAY.

Referenced by casacore::python::PycArrayCheck().

void loadAPI ( )

Definition at line 54 of file PycArrayComCC.h.

References importArray(), and PYC_USE_PYARRAY.

Referenced by casacore::python::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 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, casa::dbus::object(), PycArrayCheck(), and ArrayCopy< T >::toArray().

template<typename T >
boost::python::object makePyArrayObject ( casacore::Array< T > const &  arr)

Convert a Casacore array to a Python array object.

Bool PycArrayCheck ( PyObject *  obj_ptr)

Check if the PyObject is an array object.

Definition at line 35 of file PycArrayComCC.h.

Referenced by makeArray().