[Numpy-discussion] I've just commited a fast-clip function

Stefan van der Walt stefan at sun.ac.za
Fri Mar 30 09:11:38 EDT 2007


Hi Travis,

On Thu, Mar 29, 2007 at 11:21:07PM -0600, Travis Oliphant wrote:
> I would appreciate it, if people could test out the new clip function 
> and conjugate method to make sure they are working well.  All tests 
> pass, but there are some things we are not testing for.  I need to still 
> add the clip tests from ticket #425 --- unless somebody beats me to
> it.

Passing negative values to clip for an N.uint8 array causes problems:

In [95]: z.clip(0,100).max()
Out[95]: 100

In [96]: z = (N.random.random(1000)*128).astype(N.uint8)

In [97]: z.clip(0,100).max()
Out[97]: 100

In [98]: z = (N.random.random(1000)*128).astype(N.uint8)

In [99]: z.clip(-10,100).max()
Out[99]: 246

Cheers
Stéfan



More information about the NumPy-Discussion mailing list