Re: [Numpy-discussion] PyArray_BASE equivalent in python

2013-11-27 Thread Peter Rennert
First, sorry for not responding to your other replies, there was a jam in Thunderbird and I did not receive your answers. The bits() seem to stay alive after deleting the image: from PySide import QtGui image = QtGui.QImage('/home/peter/code/pyTools/sandbox/images/faceDemo.jpg') a =

Re: [Numpy-discussion] PyArray_BASE equivalent in python

2013-11-27 Thread Robert Kern
On Wed, Nov 27, 2013 at 2:16 PM, Peter Rennert p.renn...@cs.ucl.ac.uk wrote: As a solution I have done something similar as it was proposed earlier, just that I derived from ndarray and kept the QImage reference it it: from PySide import QtGui as _qt import numpy as _np class

[Numpy-discussion] PyArray_BASE equivalent in python

2013-11-26 Thread Peter Rennert
Hi, I as the title says, I am looking for a way to set in python the base of an ndarray to an object. Use case is porting qimage2ndarray to PySide where I want to do something like: In [1]: from PySide import QtGui In [2]: image =

Re: [Numpy-discussion] PyArray_BASE equivalent in python

2013-11-26 Thread Nathaniel Smith
On Tue, Nov 26, 2013 at 11:54 AM, Peter Rennert p.renn...@cs.ucl.ac.uk wrote: Hi, I as the title says, I am looking for a way to set in python the base of an ndarray to an object. Use case is porting qimage2ndarray to PySide where I want to do something like: In [1]: from PySide import

Re: [Numpy-discussion] PyArray_BASE equivalent in python

2013-11-26 Thread Peter Rennert
Brilliant thanks, I will try out the little class approach. On 11/26/2013 08:03 PM, Nathaniel Smith wrote: On Tue, Nov 26, 2013 at 11:54 AM, Peter Rennert p.renn...@cs.ucl.ac.uk wrote: Hi, I as the title says, I am looking for a way to set in python the base of an ndarray to an object.

Re: [Numpy-discussion] PyArray_BASE equivalent in python

2013-11-26 Thread Peter Rennert
I probably did something wrong, but it does not work how I tried it. I am not sure if you meant it like this, but I tried to subclass from ndarray first, but then I do not have access to __array_interface__. Is this what you had in mind? from PySide import QtGui import numpy as np class

Re: [Numpy-discussion] PyArray_BASE equivalent in python

2013-11-26 Thread Robert Kern
On Tue, Nov 26, 2013 at 9:37 PM, Peter Rennert p.renn...@cs.ucl.ac.uk wrote: I probably did something wrong, but it does not work how I tried it. I am not sure if you meant it like this, but I tried to subclass from ndarray first, but then I do not have access to __array_interface__. Is this

Re: [Numpy-discussion] PyArray_BASE equivalent in python

2013-11-26 Thread Nathaniel Smith
On Tue, Nov 26, 2013 at 1:37 PM, Peter Rennert p.renn...@cs.ucl.ac.uk wrote: I probably did something wrong, but it does not work how I tried it. I am not sure if you meant it like this, but I tried to subclass from ndarray first, but then I do not have access to __array_interface__. Is this

Re: [Numpy-discussion] PyArray_BASE equivalent in python

2013-11-26 Thread Peter Rennert
Btw, I just wanted to file a bug at PySide, but it might be alright at their end, because I can do this: from PySide import QtGui image = QtGui.QImage('/home/peter/code/pyTools/sandbox/images/faceDemo.jpg') a = image.bits() del image a #read-write buffer ptr 0x7f5fe0034010, size 1478400 at

Re: [Numpy-discussion] PyArray_BASE equivalent in python

2013-11-26 Thread Nathaniel Smith
On Tue, Nov 26, 2013 at 2:55 PM, Peter Rennert p.renn...@cs.ucl.ac.uk wrote: Btw, I just wanted to file a bug at PySide, but it might be alright at their end, because I can do this: from PySide import QtGui image = QtGui.QImage('/home/peter/code/pyTools/sandbox/images/faceDemo.jpg') a =