Repository navigation
assignments_to_experiments: keep the period that starts an experiment - #559
Draft
FFroehlich wants to merge 1 commit into
Draft
FFroehlich wants to merge 1 commit into
FFroehlich wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## claude/assignments-to-experiments-ramps #559 +/- ##
========================================================================
Coverage 78.12% 78.13%
========================================================================
Files 68 68
Lines 7846 7847 +1
Branches 1403 1403
========================================================================
+ Hits 6130 6131 +1
Misses 1228 1228
Partials 488 488 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
FFroehlich
added this pull request to stack #558
October 19, 2026 13:29
FFroehlich
force-pushed
the
claude/assignments-to-experiments-start-time
branch
from
October 19, 2026 13:32
590c2bc to
26ed6ec
Compare
A period's time overrides the model's initial time, so an experiment starts at its first period after preequilibration. The converter dropped that period when nothing changed there, either as redundant, since the model already holds the value before the switch, or because its condition only set symbols that the conversion replaced. The experiment then started at its first switch, and measurements before the switch were simulated from the wrong start. The period that starts each experiment now stays, without conditions if none are left. A switch therefore never becomes an experiment's first period, and a start value that equals the model's no longer needs to be set when a switch refers to symbols outside the parameter table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FFroehlich
force-pushed
the
claude/assignments-to-experiments-start-time
branch
from
October 19, 2026 18:33
26ed6ec to
d61c2d0
Compare
This branch has not been deployed
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.
A v2 period's
timeoverrides the model's initial time, so an experiment starts at its first period after pre-equilibration.assignments_to_experimentsdropped that period whenever nothing changed there. Either it was redundant, because the model already holds the value before the switch, or its condition only set symbols that the conversion replaced, so the condition was emptied and removed. The experiment then started at its first switch, and measurements before the switch were simulated from the wrong start.For example,
k1 := piecewise(1, time < 5, 2)converted todefault_experimentwith a single period at t = 5. The existingtest_assignments_to_experimentsasserted that shape: one period at t = 10, beside a measurement at t = 0.Changes
default_experiment, and for an experiment that only pre-equilibrates, that is the period at t = 0 the converter already adds. Theor experiment.periods[:1]fallback goes, since the start period is never dropped.CheckInitialChangeSymbolsonly checks the first period. A start value that equals the model's value is no longer set just because a switch refers to symbols outside the parameter table. Forlevel * piecewise(0, time < 10, 1), the experiment now has an empty period at 0 andk1 = levelat 10, where it hadk1 = 0at 0 andk1 = levelat 10. A start value that refers to parameter table symbols is still set at the start (as since assignments_to_experiments: convert assignments that switch more than once #556), since the model only holds a number for it.Tests
test_assignments_to_experiments,_nested,_condition_specific,_several_switchesand_fixed_switching_timenow expect the empty period at t = 0.test_assignments_to_experiments_simulate_before_switchcovers both cases: no experiment, and a condition at t = 0 that only sets the switching time. It converts the problem, turns both the original and the converted problem into SBML events withExperimentsToSbmlConverter, simulates them in BasiCO at t = 0, 1, 2, 4, 6 and 10, and compares the results. They match to 3e-11 relative (the test asserts 1e-6). Without this fix, the converted problem is off by up to 45% before the switch.Relation to #557
Stacked on #557; #556 is merged. The bug has been on main since #527. On main the change merges cleanly as text, but main's
test_assignments_to_experiments_several_switchesand_fixed_switching_timeassert the old shape, with no period at t = 0, and #557 reworks theredundantblock that this change simplifies. This PR's base moves to main once #557 merges.🤖 Generated with Claude Code