[Numpy-discussion] Manipulate neighboring points in 2D array

Zachary Pincus zachary.pincus@yale....
Fri Dec 28 20:13:01 CST 2012


> You are right. I needed generic filter - to update current point, and not the neighbors as I wrote.
> Initial code is slow loop over 2D python lists, which I'm trying to convert to numpy and make it useful. In that loop there is inner loop for calculating neighbors properties, which confused me yesterday, and mislead to search for something that probably does not make sense.
> 
> It's clear now :)

It's possible that some generic filter operations can be cast in terms of pure-numpy operations, or composed out of existing filters available in scipy.ndimage. If you can describe the filter operation you wish to perform, perhaps someone can make some suggestions.

Alternately, scipy.ndimage.generic_filter can take an arbitrary python function. Though it's not really fast...

Zach


More information about the NumPy-Discussion mailing list