[Numpy-discussion] does an ndarray have a "hook" for a dictionary attribute ?

Sebastian Haase seb.haase@gmail....
Thu Nov 12 03:47:18 CST 2009


On Thu, Nov 12, 2009 at 10:38 AM, Sebastian Haase <seb.haase@gmail.com> wrote:
> Hi,
>
> I hope my subject line is not entirely incomprehensible:
> I remember there was a discussion (some time ago) that every ndarray
> instance should get an extra dictionary (or just a "hook" for it, to
> minimize the memory foot print) for "application specific" /
> "auxiliary" data.
> What is the current state on this ?
>
> The issue at hand is, that my image analysis development platform
> supports various file types by now, and I usually load images straight
> into an ndarray (e.g. using PIL for standard types).
> This is fine for most needs depending only on the pixel values.
> However, now I would like to save images back after performing some
> operation on it.
> So it would be nice if I could "attach" the original filename to the
> respective ndarray.
> Is this possible with standard ndarray (using the mentioned dictionary
> attribute)
> or
> do I need to subclass ndarray to make such a ndarray_with_dict
> ?
>
> (For the latter it would be very helpful to get a hint on how to make
> such a "minimal" ndarray-subclass . I remember some issues involving
> some special __new__ methods, that I don't entirely remember by
> heard..)
>
I found the thread I was thinking of in the archive:
http://www.mail-archive.com/numpy-discussion@scipy.org/msg11898.html

However, what was the outcome ... ?


Sebastian Haase


More information about the NumPy-Discussion mailing list