Re: [Numpy-discussion] numpy CAPI questions

2008-10-20 Thread Robert Kern
On Mon, Oct 20, 2008 at 16:13, Lane Brooks <[EMAIL PROTECTED]> wrote: > Thanks for all this valuable feedback. I read your blog post and like the > idea but not the overhead. I guess my initial approach of doing a memory > handoff to the numpy Array was a bit naive. It seems to be working, but I

Re: [Numpy-discussion] numpy CAPI questions

2008-10-20 Thread Lane Brooks
Travis E. Oliphant wrote: Lane Brooks wrote: I am using the numpy CAPI to write an extension module that returns a numpy Array from an imaging data source. I collect the image into a buffer that I allocate. I then create numpy Array using the PyArray_New(..) function and pass it the buffer

Re: [Numpy-discussion] numpy CAPI questions

2008-10-20 Thread Travis E. Oliphant
Lane Brooks wrote: > I am using the numpy CAPI to write an extension module that returns a > numpy Array from an imaging data source. I collect the image into a > buffer that I allocate. I then create numpy Array using the > PyArray_New(..) function and pass it the buffer. I then set the > NP

Re: [Numpy-discussion] numpy CAPI questions

2008-10-19 Thread David Cournapeau
On Mon, Oct 20, 2008 at 6:52 AM, Lane Brooks <[EMAIL PROTECTED]> wrote: > > > Thanks for the great tip on sys.getrefcount(). I understand reference > counting a whole lot better now after playing with sys.getrefcount() > function. For debugging purpose, and if you need it in C, you can use the me

Re: [Numpy-discussion] numpy CAPI questions

2008-10-19 Thread Lane Brooks
Robert Kern wrote: On Sun, Oct 19, 2008 at 14:28, Lane Brooks <[EMAIL PROTECTED]> wrote: 2. Is my reference counting correct? Do I need to call the PyArray_INCREF() on img? Personally, I always need to double-check my refcounting with sys.getrefcount() (which, it should be noted, adds

Re: [Numpy-discussion] numpy CAPI questions

2008-10-19 Thread Robert Kern
On Sun, Oct 19, 2008 at 14:28, Lane Brooks <[EMAIL PROTECTED]> wrote: > I am using the numpy CAPI to write an extension module that returns a > numpy Array from an imaging data source. I collect the image into a > buffer that I allocate. I then create numpy Array using the > PyArray_New(..) functi

[Numpy-discussion] numpy CAPI questions

2008-10-19 Thread Lane Brooks
I am using the numpy CAPI to write an extension module that returns a numpy Array from an imaging data source. I collect the image into a buffer that I allocate. I then create numpy Array using the PyArray_New(..) function and pass it the buffer. I then set the NPY_OWNDATA flag on the Array b