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

Hans Meine meine at informatik.uni-hamburg.de
Tue Dec 11 14:52:03 EST 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: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20071211/748befff/attachment.sig>


More information about the NumPy-Discussion mailing list