Skip to content

Conversation

@TomWagg
Copy link
Collaborator

@TomWagg TomWagg commented Dec 17, 2025

I went a little rogue and got carried away here but I think you'll like it @katiebreivik.

This PR introduces a new class in cosmic.output.COSMICOutput. This class lets you do things like:

  • Instantiate based on evolve output `output = COSMICOutput(bpp, bcm, initC, kick_info, label="Latest run")
  • Save and load from a file output.save("file.h5"); new_output = COSMICOutput(file="file.h5")
    • This will also track the COSMIC version and warns users about mismatches
  • Index and mask the class to get specific binaries based on bin nums or masks
    • randos = output[[0, 1, 2]]; randos = output[10:20]
    • `massive = output[output.initC["mass_1"] > 10]
    • This will mask all of the relevant dataframes
  • Re-run with new physics
    • alpha_5 = output.rerun_with_settings({'alpha1: 5}, inplace=False)
  • Plot all sorts of stuff
    • output.plot_detailed_evolution(bin_num=0)
      • This uses a bcm table, can pass kwargs to plot_binary_evol
    • `output.plot_distribution(x_col='mass_1', y_col='mass_2', c_col='porb', when='initial')
      • This one uses either initC or bpp based on whether you say "initial" or "final", it can also do histograms if y_col=None

There's also a whole new tutorial in the docs that explains/demonstrates this all in more detail.

Happy holidays 🙃

@TomWagg TomWagg requested a review from katiebreivik December 17, 2025 17:13
@TomWagg TomWagg self-assigned this Dec 17, 2025
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 0% with 146 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.94%. Comparing base (8772c07) to head (00be39a).
⚠️ Report is 114 commits behind head on develop.

Files with missing lines Patch % Lines
src/cosmic/output.py 0.00% 146 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #739      +/-   ##
===========================================
- Coverage    86.91%   77.94%   -8.97%     
===========================================
  Files           40       50      +10     
  Lines        25542    27327    +1785     
  Branches         0      903     +903     
===========================================
- Hits         22198    21298     -900     
- Misses        3344     5756    +2412     
- Partials         0      273     +273     

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant