gillespy2.solvers.numpy package¶
Submodules¶
gillespy2.solvers.numpy.CLE_solver module¶
Class and methods for the CLE Solver
- class gillespy2.solvers.numpy.CLE_solver.CLESolver(model=None, debug=False)[source]¶
Bases:
GillesPySolver
A Chemical Langevin Equation Solver for GillesPy2 models.
This solver uses an algorithm that calculates multiple reactions in a single step over a given tau step size. The change in propensities over this step are bounded by bounding the relative change in state, yielding greatly improved run-time performance with very little trade-off in accuracy.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by CLE_solver.run. :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'CLESolver'¶
- pause_event = None¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, seed=None, debug=False, profile=False, live_output=None, live_output_options={}, timeout=None, resume=None, tau_tol=0.03, **kwargs)[source]¶
Function calling simulation of the model. This is typically called by the run function in GillesPy2 model objects and will inherit those parameters which are passed with the model as the arguments this run function.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – Simulation run time.
number_of_trajectories – The number of times to sample the chemical master equation. Each
trajectory will be returned at the end of the simulation. By default number_of_trajectories = 1. :type number_of_trajectories: int
- Parameters:
increment (float) – Save point increment for recording data.
seed (int) – The random seed for the simulation. Optional, defaults to None.
debug (bool) – Set to True to provide additional debug information about the simulation.
profile (bool) – Set to True to provide information about step size (tau) taken at each step.
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – Contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display.
timeout (int) – If set, if simulation takes longer than timeout, will exit.
resume (gillespy2.Results) – Result of a previously run simulation, to be resumed.
tau_tol (float) – Tolerance level for Tau leaping algorithm. Larger tolerance values will result in larger tau steps. Default value is 0.03.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶
gillespy2.solvers.numpy.ode_solver module¶
GillesPy2 Solver for ODE solutions.
- class gillespy2.solvers.numpy.ode_solver.ODESolver(model=None)[source]¶
Bases:
GillesPySolver
This solver produces the deterministic continuous solution via Ordinary Differential Equations. Uses integrators from scipy.integrate.ode to perform calculations used to produce solutions.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by ode_solver.run. :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'ODESolver'¶
- pause_event = None¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, integrator='lsoda', integrator_options={}, live_output=None, live_output_options={}, timeout=None, resume=None, **kwargs)[source]¶
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – End time of simulation.
number_of_trajectories – Number of trajectories to simulate. By default number_of_trajectories = 1.
This is deterministic and will always have same results. :type number_of_trajectories: int
- Parameters:
increment (float) – Time step increment for plotting.
integrator (str) – integrator to be used from scipy.integrate.ode. Options include ‘vode’, ‘zvode’, ‘lsoda’, ‘dopri5’, and ‘dop853’. For more details, see https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.ode.html
integrator_options (dict) – a dictionary containing options to the scipy integrator. for a list of options, see https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.ode.html. Example use: {max_step : 0, rtol : .01}
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – dictionary contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display.
timeout (int) – If set, if simulation takes longer than timeout, will exit.
resume (gillespy2.Results) – Result of a previously run simulation, to be resumed.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶
gillespy2.solvers.numpy.ssa_solver module¶
- class gillespy2.solvers.numpy.ssa_solver.NumPySSASolver(model=None)[source]¶
Bases:
GillesPySolver
This solver produces simulations of systems via Stochastic Simulation Algorithm.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by the ssa_solver.run :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'NumPySSASolver'¶
- pause_event = None¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, seed=None, debug=False, live_output=None, live_output_options={}, timeout=None, resume=None, **kwargs)[source]¶
Run the SSA algorithm. Uses a NumPy array for storing results and for generating the timeline.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – The end time of the solver.
number_of_trajectories (int) – Number of trajectories to simulate. By default number_of_trajectories = 1.
increment (float) – The time step of the solution.
seed (int) – The random seed for the simulation. Defaults to None.
debug (bool) – Set to True to provide additional debug information about the simulation.
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – dictionary contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display.
timeout (int) – If set, if simulation takes longer than timeout, will exit.
resume (gillespy2.Results) – Result of a previously run simulation, to be resumed.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶
gillespy2.solvers.numpy.tau_hybrid_solver module¶
- class gillespy2.solvers.numpy.tau_hybrid_solver.TauHybridSolver(model=None, profile_reactions=False, constant_tau_stepsize=None)[source]¶
Bases:
GillesPySolver
This solver uses a root-finding interpretation of the direct SSA method, along with ODE solvers to simulate ODE and Stochastic systems interchangeably or simultaneously. Uses integrators from scipy.integrate.ode to perform calculations used to produce solutions.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by tau_hybrid_solver.run. :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'TauHybridSolver'¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, seed=None, debug=False, profile=False, tau_tol=0.03, event_sensitivity=100, integrator_options={}, live_output=None, live_output_options={}, timeout=None, **kwargs)[source]¶
Function calling simulation of the model. This is typically called by the run function in GillesPy2 model objects and will inherit those parameters which are passed with the model as the arguments this run function.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – Simulation run time.
number_of_trajectories (int) – Number of trajectories to simulate. By default number_of_trajectories = 1.
increment (float) – Save point increment for recording data.
seed (int) – The random seed for the simulation. Optional, defaults to None.
debug (bool) – Set to True to provide additional debug information about the simulation.
profile (bool) – Set to True to provide information about step size (tau) taken at each step.
tau_tol – Tolerance level for Tau leaping algorithm. Larger tolerance values will
result in larger tau steps. Default value is 0.03. :type tau_tol: float
- Parameters:
event_sensitivity (int) – Number of data points to be inspected between integration steps/save points for event detection. Default event_sensitivity = 100
integrator_options (dict) – contains options to the scipy integrator. by default, this includes rtol=1e-9 and atol=1e-12. for a list of options, see https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.LSODA.html. Example use: {max_step : 0, rtol : .01}
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display
timeout (int) – If set, if simulation takes longer than timeout, will exit.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶
gillespy2.solvers.numpy.tau_leaping_solver module¶
Class and methods for the Tau Leaping Solver
- class gillespy2.solvers.numpy.tau_leaping_solver.TauLeapingSolver(model=None, debug=False, constant_tau_stepsize=None)[source]¶
Bases:
GillesPySolver
A Tau Leaping solver for GillesPy2 models. This solver uses an algorithm that calculates multiple reactions in a single step over a given tau step size. The change in propensities over this step are bounded by bounding the relative change in state, yielding greatly improved run-time performance with very little trade-off in accuracy.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by tau_leaping_solver.run. :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'TauLeapingSolver'¶
- pause_event = None¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, seed=None, debug=False, profile=False, live_output=None, live_output_options={}, timeout=None, resume=None, tau_tol=0.03, **kwargs)[source]¶
Function calling simulation of the model. This is typically called by the run function in GillesPy2 model objects and will inherit those parameters which are passed with the model as the arguments this run function.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – Simulation run time.
number_of_trajectories (int) – Number of trajectories to simulate. By default number_of_trajectories = 1.
increment (float) – Save point increment for recording data.
seed (int) – The random seed for the simulation. Optional, defaults to None.
debug (bool) – Set to True to provide additional debug information about the simulation.
profile (bool) – Set to True to provide information about step size (tau) taken at each step.
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – Contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display.
timeout (int) – If set, if simulation takes longer than timeout, will exit.
resume (gillespy2.Results) – Result of a previously run simulation, to be resumed.
tau_tol (float) – Tolerance level for Tau leaping algorithm. Larger tolerance values will result in larger tau steps. Default value is 0.03.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶
Module contents¶
- class gillespy2.solvers.numpy.CLESolver(model=None, debug=False)[source]¶
Bases:
GillesPySolver
A Chemical Langevin Equation Solver for GillesPy2 models.
This solver uses an algorithm that calculates multiple reactions in a single step over a given tau step size. The change in propensities over this step are bounded by bounding the relative change in state, yielding greatly improved run-time performance with very little trade-off in accuracy.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by CLE_solver.run. :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'CLESolver'¶
- pause_event = None¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, seed=None, debug=False, profile=False, live_output=None, live_output_options={}, timeout=None, resume=None, tau_tol=0.03, **kwargs)[source]¶
Function calling simulation of the model. This is typically called by the run function in GillesPy2 model objects and will inherit those parameters which are passed with the model as the arguments this run function.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – Simulation run time.
number_of_trajectories – The number of times to sample the chemical master equation. Each
trajectory will be returned at the end of the simulation. By default number_of_trajectories = 1. :type number_of_trajectories: int
- Parameters:
increment (float) – Save point increment for recording data.
seed (int) – The random seed for the simulation. Optional, defaults to None.
debug (bool) – Set to True to provide additional debug information about the simulation.
profile (bool) – Set to True to provide information about step size (tau) taken at each step.
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – Contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display.
timeout (int) – If set, if simulation takes longer than timeout, will exit.
resume (gillespy2.Results) – Result of a previously run simulation, to be resumed.
tau_tol (float) – Tolerance level for Tau leaping algorithm. Larger tolerance values will result in larger tau steps. Default value is 0.03.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶
- class gillespy2.solvers.numpy.NumPySSASolver(model=None)[source]¶
Bases:
GillesPySolver
This solver produces simulations of systems via Stochastic Simulation Algorithm.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by the ssa_solver.run :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'NumPySSASolver'¶
- pause_event = None¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, seed=None, debug=False, live_output=None, live_output_options={}, timeout=None, resume=None, **kwargs)[source]¶
Run the SSA algorithm. Uses a NumPy array for storing results and for generating the timeline.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – The end time of the solver.
number_of_trajectories (int) – Number of trajectories to simulate. By default number_of_trajectories = 1.
increment (float) – The time step of the solution.
seed (int) – The random seed for the simulation. Defaults to None.
debug (bool) – Set to True to provide additional debug information about the simulation.
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – dictionary contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display.
timeout (int) – If set, if simulation takes longer than timeout, will exit.
resume (gillespy2.Results) – Result of a previously run simulation, to be resumed.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶
- class gillespy2.solvers.numpy.ODESolver(model=None)[source]¶
Bases:
GillesPySolver
This solver produces the deterministic continuous solution via Ordinary Differential Equations. Uses integrators from scipy.integrate.ode to perform calculations used to produce solutions.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by ode_solver.run. :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'ODESolver'¶
- pause_event = None¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, integrator='lsoda', integrator_options={}, live_output=None, live_output_options={}, timeout=None, resume=None, **kwargs)[source]¶
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – End time of simulation.
number_of_trajectories – Number of trajectories to simulate. By default number_of_trajectories = 1.
This is deterministic and will always have same results. :type number_of_trajectories: int
- Parameters:
increment (float) – Time step increment for plotting.
integrator (str) – integrator to be used from scipy.integrate.ode. Options include ‘vode’, ‘zvode’, ‘lsoda’, ‘dopri5’, and ‘dop853’. For more details, see https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.ode.html
integrator_options (dict) – a dictionary containing options to the scipy integrator. for a list of options, see https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.ode.html. Example use: {max_step : 0, rtol : .01}
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – dictionary contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display.
timeout (int) – If set, if simulation takes longer than timeout, will exit.
resume (gillespy2.Results) – Result of a previously run simulation, to be resumed.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶
- class gillespy2.solvers.numpy.TauHybridSolver(model=None, profile_reactions=False, constant_tau_stepsize=None)[source]¶
Bases:
GillesPySolver
This solver uses a root-finding interpretation of the direct SSA method, along with ODE solvers to simulate ODE and Stochastic systems interchangeably or simultaneously. Uses integrators from scipy.integrate.ode to perform calculations used to produce solutions.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by tau_hybrid_solver.run. :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'TauHybridSolver'¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, seed=None, debug=False, profile=False, tau_tol=0.03, event_sensitivity=100, integrator_options={}, live_output=None, live_output_options={}, timeout=None, **kwargs)[source]¶
Function calling simulation of the model. This is typically called by the run function in GillesPy2 model objects and will inherit those parameters which are passed with the model as the arguments this run function.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – Simulation run time.
number_of_trajectories (int) – Number of trajectories to simulate. By default number_of_trajectories = 1.
increment (float) – Save point increment for recording data.
seed (int) – The random seed for the simulation. Optional, defaults to None.
debug (bool) – Set to True to provide additional debug information about the simulation.
profile (bool) – Set to True to provide information about step size (tau) taken at each step.
tau_tol – Tolerance level for Tau leaping algorithm. Larger tolerance values will
result in larger tau steps. Default value is 0.03. :type tau_tol: float
- Parameters:
event_sensitivity (int) – Number of data points to be inspected between integration steps/save points for event detection. Default event_sensitivity = 100
integrator_options (dict) – contains options to the scipy integrator. by default, this includes rtol=1e-9 and atol=1e-12. for a list of options, see https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.LSODA.html. Example use: {max_step : 0, rtol : .01}
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display
timeout (int) – If set, if simulation takes longer than timeout, will exit.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶
- class gillespy2.solvers.numpy.TauLeapingSolver(model=None, debug=False, constant_tau_stepsize=None)[source]¶
Bases:
GillesPySolver
A Tau Leaping solver for GillesPy2 models. This solver uses an algorithm that calculates multiple reactions in a single step over a given tau step size. The change in propensities over this step are bounded by bounding the relative change in state, yielding greatly improved run-time performance with very little trade-off in accuracy.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate.
- classmethod get_solver_settings()[source]¶
Returns a list of arguments supported by tau_leaping_solver.run. :returns: Tuple of strings, denoting all keyword argument for this solvers run() method. :rtype: tuple
- name = 'TauLeapingSolver'¶
- pause_event = None¶
- rc = 0¶
- result = None¶
- run(model=None, t=None, number_of_trajectories=1, increment=None, seed=None, debug=False, profile=False, live_output=None, live_output_options={}, timeout=None, resume=None, tau_tol=0.03, **kwargs)[source]¶
Function calling simulation of the model. This is typically called by the run function in GillesPy2 model objects and will inherit those parameters which are passed with the model as the arguments this run function.
- Parameters:
model (gillespy2.Model) – The model on which the solver will operate. (Deprecated)
t (int or float) – Simulation run time.
number_of_trajectories (int) – Number of trajectories to simulate. By default number_of_trajectories = 1.
increment (float) – Save point increment for recording data.
seed (int) – The random seed for the simulation. Optional, defaults to None.
debug (bool) – Set to True to provide additional debug information about the simulation.
profile (bool) – Set to True to provide information about step size (tau) taken at each step.
live_output (str) – The type of output to be displayed by solver. Can be “progress”, “text”, or “graph”.
live_output_options (dict) – Contains options for live_output. By default {“interval”:1}. “interval” specifies seconds between displaying. “clear_output” specifies if display should be refreshed with each display.
timeout (int) – If set, if simulation takes longer than timeout, will exit.
resume (gillespy2.Results) – Result of a previously run simulation, to be resumed.
tau_tol (float) – Tolerance level for Tau leaping algorithm. Larger tolerance values will result in larger tau steps. Default value is 0.03.
- Returns:
A result object containing the results of the simulation.
- Return type:
gillespy2.Results
- stop_event = None¶