[Numpy-discussion] Getting 95%/99% margin of ndarray

Johannes Bauer dfnsonfsduifb at gmx.de
Wed Jul 22 12:36:40 EDT 2009


Hello list,

is there some possibilty to get a p-dynamic of an array, i.e. if p=1
then the result would be (arr.min(), arr.max()), but if 0 < p < 1, then
the result is so that the pth percentile of the picture is withing the
range given?

I cannot explain this very well, so please let me illustrate. Let's say
we have an array:


0 0 0 0 1 2 3 4 5 2000

p = 0.9 -> (0, 5)
This means that 90% of the pixels are within the [0; 5] range

p = 0.5 -> (1, 5)

p = 0.3 -> (2, 4)

It it clear what I want? Is there the possibility to achieve that? If I
have to implement it myself, how can I do that efficiently in Python?

Kind regards,
Johannes



More information about the NumPy-Discussion mailing list