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?
>
> JDH

John,

There is a way to deal with this now: define our own copyto which uses 
np.copyto if it exists, and falls back on putnav otherwise.  I think 
this can be done with reasonable safety and no loss of performance.  The 
only question is where to put our copyto.  I think a new compat.py would 
make sense as a home for this sort of version compatibility interface 
code.  We may need a lot more in the future as numpy evolves.

Eric

------------------------------------------------------------------------------
BlackBerry&reg; 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

Reply via email to