Skip to content

CMB Lensing Tracer Implemented as N(z) tracer post PR #607

@arthurmloureiro

Description

@arthurmloureiro

Describe the bug
Hi Firecrown Devs,

While working with @XanderHenrik and testing the CMB lensing implementation, I noticed a serious issue in the current design: CMB lensing is being treated as an N(z) tracer, and this causes fundamental problems throughout the pipeline.

This behavior was introduced in this commit:
4cfaa02

Conceptually, assigning a redshift distribution to the CMB is incorrect. The CMB is a source plane at a fixed redshift, not a population with an N(z). Treating it as such leads to multiple downstream issues, particularly in the connectors (e.g. CosmoSIS). As far as I can tell, the connector logic extrapolates all redshift-dependent quantities up to the maximum redshift found across all N(z)s. When the CMB is included as an N(z) tracer, this effectively forces CosmoSIS/CCL to evaluate P(k) at the CMB redshift, which consistently breaks the calculation.

Previously, I implemented the CMB source as a distinct tracer type precisely to avoid this class of problems. Reintroducing it as an N(z) tracer reopens all of these issues and makes the CMB lensing support very fragile.

Related to this, the removal of the default CMB source redshift here:
c35c074

also contributes to the problem. While configurability is fine, having a sensible default for the CMB source plane is important, since this value is effectively fixed in practice.

At this point, the core issue is that CMB lensing should not be modeled as an N(z) tracer at all, as it introduces conceptual inconsistencies and concrete technical failures in the connectors. I am currently unsure how to undo this cleanly within the existing structure, but I think reverting this design choice is necessary to have a robust CMB lensing implementation.

There are also problem with SACC as CMB Kappa is not considered a NZTracer in SACC (see example here:

# GC
s.add_tracer('NZ', 'gc',  # Name
             quantity='galaxy_density',  # Quantity
             spin=0,  # Spin
             z=z,  # z
             nz=nz)  # nz
# WL
s.add_tracer('NZ', 'wl',  # Name
             quantity='galaxy_shear',  # Quantity
             spin=2,  # Spin
             z=z,  # z
             nz=nz,  # nz
             extra_columns={'error': 0.1*nz},  # You can include extra columns for the N(z)
             sigma_g=0.28)  # You can add any extra information as **kwargs
# CMBK
s.add_tracer('Map', 'ck',  # Name
             quantity='cmb_convergence',  # Quantity
             spin=0,  # Spin
             ell=ell_beam, beam=beam)  # Beam

This complicates things also when using this SACC structure to call TJPCov. We had to adapt a pipeline that uses CMBK correctly in sacc when talking to TJPCov, but then later converting it to the wrong NZTracer type when interacting with firecrown.

To Reproduce

  1. Try to run a CMB Lensing x Something case with cosmosis.

Expected behavior

  1. CMB Lensing runs within cosmosis and other connectors.

Observed behavior
A clear and concise description of what you observed to happen.

Output
If necessary, add the SACC file, configuration files, error message, or any other output
that can help us understand the problem.

Configuration:
Master branch and since CMB Lensing has been merged into the master branch.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions