[Numpy-discussion] _import_array()

2012-02-14 Thread Mads Ipsen
Hi, I have C++ module (OpenGL) that extracts data from numpy arrays. The interface is pure read-only: It never returns any Python objects but only extracts data from numpy arrays. Eg: #include numpy/arrayobject.h void PrimitiveManager::deleteAtoms(PyObject * numpy_indices) { // Extract

Re: [Numpy-discussion] _import_array()

2012-02-14 Thread Travis Oliphant
Technically, when you write an extension module you really should use import_array(); in the init method of the extensions module. This ensures that the C-API is loaded so that the API -table is available if your C++ code uses the C-API at all. In this case you are just using some #defines

Re: [Numpy-discussion] _import_array()

2012-02-14 Thread Mads Ipsen
Hi, The C++ module here is a class that's used by an OpenGL window, to extract data from numpy arrays and basically draw molecules whose coordinates are stored in numpy arrays. The C++ module is accessed from Python using wrappers generated by swig. Our application may contain many active

Re: [Numpy-discussion] _import_array()

2012-02-14 Thread Pauli Virtanen
14.02.2012 10:20, Mads Ipsen kirjoitti: [clip] * Should import_array() only be called one time, namely when the main application is started? It should be called once when the application is started, before you do any other Numpy-using operations.

Re: [Numpy-discussion] _import_array()

2012-02-14 Thread Robert Kern
On Tue, Feb 14, 2012 at 09:30, Pauli Virtanen p...@iki.fi wrote: 14.02.2012 10:20, Mads Ipsen kirjoitti: [clip] * Should import_array() only be called one time, namely when the main application is started? It should be called once when the application is started, before you do any other

Re: [Numpy-discussion] _import_array()

2012-02-14 Thread Mads Ipsen
On 14/02/2012 10:30, Pauli Virtanen wrote: 14.02.2012 10:20, Mads Ipsen kirjoitti: [clip] * Should import_array() only be called one time, namely when the main application is started? It should be called once when the application is started, before you do any other Numpy-using operations.