run_batch(script_file,
output_directory='Output',
analysis_fn=<function default_analysis_function at 0xa228cdc>,
times=[50, 100, 500, 1000, 2000, 3000, 4000, 5000, 10000],
**params)
| source code
|
Run a Topographica simulation in batch mode.
Features:
- Generates a unique, well-defined name for each 'experiment'
(i.e. simulation run) based on the date, script file, and
parameter settings
- Allows parameters to be varied on the command-line,
to allow comparing various settings
- Saves a script capturing the simulation state periodically,
to preserve parameter values from old experiments and to allow
them to be reproduced exactly later
- Can perform user-specified analysis routines periodically,
to monitor the simulation as it progresses.
- Stores commandline output (stdout) in the output directory
A typical use of this function is for remote execution of a large
number of simulations with different parameters, often on remote
machines (such as clusters).
The script_file parameter defines the .ty script we want to run in
batch mode. The output_directory defines the root directory in
which a unique individual directory will be created for this
particular run. The optional analysis_fn can be any python
function to be called at each of the simulation iterations defined
in the analysis times list. This function should perform whatever
analysis of the simulation you want to perform, such as plotting
or calculating some statistics. The analysis_fn should avoid
using any GUI functions (i.e., should not import anything from
topo.tkgui), and it should save all of its results into files.
Any other optional parameters supplied will be set in the main
namespace before any scripts are run. They will also be used to
construct a unique topo.sim.name for the file, and they will be
encoded into the simulation directory name, to make it clear how
each simulation differs from the others.
|