Skip to content

Commit

Permalink
Cleanup time symbols (#2096)
Browse files Browse the repository at this point in the history
We have too many definitions of time ...
  • Loading branch information
dweindl authored May 17, 2023
1 parent d0a12c4 commit 7f52e91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 3 additions & 2 deletions python/sdist/amici/de_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
from .cxxcodeprinter import AmiciCxxCodePrinter, get_switch_statement
from .de_model import *
from .import_utils import (
amici_time_symbol,
ObservableTransformation,
SBMLException,
generate_flux_symbol,
Expand Down Expand Up @@ -1012,7 +1013,7 @@ def transform_dxdt_to_concentration(species_id, dxdt):
# we need to flatten out assignments in the compartment in
# order to ensure that we catch all species dependencies
v = smart_subs_dict(v, si.symbols[SymbolId.EXPRESSION], "value")
dv_dt = v.diff(si.amici_time_symbol)
dv_dt = v.diff(amici_time_symbol)
# we may end up with a time derivative of the compartment
# volume due to parameter rate rules
comp_rate_vars = [
Expand Down Expand Up @@ -1733,7 +1734,7 @@ def _compute_equation(self, name: str) -> None:
.replace("sigmarz", "sigmaz")
.replace("dJrzdz", "dJrzdrz")
)
time_symbol = sp.Matrix([symbol_with_assumptions("t")])
time_symbol = sp.Matrix([amici_time_symbol])

if name in self._equation_prototype:
self._equation_from_components(name, self._equation_prototype[name]())
Expand Down
8 changes: 4 additions & 4 deletions python/sdist/amici/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ def __init__(self, data):

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


sbml_time_symbol = sp.Symbol("time", real=True)
amici_time_symbol = sp.Symbol("t", real=True)

annotation_namespace = "https://github.com/AMICI-dev/AMICI"


Expand Down Expand Up @@ -712,3 +708,7 @@ def strip_pysb(symbol: sp.Basic) -> sp.Basic:
else:
# in this case we will use sympy specific transform anyways
return symbol


sbml_time_symbol = symbol_with_assumptions("time")
amici_time_symbol = symbol_with_assumptions("t")
4 changes: 0 additions & 4 deletions python/sdist/amici/sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -1253,10 +1253,6 @@ def _process_time(self) -> None:
"""
Convert time_symbol into cpp variable.
"""
sbml_time_symbol = symbol_with_assumptions("time")
amici_time_symbol = symbol_with_assumptions("t")
self.amici_time_symbol = amici_time_symbol

self._replace_in_all_expressions(sbml_time_symbol, amici_time_symbol)

def _convert_event_assignment_parameter_targets_to_species(self):
Expand Down

0 comments on commit 7f52e91

Please sign in to comment.