casacore
Classes | Functions
PycArrayComCC.h File Reference

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< casacore::Char >
 This one is only used to convert numpy BYTE and SBYTE to casa short. More...
 

Functions

Bool PycArrayCheck (PyObject *obj_ptr)
 A class to convert an Array to/from Python objects. 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)
 

Function Documentation

§ isImported()

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 42 of file PycArrayComCC.h.

References PYC_USE_PYARRAY.

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

§ loadAPI()

void loadAPI ( )

Definition at line 52 of file PycArrayComCC.h.

References importArray(), and PYC_USE_PYARRAY.

Referenced by canImport(), and casacore::python::numpy::PycArrayCheck().

§ makeArray()

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.

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 276 of file PycArrayComCC.h.

References AlwaysAssert, ArrayCopyStr_toArray(), casacore::False, makePyArrayObject(), PycArrayCheck(), and ArrayCopy< T >::toArray().

Referenced by canImport().

§ makePyArrayObject() [1/11]

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

Referenced by makeArray().

§ makePyArrayObject() [2/11]

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

§ makePyArrayObject() [3/11]

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

§ makePyArrayObject() [4/11]

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

§ makePyArrayObject() [5/11]

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

§ makePyArrayObject() [6/11]

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

§ makePyArrayObject() [7/11]

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

§ makePyArrayObject() [8/11]

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

§ makePyArrayObject() [9/11]

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

§ makePyArrayObject() [10/11]

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

§ makePyArrayObject() [11/11]

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