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

2012-12-27 Thread deb
Hi, I have 2D array, let's say: `np.random.random((100,100))` and I want to do simple manipulation on each point neighbors, like divide their values by 3. So for each array value, x, and it neighbors n: n n nn/3 n/3 n/3 n x n -> n/3 x n/3 n n nn/3 n/3 n/3 I searched a bit, and found a

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

2012-12-28 Thread deb
Thanks Zach 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 conf

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

2012-12-30 Thread deb
Thanks Zach for your interest I was thinking about ndimage.generic_filter when I wrote about generic filter. For generic_filter I used trivial function that returns .sum() but I can't seem to make the code any faster than it is. This is the code: http://code.activestate.com/recipes/578390-snowf