Skip to content

Commit

Permalink
use niter from pixell
Browse files Browse the repository at this point in the history
  • Loading branch information
thibautlouis committed Feb 20, 2024
1 parent 19deb26 commit b068e7b
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions pspy/sph_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def map2alm(map, niter, lmax, theta_range=None, dtype=np.complex128):
[theta_min,theta_max] in radian.
for healpix pixellisation all pixel outside this range will be assumed to be zero.
"""
print("new")
if map.pixel == "HEALPIX":
if theta_range is None:
alm = hp.sphtfunc.map2alm(map.data, lmax=lmax, iter=niter)
Expand All @@ -33,21 +34,11 @@ def map2alm(map, niter, lmax, theta_range=None, dtype=np.complex128):
alm = curvedsky.map2alm_healpix(map.data,
lmax=lmax,
theta_min=theta_range[0],
theta_max=theta_range[1])
if niter != 0:
map_copy = map.copy()
for _ in range(niter):
alm += curvedsky.map2alm_healpix(map.data-curvedsky.alm2map_healpix(alm,map_copy.data),
lmax=lmax,
theta_min=theta_range[0],
theta_max=theta_range[1])
theta_max=theta_range[1],
niter=niter)

elif map.pixel=="CAR":
alm = curvedsky.map2alm(map.data, lmax=lmax)
if niter != 0:
map_copy = map.copy()
for _ in range(niter):
alm += curvedsky.map2alm(map.data-curvedsky.alm2map(alm, map_copy.data), lmax=lmax)
alm = curvedsky.map2alm(map.data, lmax=lmax, niter=niter)
else:
raise ValueError("Map is neither a CAR nor a HEALPIX")

Expand Down

0 comments on commit b068e7b

Please sign in to comment.