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:

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

2012-12-30 Thread Nicolas Rougier
You might want to have a look at : http://code.google.com/p/glumpy/source/browse/demos/gray-scott.py which implements a Gray-Scott reaction-diffusion system. The 'convolution_matrix(src, dst, kernel, toric)' build a sparse matrix such that multiplying an array with this matrix will result in

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

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

2012-12-28 Thread Zachary Pincus
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

[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

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

2012-12-27 Thread Zachary Pincus
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