Skip to content

qe.pixelization.map2alm_spin() not consistent for Healpix and CAR #20

@darbykramer

Description

@darbykramer
  • falafel version: 0.1.0
  • Python version: 3.9.8
  • Operating System: Linux (Niagara)

Description

I am using the qe_source() function in my recent theory paper to reconstruct maps from simulations. After building a healpix qe.pixelization object, passing that object and my input alms into qe_source(), I found that I was getting a negative version of the map I expected. This issue does not exist if I use a CAR pixelization, and the differentiation occurs in px.map2alm_spin(). I demo the issue below.

What I Did

import pixell.curvedsky as cs
import numpy as np
from orphics import maps
from pixell import enmap
import healpy as hp
from falafel import qe, utils

# presets 
nside = 1024
res_arc = 3.2 # close to nside resolution
res_rad = res_arc * 1/60 * np.pi/180

shape, wcs = enmap.fullsky_geometry(res=res_arc*1/60*np.pi/180)

lmax = 3000
ells = np.linspace(0,lmax, lmax+1)

# make a power spectrum
tcl = np.ones(lmax+1)

# make a random alm
Talm = hp.synalm(tcl)

# make a car map of the initial alms
imap_car = cs.alm2map(Talm, enmap.ndmap(np.zeros(shape), wcs))

# make an hp map of the initial alms
imap_hp = hp.alm2map(Talm, nside=nside)

# make two pixelization objects from falafel.qe with similar resolution
# first make a CAR one
px_car = qe.pixelization(shape=shape, wcs=wcs)

# next a healpix one
px_hp = qe.pixelization(nside=nside)

# use their map2alm_spin() methods to take the spin-0 SHTs of imap
# change imap to car for the car px:
imap_car = enmap.enmap(imap_car, px_car.wcs)
car_alm = px_car.map2alm_spin(imap_car,lmax,0,0)

# hp:
hp_alm = px_hp.map2alm_spin(imap_hp,lmax,0,0)

# print alms, showing that they are opposites of each other
print("CAR Pixelization Alm = "+str(car_alm))

print("Healpix Pixelization Alm = "+str(hp_alm))

# compare to original Talm
print("Original Alm = "+str(Talm))
 

Outputs:

CAR Pixelization Alm = [[ 0.22765916+0.j          0.40338906+0.j          0.18244621+0.j
  ...  0.30785274-0.16778591j -0.24141246-0.69590157j
   0.37591568+1.38649857j]
 [ 0.        +0.j          0.        +0.j          0.        +0.j
  ...  0.        +0.j          0.        +0.j
   0.        +0.j        ]]

Healpix Pixelization Alm = [array([-0.22771936-0.j        , -0.40346108-0.j        ,
       -0.18257752-0.j        , ..., -0.30785274+0.16778591j,
        0.24141246+0.69590157j, -0.37591568-1.38649857j]), array([-0.-0.j, -0.-0.j, -0.-0.j, ..., -0.-0.j, -0.-0.j, -0.-0.j])]

Original Alm = [ 0.22765916+0.j          0.40338906+0.j          0.18244621+0.j
 ...  0.30785274-0.16778591j -0.24141246-0.69590157j
  0.37591568+1.38649857j]

Therefore, the CAR version is correct, and the map2alm_spin with spin=0 for the healpix pixelization object yields a negative alm of what it should.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions