Skip to content

refactor: simplify sample merging and fix edge case when all samples are affected#558

Merged
alexander-held merged 5 commits intomasterfrom
refactor/sample-merging
Mar 16, 2026
Merged

refactor: simplify sample merging and fix edge case when all samples are affected#558
alexander-held merged 5 commits intomasterfrom
refactor/sample-merging

Conversation

@alexander-held
Copy link
Copy Markdown
Member

@alexander-held alexander-held commented Mar 3, 2026

This is a follow-up to #505 which simplifies the sample merging machinery to better handle edge cases. Tests are updated accordingly. The docstrings now also highlight that this can be used to rename or reorder samples.

sample_update_map is now required by both LightConfig and LightModel, as other cases can be handled fine by the original model. It is still possible to use sample_update_map = {} if needed. _merge_sample_yields now only operates on 2d inputs, which simplifies the implementation. This works by flipping the order of when it is called in prediction. The merging logic from _update_samples is integrated into LightConfig.__init__ and simplified.

resolves #539
resolves #485 (already possible prior to this, but did not work due to #539 when reordering everything)

* simplify sample merging infrastructure
* fix edge case when all samples are getting merged, renamed, or reordered

@alexander-held alexander-held changed the title refactor: simplify sample merging fix: allow merging / renaming / reordering all samples and simplify sample merging Mar 3, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6d2f8e2) to head (066f3de).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #558   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         2145      2132   -13     
  Branches       302       300    -2     
=========================================
- Hits          2145      2132   -13     

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

@alexander-held alexander-held changed the title fix: allow merging / renaming / reordering all samples and simplify sample merging fix: allow merging, renaming, and reordering of all samples Mar 4, 2026
@alexander-held alexander-held changed the title fix: allow merging, renaming, and reordering of all samples refactor: simplify sample merging and fix edge case when all samples are affected Mar 4, 2026
@alexander-held alexander-held requested a review from MoAly98 March 9, 2026 13:38
@MoAly98
Copy link
Copy Markdown
Collaborator

MoAly98 commented Mar 13, 2026

hi @alexander-held ! I think this looks great and cleans up a lot of the codebase. I am wondering if we maybe want to include an integration-type test that makes sure things like visualisation are impacted by the sample merging and reordering, whie fit results are not? (or do we have these already and I am forgetting?)

@alexander-held
Copy link
Copy Markdown
Member Author

Thanks! An integration test is a good idea, I propose to add one in a follow-up and opened #559 to track. This already contains a lot of changes so hopefully doing it in a separate PR makes things a bit easier to keep track.

@MoAly98
Copy link
Copy Markdown
Collaborator

MoAly98 commented Mar 13, 2026

cool i think this in general looks great. It would be good if we can maybe add some more info in the PR summary to explain the changes for future, but otherwise all is good!

@alexander-held
Copy link
Copy Markdown
Member Author

Good point, I extended the description in the body a bit.

@alexander-held alexander-held merged commit d5e3a14 into master Mar 16, 2026
11 checks passed
@alexander-held alexander-held deleted the refactor/sample-merging branch March 16, 2026 14:26
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.

Edge-case failure in sample merging Manually specify order for samples in data/MC plot

2 participants