Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

The CosmoModel.prob method was not forwarding kwargs to detector_frame_to_source_frame, breaking parametrized cosmologies (FlatwCDM, FlatLambdaCDM) that require cosmological parameters.

Changes

  • Fixed kwargs forwarding: Added **kwargs to detector_frame_to_source_frame call in CosmoModel.prob (line 161)
  • Added CosmoModel test coverage: 10 tests covering initialization, prob method with fixed/parametrized cosmologies, jacobian corrections, and parameter sensitivity

Example

from gwpopulation.experimental.cosmo_models import CosmoModel

model = CosmoModel(model_functions=[...], cosmo_model="FlatwCDM")
data = {"luminosity_distance": [1000.0], "mass_1_detector": [30.0]}

# Now works - cosmological parameters are properly forwarded
prob = model.prob(data, H0=70.0, Om0=0.3, w0=-1.0)
Original prompt

On cosmo_models.py, kwargs should be passed to detector_frame_to_source_mass. Also, add tests covering the CosmoModel.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 15, 2025 16:25
… tests

Co-authored-by: ColmTalbot <25602909+ColmTalbot@users.noreply.github.com>
Co-authored-by: ColmTalbot <25602909+ColmTalbot@users.noreply.github.com>
Copilot AI changed the title [WIP] Update kwargs handling in detector_frame_to_source_mass Pass kwargs to detector_frame_to_source_frame in CosmoModel.prob Dec 15, 2025
Copilot AI requested a review from ColmTalbot December 15, 2025 16:33
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.40%. Comparing base (fc60cf9) to head (72865e5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #135      +/-   ##
==========================================
+ Coverage   90.74%   91.40%   +0.66%     
==========================================
  Files          14       14              
  Lines         907      907              
==========================================
+ Hits          823      829       +6     
+ Misses         84       78       -6     
Flag Coverage Δ
python3.10 91.40% <100.00%> (+0.66%) ⬆️
python3.11 91.40% <100.00%> (+0.66%) ⬆️
python3.12 91.40% <100.00%> (+0.66%) ⬆️
python3.13 91.40% <100.00%> (+0.66%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ColmTalbot ColmTalbot marked this pull request as ready for review December 15, 2025 16:43
@ColmTalbot ColmTalbot merged commit 3121f35 into main Dec 15, 2025
16 checks passed
@ColmTalbot ColmTalbot deleted the copilot/update-cosmo-models-kwargs branch December 15, 2025 16:44
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.

2 participants