[Numpy-discussion] ndarray.clip only with lower or upper values?

Hans Meine meine@informatik.uni-hamburg...
Tue Dec 11 13:52:03 CST 2007


On Dienstag 11 Dezember 2007, Timothy Hochberg wrote:
> > You mean one of the following?
> >  a.clip(min = 10, max = numpy.finfo(a.dtype).max)
> >  a.clip(min = 10, max = numpy.iinfo(a.dtype).max)
>
> No. I mean:
>
>   numpy.maximum(a, 10)
>
> To correspond to the above example.

Great, thanks for the hints.  That's good enough; could be pythonic to let 
clip() forward calls to minimum/maximum if only one bound is given though.
I had a look at the code, but I am not used enough to the Python/C API, let 
alone to numpy's internals, to *quickly* hack this.

Ciao, /  /                                                    .o.
     /--/                                                     ..o
    /  / ANS                                                  ooo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20071211/748befff/attachment.bin 


More information about the Numpy-discussion mailing list