[Numpy-discussion] bug with with fill_values in masked arrays?

Pierre GM pgmdevlist@gmail....
Wed Mar 26 15:40:12 CDT 2008

On Wednesday 26 March 2008 15:42:41 Chris Withers wrote:
> Pierre GM wrote:
> > My bad, I neglected an overall doc for the functions and their docstring.
> > But you know what ? As you're now at an intermediary level,
> That's pretty unkind to your userbase. I know a lot about python, but
> I'm a total novice with numpy and even the maths it's based on.

My bosses have different priorities and keep on recalling me that spending 
time writing Python code is not what I was hired to do, and that should be 
writing scientific papers by the dozen. Let's say that I'm just playing 
middle ground to the best of my capacities. And time.

> > help: just write down the problems you encountered, and the solutions you
> > came up with, so that we could use your experience as the backbone for a
> > proper MaskedArray documentation
> Blind leading the blind seems like a terrible idea to me...

You're no longer a complete neophyte, so you're not that blind, but are still 
experiencing the tough part of the learning curve. I took things for granted 
nowadays (for example, dtypes) that are not obvious for the absolute 
beginners, that's exactly where you can play your role: remind me what it is 
to be blind so that I can help you more, start some simple doc pages on the 
wiki that the community can edit/append.

> NaN/inf is still NaN in my books, so why would I be surprised by this?

Because with a regular ndarray with no NaNs initially, you could end up with 
NaNs and Infs with some operations. With MaskedArray, you don't.

> >> I'd argue that the masked singleton having a different fill value to the
> >> ma it comes from is a bug.
> >
> > "It's not a bug, it's a feature"TM
> One which sucks and is unintuitive.

I can understand the unintuitive part to a certain extent, I won't comment on 
the first aspect however, you know, tastes, colors, snails, oysters, that 
kind of thing. On top of that, I could kick into touch and say that it's 
needed for backwards compatibility.

>  >>> x[-1] = Masked(fill_value=50)
>  >>> isinstance(x[-1],Masked)
> True
> ...which gives you what you want without forcing me to experience the
> resultant suck.

Yeah, that's a possibility. Feel free to implement it so that we can compare 
the two approaches. I still don understand why you really need to have a 
particular fill_value for the masked constant anyway: what are you trying to 
do exactly ?

More information about the Numpy-discussion mailing list