John Hunter wrote: > On Mon, Jul 21, 2008 at 3:12 AM, Klaus Zimmermann > <[EMAIL PROTECTED]> wrote: >> Hello *, >> >> right now the NonUniformImage class in image.py uses numpy's asarray >> method. All similar classes instead use numpy.ma.asarray, thus allowing >> for masked images. >> I think this should be changed as in the attached patch. >> >> Otherwise thanks for matplotlib :) > > Eric, could you take a look at this? Although the patch is trivial, I > just want to make sure that the image extension code will do the right > thing if a masked array gets passed into it. I d not see any special > handling in _image.pcolor so am not sure what happens when a masked > array gets passed in. > > JDH
John, Klaus, We already were using masked arrays for some image types even when we did not need to do so (and when it was inappropriate), in which case the mask was ignored. Masked arrays are handled automatically as needed by the ScalarMappable.to_rgba() method. What we really wanted, and the change I made throughout image.py, is to keep masked input as masked, and to ensure that anything else is a plain ndarray. This is now committed. I considered using np.asanyarray(A) but rejected it because it could fail for matrix input if any code is expecting iteration or single-indexing to return a 1-D array. We lack examples to test masking of various types of input in the various types of image, though. Maybe I will add that later. Klaus, if you have any nice, small examples you would like to add to the mpl examples directory, that illustrate features or use cases that are not exercised in any present examples, please submit them. Eric ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel