Repository navigation
petab1to2: keep pre-equilibration for conditions that set nothing - #533
Merged
Merged
Conversation
Decide condition-wise instead of globally whether a v1 condition ends up
in the v2 condition table. A period applying a condition without any
changes gets an empty conditionId ("use the model as is") instead of
being dropped. Hence, pre-equilibration with a condition that changes
nothing is kept as a -inf period, and experiments that combine empty and
non-empty conditions no longer reference conditions missing from the v2
condition table (which previously failed linting).
Closes #530
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused conversion fix matches PEtab v2 semantics and is comprehensively tested.
0 open findings
What changed in this PR
Fixes PEtab v1-to-v2 conversion so empty conditions preserve pre-equilibration semantics.
Changes:
- Resolves condition IDs per condition rather than globally.
- Preserves empty-condition pre-equilibration periods.
- Adds coverage for empty and mixed condition tables.
| File | Description |
|---|---|
petab/v2/petab1to2.py |
Handles empty conditions per experiment period. |
tests/v2/test_conversion.py |
Tests pre-equilibration and mixed empty-condition cases. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #533 +/- ##
==========================================
+ Coverage 76.15% 76.50% +0.35%
==========================================
Files 67 67
Lines 7528 7526 -2
Branches 1342 1341 -1
==========================================
+ Hits 5733 5758 +25
+ Misses 1294 1269 -25
+ Partials 501 499 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #530
petab1to2used to decide globally whether condition IDs are dropped: if the v1 condition table had no columns besidesconditionId, all condition IDs were blanked, including pre-equilibration ones. As a result, the experiment disappeared and the problem was simulated without pre-equilibration.This is now decided per condition, which resolves the existing TODO:
conditionId, which means "use the model as is".-infperiod.This also fixes mixed condition tables, where only the pre-equilibration condition or only the simulation condition sets something. Previously, the generated experiment referenced a condition that was missing from the v2 condition table, and the conversion failed with
Experiment ... requires conditions that are not present in the condition table.Repro from the issue, after this change:
Testing:
tests/v2/test_conversion.pycover three cases: an all-empty condition table with pre-equilibration, a mixed table (all combinations of empty and non-empty pre-equilibration and simulation conditions, with and without pre-equilibration), and an all-empty table without pre-equilibration.pytest tests/v2passes.mainand with this branch. The output is identical, apart from the randomuuid4column name that both versions generate when they rename an existingexperimentIdcolumn.🤖 Generated with Claude Code