Fast way using healpy to get convolution of a healpy map and a 2D Gaussian

1.1k Views Asked by At

I have a healpix map with nside=512 (= huge numpy.ndarray, about 3.1E6 elements). I need to convolute it with a 2D Gaussian.

I tried creating a healpix map of the Gausian, multiplying the two numpy.ndarray and getting the sum; this is too slow.

second thing I tried is defining a Gaussian function (not a map) and then a 2D function which for given x,y returns the value of the huge_map*gausian at the position x,y. then I used scipy.integrate.nquad to get the integral. Faster than the first method, but ...

Is there a way how to use the expansion to spherical harmonics to get the integral of the huge_map*Gaussian even faster? Something like expand the huge_map in spherical harm., expand the Gaussian in spherical harm., multiply the coefficients, transform back, get the sum.

And possible modifications like: a) work instead with log of the huge_map and log of the Gaussian, then the operation to by done to the coefficients is clearly sum. b) get somehow the integral directly from the coefficients, without the back transformation? c) limit the expansion to some number and speed up the whole thing?

how to implement it correctly using healpy ?

1

There are 1 best solutions below

2
On BEST ANSWER

you can try to use healpy.smoothing, for example:

wmap_map_I_smoothed = hp.smoothing(wmap_map_I, fwhm=60, arcmin=True)
hp.mollview(wmap_map_I_smoothed, min=-1, max=1, title='Map smoothed 1 deg')

Documentation: http://healpy.readthedocs.org/en/latest/generated/healpy.sphtfunc.smoothing.html