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.
I was thinking about passing directly a function (or an expression?) too. But I would not remove the precision argument, since it's usage is simpler, and is usually all one needs. The best would be to have both possibilities :) (function, if present, taking precedence?) r. ------------------------------------------------------------------------- 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