Healpy map2alm 函数没有 return 预期的 alm 值数量
Healpy map2alm function does not return expected number of alm values
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
和代码 returns '(lmax+1)**2` alm 系数的数量。
l=0
returnsa00
。
l=1
returnsa11, a10, a1-1
+a00
,即4个系数。
l=2
returnsa22, 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
如何执行这个操作。
这是由于对称性。 m=-1
和 m=1
具有相同的变换,因此 HEALPix 仅考虑 m>=0
.
例如 lmax=2
我们有:
- a00
- a10
- a11
- a20
- a21
- a22
总共 6 个系数。
alm
数组的长度预计为:mmax * (2 * lmax + 1 - mmax) / 2 + lmax + 1)
.
我最近也遇到了这个问题。 Healpix
给出所有正 m
值。负数可以用 a(l,m1) = -a(l,-m)*
找到,其中 *
是复共轭。
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
和代码 returns '(lmax+1)**2` alm 系数的数量。
l=0
returnsa00
。
l=1
returnsa11, a10, a1-1
+a00
,即4个系数。
l=2
returnsa22, 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
如何执行这个操作。
这是由于对称性。 m=-1
和 m=1
具有相同的变换,因此 HEALPix 仅考虑 m>=0
.
例如 lmax=2
我们有:
- a00
- a10
- a11
- a20
- a21
- a22
总共 6 个系数。
alm
数组的长度预计为:mmax * (2 * lmax + 1 - mmax) / 2 + lmax + 1)
.
我最近也遇到了这个问题。 Healpix
给出所有正 m
值。负数可以用 a(l,m1) = -a(l,-m)*
找到,其中 *
是复共轭。