Healpy pix2ang如何读取像素索引



这是这个问题的延续:CMB地图的HEALPix FITS文件如何转换为ndarray?坐标是什么?

CMB 地图以 FITS 文件的形式出现。该地图是像素温度值的一维向量。

我想使用 Healpy 的 pix2ang 函数来读取每个像素的位置,并知道哪个像素是哪个像素。

http://healpy.readthedocs.org/en/latest/generated/healpy.pixelfunc.pix2ang.html

对于此函数,"像素索引"的输入究竟是什么?我是否必须首先将每个温度值像素转换为球谐波?

我知道在球谐波中,每个a_lm对应于创建的FITS文件扩展名将包含一个索引= l^2 + l + m + 1的整数列。但是不使用 l 和 m 的像素数组呢?

它与球谐波无关。

像素数是一维数组中的位置。所以第一个元素是像素 0,第二个元素是像素 1,依此类推。

在最简单的 nside 1 地图(只有 12 个像素)的情况下:

import healpy as hp
nside = 1
npix = hp.nside2npix(1)
print("Number of pixels:")
print(npix)
m = 100 + np.arange(npix)
print("Map:")
print(m)
print("Plot map")
%matplotlib
hp.mollview(m)
print("Pixel theta (colatitude) and phi (longitude) in radians:")
i_pix = np.arange(npix)
theta, phi = hp.pix2ang(nside, i_pix)
for i in range(npix):
    print("Pixel %d : [ %.2f, %.2f ]" % (i, theta[i], phi[i]))

这将打印:

Pixel 0 : [ 0.84, 0.79 ]
Pixel 1 : [ 0.84, 2.36 ]
Pixel 2 : [ 0.84, 3.93 ]
Pixel 3 : [ 0.84, 5.50 ]
Pixel 4 : [ 1.57, 0.00 ]
Pixel 5 : [ 1.57, 1.57 ]
Pixel 6 : [ 1.57, 3.14 ]
Pixel 7 : [ 1.57, 4.71 ]
Pixel 8 : [ 2.30, 0.79 ]
Pixel 9 : [ 2.30, 2.36 ]
Pixel 10 : [ 2.30, 3.93 ]
Pixel 11 : [ 2.30, 5.50 ]

最新更新