Skip to content

gh-137: added CAMB nonlinear fix#138

Open
ivansladoljev wants to merge 2 commits into
mainfrom
fix/camb_nonlinear_interface
Open

gh-137: added CAMB nonlinear fix#138
ivansladoljev wants to merge 2 commits into
mainfrom
fix/camb_nonlinear_interface

Conversation

@ivansladoljev
Copy link
Copy Markdown
Collaborator

@ivansladoljev ivansladoljev commented Apr 16, 2026

📌 Related Issue

Closes #137

✨ What’s been added or changed?

cloelike calls NonLinPerturbations with the signature (background, linearperturbations, redshifts, log10TAGN) to support emulator-based classes that compute nonlinear boosts from pre-computed linear power spectra.
CAMBNonLinearPerturbations was missing the linearperturbations argument, making it incompatible with the inference pipeline. This PR adds linearperturbations as a mock parameter — CAMB computes nonlinear corrections internally and does not use it.

🧪 How was it tested?

from cloelib.cosmology.camb_cosmology import CAMBBackground, CAMBLinearPerturbations, CAMBNonLinearPerturbations
import numpy as np

bg = CAMBBackground(H0=67.0, Omega_b0=0.049, Omega_cdm0=0.270, Omega_k0=0.0,
                    As=2.1e-9, ns=0.96, mnu=0.06, w0=-1.0, wa=0.0,
                    gamma_MG=0.0, N_mnu=1)
zs = np.linspace(0.01, 2.0, 10)
lp = CAMBLinearPerturbations(bg, zs)
nlp = CAMBNonLinearPerturbations(bg, lp, zs)
print(nlp.sigma8_0())  # expected: ~0.816

🔍 Checklist

You can review this PR in ReviewNB, don't forget to log in with your GitHub username:
👉 https://app.reviewnb.com/cloe-org/playground/pulls/

  • I've named the title of this pull request starting by 'gh-#: TITLE'
  • I’ve linked the related issue
  • I’ve tested the code or notebooks manually
  • I’ve added comments/docstrings where needed (i.e: README)
  • I’ve updated relevant docs if necessary

@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

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

Successfully merging this pull request may close these issues.

CAMBNonLinearPerturbations interface issue

1 participant