[Numpy-discussion] 1.1.0rc1 RuntimeErrors
Wed May 21 18:56:23 CDT 2008
On Wednesday 21 May 2008 17:57:30 Charles R Harris wrote:
> On Wed, May 21, 2008 at 3:10 PM, Charles R Harris
> > On Wed, May 21, 2008 at 2:39 PM, Charles R Harris <
> > email@example.com> wrote:
> >> On Wed, May 21, 2008 at 10:07 AM, Alan McIntyre
> >> <firstname.lastname@example.org>
> >> wrote:
> >>> On Wed, May 21, 2008 at 11:56 AM, Pierre GM <email@example.com>
> >>> wrote:
> >>> > On Wednesday 21 May 2008 11:39:32 Alan McIntyre wrote:
> >>> >> There's some commentary and a patch on NumPy ticket 793 on this
> >>> >> issue:
> >>> >>
> >>> >> http://scipy.org/scipy/numpy/ticket/793
> >>> >
> >>> > OK, thanks a lot ! That's a C problem, then...
> >>> It's probably worth mentioning that I'm not that familiar with all the
> >>> innards of NumPy yet, so take my comments and patch on that issue with
> >>> a (fairly large) grain of salt. ;)
> >> This was introduced by Travis in r5138 as part of the matrix changes.
> > Alan's change looks a bit iffy to me because the looser check would pass
> > things like matrices and there would be no check for decreasing
> > dimensions to throw an error. So I think the safest thing for 1.1 is to
> > back out Travis' change and rethink this for 1.2.
> > Chuck
> I backed out r5138 and, with a few test fixes, everything passes. However,
> there is now a warning exposed in the masked array tests:
> /usr/lib/python2.5/site-packages/numpy/ma/core.py:1357: UserWarning:
> MaskedArray.__setitem__ on fields: The mask is NOT affected!
> warnings.warn("MaskedArray.__setitem__ on fields: "
Well, that's a warning all right, not an error.
With "exotic" dtypes (understand, not int,bool,float or complex but named
fields), setting a field doesn't affect the mask, hence the warning.
The reason behind this behavior is that the mask of a MaskedArray is only a
boolean-array: you have (at most) one boolean per element/record. Therefore,
you can mask/unmask a full record, but not a specific field. Masking
particular fields is possible with MaskedRecords, however, but with an
overhead that wasn't worth putting in MaskedArray.
Because I've been bitten a couple of times by this mechanism, I figured that a
warning would be the easiest way to remember that MaskedArrays don't handle
records very well.
So, nothing to worry about.
More information about the Numpy-discussion