[SciPy-dev] Subclassed ndarray fails with ValueError when assigning to a sliced array
Christoph T. Weidemann
Mon Feb 23 10:44:41 CST 2009
Per, who created ticket 1023 tried to send the following message to
the mailing list, but it bounced, so I am resending it on his behalf.
Someone mentioned that I should send an email to the mailing list when
reporting a bug / issue, so here's the repeat of a new ticket I just
I've been working on a subclass of ndarray that has named dimensions
that you can use to slice within a custom __getitem__. For example,
you can do something like this:
to slice the array where the time dimension is greater than zero.
This is all working nicely, right up until I try to assign to a slice like this:
x['time>0'] += 1
x['time>0'] = x['time>0'] + 1
giving me the following error:
ValueError: field named time>0 not found.
I'm not sure what is raising this error (the interpreter gives no
module or line number that's raising it), so I'm scared it's actually
in the interpreter or somewhere deep in the numpy code, but I figured
I'd try here first.
Any ideas for what's going on here? All assignments with standard
slices work just fine. Is there some code in numpy that is checking
the contents of __getitem__ and causing it to fail here?
Thanks for any thoughts,
PS-> I'm running this on NumPy? 1.1.0 in Debian Lenny.
More information about the Scipy-dev