John,
One small note - we've been bitten in the past by doing:
    x != 0

This assumes a numeric (int/float) quantity.  If someone substitutes 
a different type that looks like a number, this will most likely 
fail.  Python has a __nonzero__ method which can be used by calling 
'not' or 'bool()':
    not x == ! bool( x )

All the numeric types implement this correctly (i.e. like a test for 
x == 0).  Of course, I haven't been following this conversion so I'm 
not sure this applies here...

Ted

At 06:08 AM 11/22/2006, John Hunter wrote:
> >>>>> "Robert" == Robert Cimrman <[EMAIL PROTECTED]> writes:
>
>
>     Robert> BTW would you consider changing the definition of spy(2)
>     Robert> as shown below, so that one could specify what 'to be a
>     Robert> zero' means?
>
>I added these enhancement, and a couple more, and an
>examples/spy_demos.py.
>
>On reflection, it might be better to allow the user to simply pass a
>sparsity function rather than a precision
>
>def not_zero(Z):
>     return Z!=0.
>
>class not_near_zero:
>     def __init__(self, precision):
>         self.precision = precision
>     def __call__(self, Z):
>         return absolute(asarray(Z))>self.precision
>
>def spy(Z, element=not_zero):
>     mask = element(Z)
>
>Then you could do:
>
>spy(Z, issparse=not_near_zero(1e-6))
>
>
>
>The precision implementation you suggested is in svn, but if there is
>any consensus that either of these approaches is better, speak up.
>
>JDH
>
>-------------------------------------------------------------------------
>Take Surveys. Earn Cash. Influence the Future of IT
>Join SourceForge.net's Techsay panel and you'll get the chance to share your
>opinions on IT & business topics through brief surveys - and earn cash
>http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>_______________________________________________
>Matplotlib-users mailing list
>Matplotlib-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to