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

Travis E. Oliphant oliphant@enthought....
Tue Dec 11 14:58:05 CST 2007


Hans Meine wrote:
> 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.
>   

It is done, now in SVN.

-Travis




More information about the Numpy-discussion mailing list