我是这样做的:
使用一个小技巧。我在所需的高斯中心插入一个点,然后我使用“涂抹”来创建一个带有一些 sigma 的高斯。
下面是一些例子:
#!/usr/bin/env python
import numpy as np
import healpy as hp
import pylab as pl
NSIDE=512 #the map garannularity
m_sm=np.arange(hp.nside2npix(NSIDE)) # creates the map
m_sm=m_sm*0. # sets all values to zero
theta=np.radians(80.) # coordinates for the gaussian
phi=np.radians(20.)
indx=hp.pixelfunc.ang2pix(NSIDE,theta,phi) # getting the index of the point corresponding to the coordinates
m_sm[indx]=1. # setting that point value to 1.
gmap=hp.smoothing(m_sm, sigma=np.radians(20.),verbose=False,lmax=1024) # creating a new map, smmeared version of m_sm
hp.mollview(gmap, title="Gaussian Map") #draw it
pl.show()
现在,如果您想手动执行此操作,则可以使用高斯函数
1)你给它一些坐标
2)您使用以下方法检索与该坐标对应的索引:
indx=hp.pixelfunc.ang2pix(NSIDE,theta,phi)
3)您将该点的值设置为高斯函数的值。IE:
my_healpy_map[indx]=my_gauss(theta, phy, mean_theta, mean_phy, sigma_theta, sigma_phy)