Reactions and Species

Events are the principle way users can attach connect thier own functions, and built in methods event triggers.

mechanica.on_time(method, period[, start][, end][, distribution])

Binds a function or method to a elapsed time interval.

on_time must be called with all keyword arguments, since there are a large number of options this method accepts.

Parameters:
  • method – A Python function or method that will get called. Signature of the method should be method(time), in that it gets a single current time argument.
  • period (float) – Time interval that the event should get fired.
  • start (float) – [optional] Start time for the event.
  • end (float) – [optional] end time for the event.
  • distribution (str) – [optional] String that identifies the statistical distribution for event times. Only supported distibution currently is “exponential”. If there is no distibution argument, the event is called deterministically.