Skip to content

Commit

Permalink
Fix execution of multiple event assignments from the same event
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed May 7, 2024
1 parent da19a55 commit ea0df7d
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions python/sdist/amici/sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -1660,21 +1660,16 @@ def get_empty_bolus_value() -> sp.Float:
for species_sym in concentration_species_by_compartment[
compartment_sym
]:
# If the species was not affected by an event assignment
# then the old value should be updated.
# Only if the species was not affected by any other event
# assignment, the old value should be updated.
if (
bolus[state_vector.index(species_sym)]
== get_empty_bolus_value()
):
species_value = species_sym
# else the species was affected by an event assignment,
# hence the updated value should be updated further.
else:
species_value = bolus[state_vector.index(species_sym)]
# New species value is old amount / new volume.
bolus[state_vector.index(species_sym)] = (
species_value * compartment_sym / formula
)
# New species value is old amount / new volume.
bolus[state_vector.index(species_sym)] = (
species_sym * compartment_sym / formula
)

# Subtract the current species value from each species with an
# update, as the bolus will be added on to the current species
Expand Down

0 comments on commit ea0df7d

Please sign in to comment.