0

我有一组大于 10M 的大型对象,带有 RA 和偏角的文件。我想使用 healpix/healpy 制作这些的对数密度全天地图。我当前的代码如下所示:

 m = hp.ang2pix(512, ra, dec, lonlat=True)
 NSIDE = 512
 np.arange(hp.nside2npix(NSIDE))
 hp.visufunc.mollview(m) 

我得到了错误:

 ValueError: Wrong pixel number (it is not 12*nside**2)

我究竟做错了什么??

谢谢,尼克

4

1 回答 1

2

这里 m 是一个长度为 ra(和 dec)的数组。您首先需要将 m 转换为长度为 12*NSIDE^2 的 healpix 映射[或数组]。

为此,您可以使用 numpy.bincount [非常快,并为您提供每个像素中的对象数量],或 scipy.stats.binned_statistic,[非常慢,但允许您计算任何“统计”,例如 np.std等你喜欢的,每个像素中的数据]

def gen_fast_map(ip_, nside=512):
    npixel  = hp.nside2npix(nside)
    map_ = np.bincount(ip_,minlength=npixel)
    return map_

map = gen_fast_map(m)
hp.visufunc.mollview(map)
于 2017-06-19T08:39:57.080 回答