simulation

Handle the basics of running parallel simulations

Classes:

Simulation
Framework for a basic simulation
class simulations.simulation.Simulation(data, iteration, outfile, *args, **kwdargs)[source]

Bases: simulations.base.Base

Base class for an individual simulation

Parameters:

data
The data dictionary for the simulation. Usually created by the SimulationRunner
iteration
The iteration number of the simulation. Usually handled by the SimulationRunner
outfile
The name of a file to which to dump output (or None, indicating stdout)

Public Methods:

run()
Runs the simulation
set_output_file()
Sets the output file name

Methods to Implement:

_add_listeners()
Set up listeners for various simulation events
_run()
Actual simulation functionality

Events:

done(this)
emitted when run() is complete and results have been stored
outfile changed(this)
emitted when the outfile name has been changed by set_output_file()
outfile error(this)
emitted when there was an error opening the output file
run(this)
emitted just before _run() is called
_add_listeners()

Sets up listeners for various events

_run(*args, **kwdargs)[source]

Actual functionality for running the simulation (should implement)

run()[source]

Runs the simulation. Handles opening and closing the out file object.

set_output_file(fname)[source]

Sets the name of the outfile

Parameters:

fname
The file name for the outfile (or None or False)
simulations.simulation._close_out_fd(this)[source]

Closes the Simulation.out object that simulations should print to

Parameters:

this
A reference to a Simulation instance
simulations.simulation._open_out_fd(this)[source]

Opens the Simulation.out object that simulations should print to

Parameters:

this
A reference to a Simulation instance
Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.