Re: [Numpy-discussion] lazy loading ndarrays

2011-07-26 Thread Nadav Horesh
Yoshioka [crai...@me.com] Sent: 27 July 2011 05:41 To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] lazy loading ndarrays ok, that was an alternative strategy I was going to try... but not my favorite as I'd have to explicitly perform all operations on the data portion of the o

Re: [Numpy-discussion] lazy loading ndarrays

2011-07-26 Thread Craig Yoshioka
ok, that was an alternative strategy I was going to try... but not my favorite as I'd have to explicitly perform all operations on the data portion of the object, and given numpy's mechanics, assignment would also have to be explicit, and creating new image objects implicitly would be trickier:

Re: [Numpy-discussion] lazy loading ndarrays

2011-07-26 Thread Joe Kington
Similar to what Matthew said, I often find that it's cleaner to make a seperate class with a "data" (or somesuch) property that lazily loads the numpy array. For example, something like: class DataFormat(object): def __init__(self, filename): self.filename = filename for key,

Re: [Numpy-discussion] lazy loading ndarrays

2011-07-26 Thread Matthew Brett
Hi, On Tue, Jul 26, 2011 at 5:11 PM, Craig Yoshioka wrote: > I want to subclass ndarray to create a class for image and volume data, and > when referencing a file I'd like to have it load the data only when accessed. >  That way the class can be used to quickly set and manipulate header values,

[Numpy-discussion] lazy loading ndarrays

2011-07-26 Thread Craig Yoshioka
I want to subclass ndarray to create a class for image and volume data, and when referencing a file I'd like to have it load the data only when accessed. That way the class can be used to quickly set and manipulate header values, and won't load data unless necessary. What is the best way to do