[Numpy-discussion] dedicated function for resize with averaging or rebin 2d arrays?
zonca at deepspace.ucsb.edu
Mon Nov 14 17:02:37 EST 2011
On Mon, Nov 14, 2011 at 09:24, Chris.Barker <Chris.Barker at noaa.gov> wrote:
> On 11/11/11 8:28 PM, Craig Yoshioka wrote:
>> I once wrote a generic n-dimensional binning routine in C that I
>> could find if anyone is interested in integrating it into numpy... it
>> didn't do size increases though... and I think I implemented it so
>> that binning by a non-divisible factor trimmed the extras. It was
>> very-very fast though.
> And I've got one written in Cython. I'd been thinking of contributing it
> to ndimage, but never got around to it -- but I'd be glad to share. Let
> me know if you want it.
Chris, I think this would be useful, can you make it available publicly?
>>> I think the usefulness of the rebin function is to be simple and fast,
>>> and the best would be to implement it in the core numpy, as a simple
>>> method for smoothing and reshaping,
> Does it have common use=-cases outside image processing? If not, then
> no, it shouldn't be in numpy.
actually the most common use is outside of image processing, we typically
use it when we have data that come from a detector scanning the sky in
circles, so you have a row for each scan.
It is nice to apply a quick and dirt decimation of the dataset by binning it.
It is such a simple function that would make more sense, to me, to
have in numpy.
In image processing I imagine you typically want to apply window functions,
so for that ndimage is more appropriate.
More information about the NumPy-Discussion