|
From: Klaus Z. <kla...@fm...> - 2008-07-21 21:42:59
|
Eric Firing schrieb: > John Hunter wrote: >> On Mon, Jul 21, 2008 at 3:12 AM, Klaus Zimmermann >> <kla...@fm...> 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. [...] > 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 just checked and I think your changes solve my problem well, obviously without introducing the potential problems you mentioned above. Thanks! I was just confused by the different semantics: AxesImage : does masks, NxM array expects N, M dimensions. NonUniformImage : didn't do masks, NxM array expects N, M dimensions. PcolorImage: does masks, NxM array expects N+1, M+1 dimensions. Though I think the mask thingie in the NonUniformImage was simply a bug and I understand why PcolorImage is the way it is, it still stumped me at first sight. Also I find it difficult to understand the difference Pcolor and NonUniform since NonUniform does pseudo colors just as well? However if you feel this is just a lack of RTFM on my part please feel free to ignore. > 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. Makes sense. But perhaps we should refactor that check into a (module) function of its own, as to avoid recundancy? I can do that if you want, or if you prefer a classmethod in AxesImage? > 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. Will do. Cheers, Klaus |