Hi,
Given a (possibly masked) 2d array x, is there a fast(er) way in Numpy to obtain
the same result as the following few lines?
d = 1 # neighbourhood 'radius'
Nrow = x.shape[0]
Ncol = x.shape[1]
y = array([[x[i-d:i+d+1,j-d:j+d+1].ravel() for j in
On Fri, 2007-02-23 at 17:38 +0100, [EMAIL PROTECTED] wrote:
Hi,
Given a (possibly masked) 2d array x, is there a fast(er) way in Numpy to
obtain
the same result as the following few lines?
d = 1 # neighbourhood 'radius'
Nrow = x.shape[0]
Ncol =
Scipy's ndimage module has a function that takes a generic callback
and calls it with the values of each neighborhood (of a given size,
and optionally with a particular mask footprint) centered on each
array element. That function handles boundary conditions, etc nicely.
Unfortunately, I'm
On Friday 23 February 2007 14:53:05 Zachary Pincus wrote:
Scipy's ndimage module has a function that takes a generic callback
and calls it with the values of each neighborhood (of a given size,
and optionally with a particular mask footprint) centered on each
array element. That function