[Numpy-discussion] Downsampling array, retaining min and max values in window

Matthieu Brucher matthieu.brucher at gmail.com
Sun Jul 29 05:34:10 EDT 2007


I think you should look into scipy.ndimage which has minimum_filter and


2007/7/24, Ludwig M Brinckmann <ludwigbrinckmann at gmail.com>:
> Hi there,
> I have a large array, lets say 40000 * 512, which I need to downsample by
> a factor of 4 in the y direction, by factor 3 in the x direction, so that my
> resulting arrays are 10000 * 170 (or 171 this does not matter very much) -
> but of all the values I will need to retain in the downsampled arrays the
> minimum and maximum of the original data, rather than computing an average
> or just picking every third/fourth value in the array.
> So essentially I have a 4*3 window, for which I need the min and max in
> this window, and store the result of applying this window to the original
> array as my results.
> What is the best way to do this?
> Regards
> Ludwig
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070729/b1164f98/attachment.html>

More information about the NumPy-Discussion mailing list