2.1.1.3.1.1. wc_sim.submodels.testing package

2.1.1.3.1.1.1. Submodules

2.1.1.3.1.1.2. wc_sim.submodels.testing.deterministic_simulation_algorithm module

A deterministic version of SSA for testing DynamicSubmodel and multialgorithmic simulation

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Date

2019-10-15

Copyright

2019, Karr Lab

License

MIT

class wc_sim.submodels.testing.deterministic_simulation_algorithm.DsaSubmodel(id, dynamic_model, reactions, species, dynamic_compartments, local_species_population, options=None)[source]

Bases: wc_sim.submodels.dynamic_submodel.DynamicSubmodel

Init a DsaSubmodel

The Deterministic Simulation Algorithm (DSA) is a deterministic version of the Stochastic Simulation Algorithm. Each reaction executes deterministically at the rate determined by its rate law, which is achieved by scheduling the next execution of a reaction when the reaction executes. E.g., if reaction R executes at time t and R’s rate law has a rate of r then, the next execution of R will occur at time t + 1/r.

reaction_table[source]

map from reaction id to reaction index in self.reactions

Type

dict

MESSAGE_TYPES_BY_PRIORITY = [<class 'de_sim.event_message.ExecuteDsaReaction'>][source]
SENT_MESSAGE_TYPES = [<class 'de_sim.event_message.ExecuteDsaReaction'>][source]
event_handlers = [(<class 'de_sim.event_message.ExecuteDsaReaction'>, 'handle_ExecuteDsaReaction_msgs')][source]
execute_dsa_reaction(event)[source]

Handle a simulation event that contains an ExecuteDsaReaction message

Parameters

event (Event) – an Event to execute

:raises DynamicMultialgorithmError: if the reaction does not have sufficient reactants to execute:

handle_ExecuteDsaReaction_msgs(event_or_events)[source]

Handle one or more simulation event(s) that contain an ExecuteDsaReaction message

Reactions with the same rates will occur simultaneously and be superposed.

Parameters

event_or_events (obj) – an Event to execute or a list of Event to execute

:raises DynamicMultialgorithmError: if the reaction does not have sufficient reactants to execute:

init_before_run()[source]

Send this DSA submodel’s initial events

Schedule initial reactions at time 1 / (2 rate) so that the linear approximation for the number of times a reaction with constant rate r has executed is y = rate x.

This method overrides a DynamicSubmodel method.

messages_sent = [<class 'de_sim.event_message.ExecuteDsaReaction'>][source]
metadata = <de_sim.simulation_object.SimulationObjectMetadata object>[source]
schedule_ExecuteDsaReaction(dt, reaction_index)[source]

Schedule an ExecuteDsaReaction event.

Parameters
  • dt (float) – simulation delay until the event containing ExecuteDsaReaction executes

  • reaction_index (int) – index of the reaction to execute

schedule_next_reaction_execution(reaction)[source]

Schedule the next execution of a reaction

Parameters

reaction (Reaction) – the reaction being scheduled

2.1.1.3.1.1.3. Module contents