[Numpy-discussion] PEP: named axis

Ryan May rmay31 at gmail.com
Fri Feb 6 16:56:32 EST 2009


On Fri, Feb 6, 2009 at 3:30 PM, Robert Kern <robert.kern at gmail.com> wrote:

> On Fri, Feb 6, 2009 at 03:22, Stéfan van der Walt <stefan at sun.ac.za>
> wrote:
> > Hi Robert
> >
> > 2009/2/6 Robert Kern <robert.kern at gmail.com>:
> >>> This could be implemented but would require adding information to the
> >>> NumPy array.
> >>
> >> More than that, though. Every function and method that takes an axis
> >> or reduces an axis will need to be rewritten. For that reason, I'm -1
> >> on the proposal.
> >
> > Are you -1 on the array dictionary, or on using it to do axis mapping?
>
> I'm -1 on rewriting every axis= argument to accept strings. I'm +1 on
> a generic metadata dict that does not implicitly propagate.
>
> >  I would imagine that Gael would be happier even if he had to do
> >
> > axis = x.meta.axis['Lateral']
> > some_func(x, axis)
>
> That's fine with me.
>
> >> I'm of the opinion that it should never guess. We have no idea what
> >> semantics are being placed on the dict. Even in the case where all of
> >> the inputs have the same dict, the operation may easily invalidate the
> >> metadata. For example, a reduction on one of these axis-decorated
> >> arrays would make the axis labels incorrect.
> >
> > That's a good point.  So what would be a sane way of propagating
> > meta-data?  If we don't want to make any assumptions, it becomes the
> > user's responsibility to do it manually.
>
> I don't think there is *any* sane way of numpy propagating the user's
> metadata. The user must be the one to do it.
>

I'm +1 on all of what Robert said.  I've considered writing a
subclass/wrapping just so I can make metadata available while passing around
recarrays.  It'd save me a bunch of work.  I don't think there's anything
wrong with making the user propagate the dictionary.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090206/52b8c4d9/attachment.html>


More information about the NumPy-Discussion mailing list