Skip to content

petab1to2: keep pre-equilibration for conditions that set nothing - #533

Merged
FFroehlich merged 1 commit into
mainfrom
claude/issue-530-preeq-empty-condition-1ea8c8
Oct 8, 2026
Merged

FFroehlich merged 1 commit into
mainfrom
claude/issue-530-preeq-empty-condition-1ea8c8

Conversation

@FFroehlich

Copy link
Copy Markdown
Collaborator

Closes #530

petab1to2 used to decide globally whether condition IDs are dropped: if the v1 condition table had no columns besides conditionId, 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:

  • A period that applies a v1 condition without any changes (an all-NaN row, not written to the v2 condition table) gets an empty conditionId, which means "use the model as is".
  • An experiment is created whenever there is a pre-equilibration or the simulation condition changes something. Pre-equilibration with a condition that sets nothing is kept as a -inf period.
  • Without pre-equilibration and without changes, no experiment is created, as before.

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:

--- conditions set nothing: experimentIds in measurements ['experiment__steady___c0']
           experimentId  time conditionId
experiment__steady___c0  -inf
experiment__steady___c0   0.0
--- conditions set A: experimentIds in measurements ['experiment__steady___c0']
           experimentId  time conditionId
experiment__steady___c0  -inf      steady
experiment__steady___c0   0.0          c0

Testing:

  • New tests in tests/v2/test_conversion.py cover 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/v2 passes.
  • I converted all benchmark-collection models (except Froehlich_CellSystems2018) with main and with this branch. The output is identical, apart from the random uuid4 column name that both versions generate when they rename an existing experimentId column.

🤖 Generated with Claude Code

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>
@FFroehlich
FFroehlich requested a review from a team as a code owner October 8, 2026 12:31
Copilot AI balanced review requested due to automatic review settings October 8, 2026 12:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.50%. Comparing base (2610499) to head (cd05a13).

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

@dilpath dilpath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@FFroehlich
FFroehlich merged commit 78dabf4 into main Oct 8, 2026
14 checks passed
@FFroehlich
FFroehlich deleted the claude/issue-530-preeq-empty-condition-1ea8c8 branch October 8, 2026 17:40
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.

petab1to2: pre-equilibration is dropped when the condition table sets nothing

4 participants