mobspy package

Subpackages

Submodules

mobspy.simulation module

Main MobsPy module. It stocks the Simulation class which is responsible for simulating a Model

class mobspy.simulation.Simulation(model, names=None, parameters=None, plot_parameters=None)

Bases: object

compile(verbose=True)

Compiler method that calls the Compiler class in the modules directory

Parameters:

verbose – (bool) = print or not the results of the compilation

configure_parameters(config)

Configure simulation parameters from json file or dictionary

Parameters:

file_name – (str) name of the json file

configure_plot_parameters(config)

Configure plot parameters from json file or dictionary

Parameters:

file_name – (str) name of the json file

classmethod event_compilation_error()
event_condition(trigger, delay=0)

Context manager for condition events. Called in “with Simulation.event_condition(trigger) :” format.

Parameters:
  • trigger – () condition that triggers the event when fulfilled

  • delay – (int, float, Quantity) time to wait before triggering the event once the trigger condition has been fulfilled

event_context_add(time, trigger)

Adds an event to the event context

Parameters:
  • trigger – () condition that triggers the event when fulfilled

  • time – (int, float, Quantity) time to wait before triggering the event once the trigger condition has been fulfilled

event_context_finish()

Removes the context in all meta-species and resets some varaiables. Called each time an event context is finished.

event_context_initiator()

Sets the context in all meta-species. Called each time an event context is initiated.

event_time(time)

Context manager for time events. Called in “with Simulation.event_time(time) :” format.

Parameters:

time – (int, float, Quantity) any time used

extract_plot_essentials(*species)

Extract essential information for plotting

Parameters:

species – (meta-species objects) meta-species objects to plot

Returns:

species_strings (str) = species strings to be plotted, self.results = data resulting from the

simulation, self.plot_parameters (dict) = parameters for plotting

generate_sbml()

Generates sbmls strings from the current stored models in the simulation

“return: to_return (list of str) list of sbml files from all the simulations stored

classmethod is_simulation()
plot(*species)

Another way of calling plot_deterministic for simplicity

Parameters:

species – (str or meta-species objects) list of species to be plotted

plot_deterministic(*species)

Calls deterministic plot. See default_plots module in the plot_scripts directory

Parameters:

species – (str or meta-species objects) list of species to be plotted

plot_parametric(*species)
plot_raw(parameters_or_file)

Calls raw plot. See default_plots module in the plot_scripts directory

Parameters:

parameters_or_file – json file name with plot parameter configuration or dictionary with plot

parameter configuration

plot_stochastic(*species)

Calls stochastic plot. See default_plots module in the plot_scripts directory

Parameters:

species – (str or meta-species objects) list of species to be plotted

run()

Runs the simulation by colling the models in the sbml_simulator directory. Compiles the model if it was not yet compiled

save_data(file=None)

Saves the simulation result data to a file in json format

Parameters:

file – (str) name of the file to save the data to. If none a default name is provided

set_from_json(file_name)

Set simulation parameters from json file

Parameters:

file_name – (str) name of the json file

classmethod set_job_number(params)
class mobspy.simulation.SimulationComposition(S1, S2)

Bases: object

compile(verbose=True)
generate_sbml()
classmethod is_simulation()
plot(*species)
plot_deterministic(*species)
plot_raw(parameters_or_file)
plot_stochastic(*species)
run()

Module contents

MobsPy: A Query-Based Language for Chemical Reaction Networks