Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMBLensed input PS shifts multipoles by 2 when using new CAMB-produced power spectra #212

Open
JamesAmato opened this issue Feb 26, 2025 · 4 comments

Comments

@JamesAmato
Copy link

JamesAmato commented Feb 26, 2025

The CMBLensed code appears to be misaligning power spectra. When it calculates the intermediate cl_tebp_arr from a power spectrum produced using CAMB, it has 0's for $\ell \in {0, 1, 2, 3}$. I believe it should only have zero values for $\ell \in {0,1}$.

I looked into this further and believe I've found the cause of the issue and propose a solution. I have another issue involving apply_delens that is tangled with this; I'll need more feedback on that one Issue 213.

Cause:
I think the code was written with the assumption that rows for $\ell=0$ and $\ell=1$ will not occur in CAMB's output text file. In the input file used with c1, the first multipole is $\ell=2$. CAMB's documentation states that output power spectra will have $\ell=0$ and $\ell=1$ rows. Values in cl_tebp_arr are assigned beginning at index 2, pulling values from the input data (cmb spectra) at index 0. Clearly this fails.

Solution:
I've attached a snippet ("snippet.txt") that can replace lines 290-338 of pysm/src/pysm3/models/cmb.py. I can submit a pull request, but need to resolve some confusion on a related issue. I've also attached a demo of the snippet as an alternative ("CMBLensed_l0l1_min_repro_demo.txt"); it will need two power spectra - one with rows for $\ell=0$ and $\ell=1$ and one without.

snippet.txt
CMBLensed_l0l1_min_repro_demo.txt

@zonca
Copy link
Member

zonca commented Feb 26, 2025 via email

@JamesAmato
Copy link
Author

Here's a notebook, showing the misalignment, the impact on maps produced from CAMB output power spectra, and a proposed solution.

https://github.com/JamesAmato/pysm/blob/demo_issues/issue_212_demo.ipynb

@JamesAmato
Copy link
Author

I found a far simpler approach, with two lines added in the __init__() method. There's no need to touch the taylens code. I apologize for muddying the water.

Here's an example.

When combined with Issue 213, a total of six lines need to be changed: two for 212, two for 213, and two for the intersection of them: Example.

@zonca
Copy link
Member

zonca commented Feb 28, 2025

ok, thanks, can you please make a pull request with those changes? Actually I prefer 2 separate pull requests each with 1 notebook that tests just that issue.

Also if you add a unit test in tests/test_cmb.py it is useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants