healpy.map2alm
计算输入Healpix贴图的alm值数组。
功能是
healpy.sphtfunc.map2alm(maps, lmax=None, mmax=None, iter=3, pol=True, use_weights=False, regression=True, datapath=None)`
参数lmax
确定alm系数的数量。一个设置输入lmax
,代码返回'(lmax + 1)** 2'个alm系数。
l=0
返回a00
。
l=1
返回a11, a10, a1-1
+ a00
,即4个系数。
l=2
返回a22, a21, a20, a2-1, a2-2
,即5 + 3 + 1 = 9个系数。那是(lmax+1)**2 = 3**2 = 9
个系数。
然而,使用healpy
,这不是我得到的输出,无论我选择的地图如何。
import numpy as np
import healpy as hp
nside = 16 # healpix nside parameter
filename = "cmb_fullsky_map.fits" # generic name for sky map
readmap = hp.read_map(filename) # read in the map
# We then use healpy.map2alm(readmap) to generate an array of alm values
ell0 = hp.map2alm(readmap, lmax = 0) # lmax = 0 should output a00
ell0.shape # 1 value
print "l=0 has " + str(len(ell0))
print ell0
ell1 = hp.map2alm(readmap, lmax = 1) # lmax = 1 should outputs
ell1.shape # a11, a10, a1-1
print "l=1 has " + str(len(ell1)) # 3 values
print ell1
ell2 = hp.map2alm(readmap, lmax = 2) # lmax = 2 should output
ell2.shape # a22, a21, a20, a2-1, a2-2
print "l=2 has " + str(len(ell2)) # 5 values
print ell2
ell3 = hp.map2alm(readmap, lmax = 3) # lmax = 3 should output
ell3.shape # a33, a32, a31, a30, a3-1, a3-2, a3-3
print "l=3 has " + str(len(ell3)) # 7 values
print ell3
ell4 = hp.map2alm(readmap, lmax = 4) # lmax = 4 should output
ell4.shape # a44, a43, a42, a41, a40, a4-1, a4-2,
print "l=4 has " + str(len(ell4)) # a4-3 a4-4
print ell4 # 9 values
ell32 = hp.map2alm(readmap, lmax = 32) # lmax = 32 should output
ell32.shape # (lmax+1)**2 = 33**2 = 1089 coefficients
print "l=32 has " + str(len(ell32)) # 65 values
我的输出不是我期望的(lmax + 1)** 2。
l=0 has 1
[ 2.39883065e-06+0.j]
l=1 has 3
[ 2.39883065e-06 +0.00000000e+00j 4.49747594e-06 +0.00000000e+00j
-5.39401197e-07 +1.07974023e-06j]
l=2 has 6
[ 2.38695037e-06 +0.00000000e+00j 4.49747594e-06 +0.00000000e+00j
-2.93559509e-05 +0.00000000e+00j -5.39401197e-07 +1.07974023e-06j
-1.75256654e-05 -1.57729954e-05j 1.65489261e-05 -1.41571515e-05j]
l=3 has 10
[ 2.38695037e-06 +0.00000000e+00j 4.51148696e-06 +0.00000000e+00j
-2.93559509e-05 +0.00000000e+00j 1.19817810e-05 +0.00000000e+00j
-5.37909950e-07 +1.07783971e-06j -1.75256654e-05 -1.57729954e-05j
-7.17416081e-06 +9.14176685e-06j 1.65489261e-05 -1.41571515e-05j
-2.64725172e-06 -3.09988314e-05j -7.25462692e-06 -6.33251313e-07j]
l=4 has 15
[ 2.38534350e-06 +0.00000000e+00j 4.51148696e-06 +0.00000000e+00j
-2.93586471e-05 +0.00000000e+00j 1.19817810e-05 +0.00000000e+00j
-1.72252485e-06 +0.00000000e+00j -5.37909950e-07 +1.07783971e-06j
-1.75253044e-05 -1.57728790e-05j -7.17416081e-06 +9.14176685e-06j
-1.30606717e-05 -4.21675061e-06j 1.65464103e-05 -1.41578955e-05j
-2.64725172e-06 -3.09988314e-05j 1.09072312e-05 +3.22054569e-06j
-7.25462692e-06 -6.33251313e-07j -1.10079209e-06 +9.39495982e-07j
-8.01588627e-06 -8.03762608e-06j]
l=32 has 561
您是否看到了这种差异?
对于lmax=0
,我预计总共有1. healpy
个输出1
对于lmax=1
,我预计总共有4个healpy
输出3
对于lmax=2
,我预计总共有9个healpy
输出6
对于lmax=3
,我预计总共有16个healpy
输出10
对于lmax=4
,我预计总共有25个healpy
输出15
对于lmax=32
,我预计总共有1089个。healpy
输出561
问题:为了获得正确的阵列总数,我应该一起行动吗?
请map2alm
如何执行此操作。
答案 0 :(得分:2)
这是由于对称性。 m=-1
和m=1
具有相同的转换,因此HEALPix仅考虑m>=0
。
所以例如lmax=2
我们有:
总共6个系数。
alm
数组的长度应为:mmax * (2 * lmax + 1 - mmax) / 2 + lmax + 1)
。
答案 1 :(得分:0)
我最近也遇到了这个问题。 Healpix
给出所有正的m
值。负数可以用a(l,m1) = -a(l,-m)*
找到,其中*
是复共轭。