Skip to content

fixed issue1242. Allow p_of_k_a=None in angular_cl #1244

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

Merged
merged 1 commit into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pyccl/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def angular_cl(
spectrum to project. If a string, it must correspond to one of
the non-linear power spectra stored in `cosmo` (e.g.
`'delta_matter:delta_matter'`).
l_limber (int, float or 'auto') : Angular wavenumber beyond which
Limber's approximation will be used. Defaults to -1. If 'auto',
then the non-limber integrator will be used to compute the right
l_limber (int, float or 'auto') : Angular wavenumber beyond which
Limber's approximation will be used. Defaults to -1. If 'auto',
then the non-limber integrator will be used to compute the right
transition point given the value of limber_max_error.
limber_max_error (float) : Maximum fractional error for Limber integration.
limber_integration_method (string) : integration method to be used
Expand All @@ -63,12 +63,12 @@ def angular_cl(
are defined. Users are encouraged to experiment with this parameter
and ``fkem_chi_min`` to ensure the robustness of the output
:math:`C_\\ell` s.
p_of_k_a_lin (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`):
p_of_k_a_lin (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`):
3D linear Power spectrum to project, for special use in
PT calculations using the FKEM non-limber integration technique.
If a string, it must correspond to one of
the linear power spectra stored in `cosmo` (e.g.
`'delta_matter:delta_matter'`).
`'delta_matter:delta_matter'`).
return_meta (bool): if `True`, also return a dictionary with various
metadata about the calculation, such as l_limber as calculated by the
non-limber integrator.
Expand Down Expand Up @@ -106,6 +106,8 @@ def angular_cl(

# Access ccl_cosmology object

if p_of_k_a is None:
p_of_k_a = DEFAULT_POWER_SPECTRUM
psp = cosmo.parse_pk2d(p_of_k_a, is_linear=False)

# Create tracer colections
Expand Down
2 changes: 1 addition & 1 deletion pyccl/tests/test_cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
LENS = ccl.WeakLensingTracer(COSMO, dndz=(ZZ, NN))


@pytest.mark.parametrize("p_of_k_a", [ccl.DEFAULT_POWER_SPECTRUM, PKA])
@pytest.mark.parametrize("p_of_k_a", [ccl.DEFAULT_POWER_SPECTRUM, PKA, None])
def test_cells_smoke(p_of_k_a):
# make a set of tracers to test with
z = np.linspace(0.0, 1.0, 200)
Expand Down