access ndarray on python side

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrmsbarnes
    New Member
    • Aug 2014
    • 1

    access ndarray on python side

    A previously closed question at

    export an array of floats to python

    concludes with sturlamolden saying, "Now return myarray and be happy." and Peter Wuertz saying, "Thank you! Thats the complete solution *g*"

    This is all good. But I am stuck on the python side where I want to see the array.

    I have a c shared library function like
    Code:
    PyObject *theArray(void)
    {
        return PyArray_SimpleNewFromData(1, dims, NPY_DOUBLE, void* data);
    }
    On the python side I load this library and get this pointer
    Code:
    thing = mylib.theArray
    print thing
    thing looks like a _FuncPtr object. What I can't find (bad googler I guess) is a simple example of seeing or indexing the array elements in my python script. Can anyone show or ref python code that shows how the array is accessed?
Working...