Hi,

Based on the response I got from the MPL list (below) it seems that my
pylab/MA is actually behaving as expected. 

MA as a subclass of regular arrays sound like a great idea (see below)!

Thanks, 

Teemu




---------- Forwarded Message ----------
Date: maanantai 27. marraskuu 2006 14:48 -0500
From: Pierre GM <[EMAIL PROTECTED]>
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] pylab/masked arrays issue on Intel Mac Pro

When you type from MA import *, you overwrite the definition of 'array'.
And  surprisingly enough, a masked array  in numpy.core.ma is an object 
independent of ndarray. Some functions such as swapaxes are not imported by 
MA (because they were not implemented for one reason or another): you then 
use the regular numpy function, which doesn't know how to deal with these 
'masked arrays' objects. (I simplify a bit, here, but the gist is there)

As you've noticed, the best solution is to use
import MA. That way, you leave the original numpy namespace alone, and are
sure to use only "MA-approved" functions. But you'll likely gonna have to
use MA.sqrt, 
MA.log all over your code. And may run into problems with functions that 
don't handle masked arrays. Still, it's the cleanest solution (the "from
blah  import *" tend to be frowned upon these days anyway).

An alternative solution is to try the new implementation of masked arrays
I've  been working on: with this implementation, masked arrays are
subclasses of  regular arrays, which simplifies life a lot.The source file
is available  here:
http://projects.scipy.org/scipy/numpy/wiki/MaskedArray
Note the disclaimer: it's still a work in progress (even if I use it
everyday  and it works fine) and you'll have to modify a line in the
matplotlib source  to make it work OK with matplotlib, which is a bit
tedious I agree. But it  works. And it's actively maintained.

Hope it helps
P.

---------- End Forwarded Message ----------




--On maanantai 27. marraskuu 2006 09:39 -0800 Christopher Barker
<[EMAIL PROTECTED]> wrote:

> Teemu Rinne wrote:
> 
>> To my great surprise, I managed to compile scipy on Intel Mac Pro without
>> too much trouble (sorting out gcc and python versions and missing fortran
>> took awhile).  My collection of packages seems to work now
> 
> Is it a Universal build? WE really do need to get a complete set of
> up-to-date:
> 
> numpy
> matplotlib
> scipy
> 
> that all work together.
> 
>> but there still
>> remains one (minor) issue with masked arrays. 
> 
> This looks like an MPL bug to me -- have you tested on other platforms?
> I'd post to the MPL list.
> 
> -Chris
> 
> 
> -- 
> Christopher Barker, Ph.D.
> Oceanographer
> 
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
> 
> [EMAIL PROTECTED]


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to