[SciPy-user] Creating a 2D matrix with a gausian hump?

Gerald Richter richter at hephy.oeaw.ac.at
Thu Jun 22 10:04:35 CDT 2006


Oh, well...

the code was not attached... but this time!

btw: you won't get values == 0 at the borders of your (n X m) kernel grid,
since in that case you could use a kernel (n-2 X m-2).

that is the reason, why the attached code worked like using the multiples
of the sigmas of the gaussians as the limits of the kernel definition
range.
since one also provides the step sizes of the data-grid, the kernel-size
may vary wrt. the multiples of the sigmas.

regards,
Gerald.


On Thu, Jun 22, 2006 at 09:37:20AM -0400, James Carroll wrote:
> Hi,
> 
> What's a good way to create a 2d gaussian kernel with numpy?
> 
> I'm trying to create a 9x9 matrix with 1.0 in the center, and 0.0 in
> the corners, and a gaussian distribution from the center out.
> 
> Thanks,
> -Jim
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

-- 

                              Gerald Richter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gen_convkern.py
Type: text/x-python
Size: 4129 bytes
Desc: not available
Url : http://www.scipy.net/pipermail/scipy-user/attachments/20060622/32ec11eb/gen_convkern-0001.py


More information about the SciPy-user mailing list