【问题标题】:How does Healpy pix2ang read pixel indices?Healpy pix2ang 如何读取像素索引?
【发布时间】:2015-04-20 16:34:57
【问题描述】:

这是这个问题的延续:How do HEALPix FITS files of CMB maps translate into ndarrays? What are the coordinates?

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 的像素数组呢?

【问题讨论】:

    标签: python numpy astronomy healpy


    【解决方案1】:

    与球谐函数无关。

    像素数是一维数组中的位置。所以第一个元素是像素 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 ]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-21
      • 1970-01-01
      • 2018-07-25
      • 2011-02-09
      • 1970-01-01
      • 1970-01-01
      • 2014-08-27
      相关资源
      最近更新 更多