Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Line 97 in cosmo_models.py references self.parameters which doesn't exist, causing failures when using parametrized cosmologies (FlatwCDM, FlatLambdaCDM). The method signature accepts **parameters but wasn't using them.

Changes

  • cosmo_models.py:97: Changed self.cosmology(self.parameters)self.cosmology(parameters)
  • cosmo_models.py:75: Fixed docstring typo "sourece" → "source"
  • cosmo_models.py:105: Improved error message clarity
  • test/cosmo_test.py: Added 16 tests covering all cosmology models, parameter passing, and edge cases

Impact

Before this fix, calling detector_frame_to_source_frame with FlatwCDM or FlatLambdaCDM would fail:

mixin = CosmoMixin(cosmo_model="FlatwCDM")
data = {"luminosity_distance": np.array([400.0, 800.0])}
# This would fail with AttributeError: 'CosmoMixin' object has no attribute 'parameters'
samples, jacobian = mixin.detector_frame_to_source_frame(data, H0=70, Om0=0.3, w0=-1.0)

Now works correctly with passed parameters used for cosmology calculations.

Original prompt

On cosmo_models.py:97-97, This line should use the parameters passed as inputs to this method. Make this change and add tests for this code.


💡 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 15:58
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 cosmo_models.py to use parameters from method inputs Fix detector_frame_to_source_frame to use passed parameters instead of nonexistent self.parameters Dec 15, 2025
Copilot AI requested a review from ColmTalbot December 15, 2025 16:05
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.74%. Comparing base (bf5e40a) to head (7d72339).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #134      +/-   ##
==========================================
+ Coverage   88.64%   90.74%   +2.09%     
==========================================
  Files          14       14              
  Lines         907      907              
==========================================
+ Hits          804      823      +19     
+ Misses        103       84      -19     
Flag Coverage Δ
python3.10 90.74% <100.00%> (+2.09%) ⬆️
python3.11 90.74% <100.00%> (+2.09%) ⬆️
python3.12 90.74% <100.00%> (+2.09%) ⬆️
python3.13 90.74% <100.00%> (+2.09%) ⬆️

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:08
@ColmTalbot ColmTalbot merged commit fc60cf9 into main Dec 15, 2025
9 checks passed
@ColmTalbot ColmTalbot deleted the copilot/update-cosmo-models-parameters branch December 15, 2025 16:08
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