Nadav Horesh schreef:
> I think you have a problem of overflow in r5: You may better use utin64
> instead of uint32.
>
> Nadav.
>
>
Nadav,
My problems were due to trying to do two things at once.
The code below does what I want and it is very fast. I see the power of
numpy now:
import numpy
Folkert Boonstra schreef:
> Nadav Horesh schreef:
>
>> What you do here is a convolution with
>>
>> 0 1 0
>> 1 1 1
>> 0 1 0
>>
>> kernel, and thresholding, you can use numpy.numarray.nd_image package:
>>
>> import numpy.numarray.nd_i
Nadav Horesh schreef:
> What you do here is a convolution with
>
> 0 1 0
> 1 1 1
> 0 1 0
>
> kernel, and thresholding, you can use numpy.numarray.nd_image package:
>
> import numpy.numarray.nd_image as NI
> .
> .
> .
>ker = array([[0,1,0], [1,1,1],[0,1,0]])
>result = (NI.convolve(self.bufb
With a python background but new to numpy, I have the following.
Suppose I have a 2-D array and I want to apply a function to each element.
The function needs to access the direct neighbouring elements in order
to set a new value for the element. How would I do that in the most
efficient way with