[SciPy-User] Rotated, Anisotropic Gaussian Filtering (Kernel Density Estimation)

Daπid davidmenhur@gmail....
Fri Oct 19 14:29:35 CDT 2012


On Fri, Oct 19, 2012 at 7:18 PM, Patrick Marsh <patrickmarshwx@gmail.com> wrote:
> Obviously, I'm doing something wrong here, but I'm not sure what. Why is the
> result separated into the four corners and not the center of the grid?

As it was said before, you are not doing anything wrong, that is the
expected behaviour. According to the standard specification  the first
element of the array is the mean value.

The details are here:
http://docs.scipy.org/doc/numpy/reference/routines.fft.html#module-numpy.fft

Also, you could take advantage of the fact that both the kernel and
the data are real, therefore the negative frequencies are trivial, and
you only need the positive ones. np.fft has rfft functions for these
cases, the signal package may have something useful too.

Doing some research, it appears that FFTW is not included in Numpy, so
you may want to take a look at pyFFTW. I don't know the implementation
details of signal.fftconvolve, but you could clone it replacing their
fft with this faster library:

http://hgomersall.wordpress.com/2012/02/01/the-joys-of-cython-numpy-and-a-nice-fftw-api/


More information about the SciPy-User mailing list