Package topo :: Package command
[hide private]
[frames] | no frames]

Package command

source code

A family of high-level user commands acting on the entire simulation.

Any new commands added to this directory will automatically become available for any program.

Commands here should be 'bullet-proof' and work 'from scratch'. That is, they should print warnings if required but should not raise errors that would interrupt e.g. a long batch run of simulation work, no matter what the context from which they are called.

$Id: __init__.py 8956 2008-08-21 20:27:55Z ceball $


Version: $Revision: 8956 $

Submodules [hide private]

Classes [hide private]
  Command
Parameterized command: any error when the command is run (called) will not raise an exception, but will instead generate a warning.
  ParameterizedFunction
Acts like a Python function, but with arguments that are Parameters.
  _generate
  normalize_path
Convert a UNIX-style path to the current OS's format, typically for creating a new file or directory.
  param_formatter
  run_batch
Run a Topographica simulation in batch mode.
Functions [hide private]
 
_get_vc_commands(*args, **kw) source code
 
_load_pickle(snapshot) source code
 
_print_vc_info(*args, **kw)
Save the version control status of the current code to the specified file.
source code
 
_save_parameters(p, filename) source code
 
clear_event_queue()
Remove pending events from the simulator's event queue.
source code
 
default_analysis_function()
Basic example of an analysis command for run_batch; users are likely to need something similar but highly customized.
source code
 
generate_example(target)
Generate the saved network target, as defined in topo.misc.genexamples.
source code
 
in_vc_topographica_dir(fn) source code
 
load_snapshot(snapshot_name)
Load the simulation stored in snapshot_name.
source code
 
n_bytes()
Estimate the minimum memory needed for the Sheets in this Simulation, in bytes.
source code
 
n_conns()
Count the number of connections in all ProjectionSheets in the current Simulation.
source code
 
pattern_present(inputs={}, duration=1.0, plastic=False, overwrite_previous=False, apply_output_fns=True)
Present the specified test patterns for the specified duration.
source code
 
print_sizes()
Format the results from n_conns() and n_bytes() for use in batch output.
source code
 
restore_input_generators()
Restore previously saved input_generators for all of topo.sim's GeneratorSheets.
source code
 
save_input_generators()
Save a copy of the active_sim's current input_generators for all GeneratorSheets.
source code
 
save_script_repr(script_name=None)
Save the current simulation as a Topographica script.
source code
 
save_snapshot(snapshot_name=None, xml=False)
Save a snapshot of the network's current state.
source code
 
wipe_out_activity()
Resets activity of all Sheets and their connections to zero.
source code
Variables [hide private]
  __package__ = 'topo.command'
Function Details [hide private]

_get_vc_commands(*args, **kw)

source code 
Decorators:
  • @in_vc_topographica_dir

_print_vc_info(*args, **kw)

source code 
Save the version control status of the current code to the specified file.
Decorators:
  • @in_vc_topographica_dir

n_bytes()

source code 

Estimate the minimum memory needed for the Sheets in this Simulation, in bytes.

This estimate is a lower bound only, based primarily on memory for the matrices used for activity and connections.

pattern_present(inputs={}, duration=1.0, plastic=False, overwrite_previous=False, apply_output_fns=True)

source code 

Present the specified test patterns for the specified duration.

Given a set of input patterns (dictionary of GeneratorSheetName:PatternGenerator pairs), installs them into the specified GeneratorSheets, runs the simulation for the specified length of time, then restores the original patterns and the original simulation time. Thus this input is not considered part of the regular simulation, and is usually for testing purposes.

As a special case, if 'inputs' is just a single pattern, and not a dictionary, it is presented to all GeneratorSheets.

If a simulation is not provided, the active simulation, if one exists, is requested.

If this process is interrupted by the user, the temporary patterns may still be installed on the retina.

If overwrite_previous is true, the given inputs overwrite those previously defined.

If plastic is False, overwrites the existing values of Sheet.plastic to disable plasticity, then reenables plasticity.

In order to to see the sequence of values presented, use the back arrow history mechanism in the GUI. Note that the GUI's Activity window must be open and the display parameter set to true (display=True).

save_script_repr(script_name=None)

source code 

Save the current simulation as a Topographica script.

Generates a script that, if run, would generate a simulation with the same architecture as the one currently in memory. This can be useful when defining networks in place, so that the same general configuration can be recreated later. It also helps when comparing two similar networks generated with different scripts, so that the corresponding items can be matched rigorously.

Note that the result of this operation is usually just a starting point for further editing, because it will not usually be runnable as-is (for instance, some parameters may not have runnable representations). Even so, this is usually a good start.

save_snapshot(snapshot_name=None, xml=False)

source code 

Save a snapshot of the network's current state.

The snapshot is saved as a gzip-compressed Python binary pickle.

(xml snapshots are currently experimental, and will not be useful for most users.)

As this function uses Python's 'pickle' module, it is subject to the same limitations (see the pickle module's documentation) - with the notable exception of class attributes. Python does not pickle class attributes, but this function stores class attributes of any Parameterized class that is declared within the topo package. See the param.parameterized.PicklableClassAttributes class for more information.