E-Cell4 util API

ecell4.util.run_simulation(t, y0={}, volume=1.0, model=None, solver='ode', is_netfree=False, species_list=None, without_reset=False, return_type='matplotlib', opt_args=(), opt_kwargs={}, structures={}, observers=(), progressbar=0, rndseed=None, factory=None, **kwargs)

Run a simulation with the given model and plot the result on IPython notebook with matplotlib.


t : array or Real

A sequence of time points for which to solve for ‘m’.

y0 : dict

Initial condition.

volume : Real or Real3, optional

A size of the simulation volume. Keyword ‘v’ is a shortcut for specifying ‘volume’.

model : Model, optional

Keyword ‘m’ is a shortcut for specifying ‘model’.

solver : str, tuple or Factory, optional

Solver type. Choose one from ‘ode’, ‘gillespie’, ‘spatiocyte’, ‘meso’, ‘bd’ and ‘egfrd’. Default is ‘ode’. When tuple is given, the first value must be str as explained above. All the rest is used as arguments for the corresponding factory class. Keyword ‘s’ is a shortcut for specifying ‘solver’.

species_list : list of str, optional

A list of names of Species observed. If None, log all. Default is None.

return_type : str, optional

Choose a type of return value from ‘array’, ‘observer’, ‘matplotlib’, ‘nyaplot’, ‘world’, ‘dataframe’ or None. If None, return and plot nothing. Default is ‘matplotlib’. ‘dataframe’ requires numpy and pandas libraries. Keyword ‘r’ is a shortcut for specifying ‘return_type’.

opt_args: list, tuple or dict, optional

Arguments for plotting. If return_type suggests no plotting, just ignored.

opt_kwargs: dict, optional

Arguments for plotting. If return_type suggests no plotting or opt_args is a list or tuple, just ignored. i.e.) viz.plot_number_observer(obs, *opt_args, **opt_kwargs)

is_netfree: bool, optional

Whether the model is netfree or not. When a model is given as an argument, just ignored. Default is False.

structures : dict, optional

A dictionary which gives pairs of a name and shape of structures. Not fully supported yet.

observers : Observer or list, optional

A list of extra observer references.

progressbar : float, optional

A timeout for a progress bar in seconds. When the value is not more than 0, show nothing. Default is 0.

rndseed : int, optional

A random seed for a simulation. This argument will be ignored when ‘solver’ is given NOT as a string.


value : list, TimingNumberObserver, World or None

Return a value suggested by return_type. When return_type is ‘array’, return a time course data. When return_type is ‘observer’, return an observer. When return_type is ‘world’, return the last state of World. Return nothing if else.

ecell4.util.ensemble_simulations(N=1, *args, **kwargs)



Load a world from the given HDF5 filename. The return type is determined by ecell4.core.load_version_information.


filename : str

A HDF5 filename.


w : World

Return one from BDWorld, EGFRDWorld, MesoscopicWorld, ODEWorld, GillespieWorld and SpatiocyteWorld.

ecell4.util.get_model(is_netfree=False, without_reset=False, seeds=None, effective=False)

Generate a model with parameters in the global scope, SPECIES_ATTRIBUTES and REACTIONRULES.


is_netfree : bool, optional

Return NetfreeModel if True, and NetworkModel if else. Default is False.

without_reset : bool, optional

Do not reset the global variables after the generation if True. Default is False.

seeds : list, optional

A list of seed Species for expanding the model. If this is not None, generate a NetfreeModel once, and return a NetworkModel, which is an expanded form of that with the given seeds. Default is None.

effective : bool, optional

See NetfreeModel.effective and Netfree.set_effective. Only meaningfull with option is_netfree=True. Default is False


model : NetworkModel, NetfreeModel, or ODENetworkModel

ecell4.util.show(target, *args, **kwargs)

An utility function to display the given target object in the proper way.