Skip to content

v1: use initial assignments for NaN in the condition table - #656

Open
dweindl wants to merge 1 commit into
PEtab-dev:mainfrom
dweindl:fix-condition-nan-initial-assignment
Open

dweindl wants to merge 1 commit into
PEtab-dev:mainfrom
dweindl:fix-condition-nan-initial-assignment

Conversation

@dweindl

@dweindl dweindl commented Dec 2, 2026

Copy link
Copy Markdown
Member

NaN in the condition table means that the model value is used. For model parameters, _apply_condition_parameters used the SBML value attribute and ignored initial assignments, and get_model_for_condition then also removed the initial assignment.

Now, for a NaN entry, the parameter keeps the model value from the initial mapping (get_free_parameter_ids_with_values), which takes numeric initial assignments into account. Parameters with non-numeric initial assignments remain unmapped, so that the initial assignment applies, consistent with #643. As a consequence, per-condition mappings may differ in their keys.

If such a parameter is unmapped for only one of the preequilibration and simulation conditions, get_optimization_to_simulation_parameter_mapping raises a ValueError. Otherwise, merge_preeq_and_sim_pars_condition would silently use the other value for both.

Also fixes an AttributeError in get_model_for_condition for unmapped parameters if there is no parameter table.

Closes #649.

🤖 Generated with Claude Code

@codecov-commenter

codecov-commenter commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.52%. Comparing base (b694a77) to head (2e107cc).

Files with missing lines Patch % Lines
petab/v1/parameter_mapping.py 87.50% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #656      +/-   ##
==========================================
+ Coverage   81.45%   81.52%   +0.07%     
==========================================
  Files          76       76              
  Lines        8906     8919      +13     
  Branches     1631     1636       +5     
==========================================
+ Hits         7254     7271      +17     
+ Misses       1171     1169       -2     
+ Partials      481      479       -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.

`NaN` in the condition table means that the model value is used. For
model parameters, `_apply_condition_parameters` used the SBML `value`
attribute and ignored initial assignments; `get_model_for_condition`
then also removed the initial assignment.

Now, the parameter keeps the model value from the initial mapping,
which takes numeric initial assignments into account. Parameters with
non-numeric initial assignments remain unmapped, so that the initial
assignment applies.

If such a parameter is unmapped for only one of preequilibration and
simulation, raise a `ValueError` instead of letting
`merge_preeq_and_sim_pars_condition` silently use the other value.

Closes PEtab-dev#649.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dweindl
dweindl force-pushed the fix-condition-nan-initial-assignment branch from 9f903b9 to 2e107cc Compare December 2, 2026 10:56
@dweindl dweindl self-assigned this Dec 2, 2026
@dweindl
dweindl marked this pull request as ready for review December 2, 2026 11:18
@dweindl
dweindl requested a review from a team as a code owner December 2, 2026 11:18
@dweindl
dweindl requested a review from FFroehlich December 2, 2026 11:18

This branch has not been deployed

No deployments
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.

v1: NaN in the condition table uses the SBML value attribute instead of the initial assignment

2 participants