Skip to content

Commit 7f52e91

Browse files
authored
Cleanup time symbols (#2096)
We have too many definitions of time ...
1 parent d0a12c4 commit 7f52e91

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

python/sdist/amici/de_export.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from .cxxcodeprinter import AmiciCxxCodePrinter, get_switch_statement
5252
from .de_model import *
5353
from .import_utils import (
54+
amici_time_symbol,
5455
ObservableTransformation,
5556
SBMLException,
5657
generate_flux_symbol,
@@ -1012,7 +1013,7 @@ def transform_dxdt_to_concentration(species_id, dxdt):
10121013
# we need to flatten out assignments in the compartment in
10131014
# order to ensure that we catch all species dependencies
10141015
v = smart_subs_dict(v, si.symbols[SymbolId.EXPRESSION], "value")
1015-
dv_dt = v.diff(si.amici_time_symbol)
1016+
dv_dt = v.diff(amici_time_symbol)
10161017
# we may end up with a time derivative of the compartment
10171018
# volume due to parameter rate rules
10181019
comp_rate_vars = [
@@ -1733,7 +1734,7 @@ def _compute_equation(self, name: str) -> None:
17331734
.replace("sigmarz", "sigmaz")
17341735
.replace("dJrzdz", "dJrzdrz")
17351736
)
1736-
time_symbol = sp.Matrix([symbol_with_assumptions("t")])
1737+
time_symbol = sp.Matrix([amici_time_symbol])
17371738

17381739
if name in self._equation_prototype:
17391740
self._equation_from_components(name, self._equation_prototype[name]())

python/sdist/amici/import_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ def __init__(self, data):
5454

5555
setattr(sys.modules["toposort"], "CircularDependencyError", CircularDependencyError)
5656

57-
58-
sbml_time_symbol = sp.Symbol("time", real=True)
59-
amici_time_symbol = sp.Symbol("t", real=True)
60-
6157
annotation_namespace = "https://github.com/AMICI-dev/AMICI"
6258

6359

@@ -712,3 +708,7 @@ def strip_pysb(symbol: sp.Basic) -> sp.Basic:
712708
else:
713709
# in this case we will use sympy specific transform anyways
714710
return symbol
711+
712+
713+
sbml_time_symbol = symbol_with_assumptions("time")
714+
amici_time_symbol = symbol_with_assumptions("t")

python/sdist/amici/sbml_import.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,10 +1253,6 @@ def _process_time(self) -> None:
12531253
"""
12541254
Convert time_symbol into cpp variable.
12551255
"""
1256-
sbml_time_symbol = symbol_with_assumptions("time")
1257-
amici_time_symbol = symbol_with_assumptions("t")
1258-
self.amici_time_symbol = amici_time_symbol
1259-
12601256
self._replace_in_all_expressions(sbml_time_symbol, amici_time_symbol)
12611257

12621258
def _convert_event_assignment_parameter_targets_to_species(self):

0 commit comments

Comments
 (0)