Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset RATEs don't always honor Initial Assignments #819

Open
luciansmith opened this issue Sep 8, 2021 · 1 comment
Open

Reset RATEs don't always honor Initial Assignments #819

luciansmith opened this issue Sep 8, 2021 · 1 comment
Labels

Comments

@luciansmith
Copy link

luciansmith commented Sep 8, 2021

The basic problem is that internally, the list of initial values for a species (both floating and boundary) behave slightly differently from the lists of initial values for a compartment or parameter. The species list seems to use initial values for other species and not current values, even when the initial values are not being reset. In contrast, the compartment/parameters lists seem to use current values appropriately.

This can be seen in the ResetManyCompartments and ResetManyParameters tests vs. the ResetManyFloatingSpecies and ResetManyBoundarySpecies tests (found in test/model_analysis/model_analysis.cpp)

This is a pretty obscure case, but I figured I should go ahead and file it.

The following python script illustrates the problem:

import tellurium as te
import roadrunner

r = te.loada("""
species C1, C5;

// Rate Rules:
C5' = 1.5;

// Events:
E0: at time > 1: C1 = 10;

// Species initializations:
C1 = 1;
C5 = 4 + C1;
""")

r.simulate()
r.reset(roadrunner.SelectionRecord.RATE)
print("Reset C5 when it's a species:", r.getValue("C5"))


r = te.loada("""
var C1, C5;

// Rate Rules:
C5' = 1.5;

// Events:
E0: at time > 1: C1 = 10;

// Species initializations:
C1 = 1;
C5 = 4 + C1;
""")

r.simulate()
r.reset(roadrunner.SelectionRecord.RATE)
print("Reset C5 when it's a parameter:", r.getValue("C5"))

This outputs:

Reset C5 when it's a species: 5.0
Reset C5 when it's a parameter: 14.0

The correct value is 14: C5 should be 4+C1, and C1 is still 10, since it wasn't reset.

@luciansmith
Copy link
Author

Update: it seems to matter that C1 (the thing under control of an event) is the species:

r = te.loada("""
species C1
var C5;

// Rate Rules:
C5' = 1.5;

// Events:
E0: at time > 1: C1 = 10;

// Species initializations:
C1 = 1;
C5 = 4 + C1;
""")

r.simulate()
r.reset(roadrunner.SelectionRecord.RATE)
print("Reset C5 when it's a species:", r.getValue("C5"))

(Also returns '5'.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant