[Numpy-discussion] your numpy bug-report -- clamp and percentile

Sebastian Haase haase at msg.ucsf.edu
Tue Mar 25 05:47:19 EDT 2008


Hi  Connelly !

I saw your bug-report (#626) was closed (as invalid).
[[ I think "invalid" is wrong, since numpy != scipy ]]

(http://scipy.org/scipy/numpy/ticket/626)
<copy of bug report>
 Two functions I am continually re-implementing in my own number-crunching
 projects are percentile() and clamp().  Here percentile(array, p) returns
 the pth percentile of array, using linear interpolation (p=0.5 is median,
 p=1.0 is max, p=0.25 is lower quartile, etc).  And clamp(array, lo, hi)
 clamps to lower and upper bound scalars.

 Would these functions be appropriate for numpy?  Will you accept patches?

 Thanks,
 Connelly Barnes
 connellybarnes at-symbol gmail dot com
</copy of bug report>

If someone wants to not  "rely" on scipy , then the precentile would
still be missing .....
(And I also have a C implementation for *inplace* clamp (clip)  )

Would you mind sending me the code you use for those functions ?

Thanks,
Sebastian Haase



More information about the NumPy-Discussion mailing list