[Numpy-discussion] Masking through generator arrays
travis at continuum.io
Thu May 10 15:29:53 EDT 2012
On May 10, 2012, at 1:23 PM, Chris Barker wrote:
> On Thu, May 10, 2012 at 2:38 AM, Dag Sverre Seljebotn
> <d.s.seljebotn at astro.uio.no> wrote:
>> What would serve me? I use NumPy as a glorified "double*".
>> all I want is my glorified
>> "double*". I'm probably not a representative user.)
> Actually, I think you are representative of a LOT of users -- it
> turns, out, whether Jim Huginin originally was thinking this way or
> not, but numpy arrays are really powerful because the provide BOTH and
> nifty, full featured array object in Python, AND a wrapper around a
> generic "double*" (actually char*, that could be any type).
> This is are really widely used feature, and has become even more so
> with Cython's numpy support.
> That is one of my concerns about the "bit pattern" idea -- we've then
> created a new binary type that no other standard software understands
> -- that looks like a a lot of work to me to deal with, or even worse,
> ripe for weird, non-obvious errors in code that access that good-old
This needs to be clarified, the point of the "bit pattern" idea is that the downstream user would have to actually *request* data in that format or they would get an error. You would not get it by "accident". If you asked for an array of floats you would get an array of floats (not an array of NA-floats).
R has *already* created this binary type and we are just including the ability to understand it in NumPy.
This is why it is an easy thing to do without changing the structure of what a NumPy array *is*. Adding the concept of a mask to *every* NumPy array (even NumPy arrays that are currently being used in the wild to represent masks) is the big change that I don't think should happen.
More information about the NumPy-Discussion