On 09/18/2011 09:54 AM, John Hunter wrote: >> putmask was deprecated in favor of copyto only 2 months ago; copyto >> didn't even exist before that. So we certainly can't replace putmask >> with copyto in mpl. >> >> http://currents.soest.hawaii.edu/hgstage/numpy_from_git/rev/26533521322b > > > The putmasks in colors.py are simple and could be replaced by a simple > boolean, mask eg replace > > np.putmask(xa, xa==1.0, 0.9999999) #Treat 1.0 as slightly less than 1. > > with > > xa[xa==1.0] = 0.9999999 #Treat 1.0 as slightly less than 1. > > In quiver.py, there appear to be some broadcasting shape issues that > make this trickier, eg in > > short = np.repeat(length< minsh, 8, axis=1) > # Now select X0, Y0 if short, otherwise X, Y > np.putmask(X, short, X0) > > Since much of quiver.py is your code I believe Eric, maybe you can > come up with something that doesn't rely on putmasking and just uses > plain vanilla boolean arrays of the right shape?
I really don't want to mess with this now; putmask was used because it is *much* faster than boolean indexing (after I supplied the fast_putmask code to numpy back in 2007). And I did that because it removed a genuine, significant bottleneck in mpl. Now, with Mark Wiebe's modifications to numpy, putmask is obsolete. His copyto is as fast, and boolean indexing might even be good enough now. But the next mpl release is not targeted at numpy 2.0. It will be used with older versions as well, and probably most often. We will need to deal with the deprecation of putmask, but this is not the time to do it, unless there is a way to do it that does *not* change the present actual *use* of putmask, but merely tells numpy to shut up about it. I don't know why it is complaining; I don't think that it is normal procedure to start issuing warnings the minute a replacement (copyto) appears. We are trying to get a release out without introducing major breakage. It is a bad time to muck around with internals like the use of putmask. Eric > > JDH ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel