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

Module basic

source code

High-level user-level commands controlling the entire simulation. $Id: basic.py 11324 2010-07-28 17:12:56Z ceball $

Version: $Revision: 11324 $

Classes [hide private]
  ParameterizedFunction
Acts like a Python function, but with arguments that are Parameters.
  normalize_path
Convert a UNIX-style path to the current OS's format, typically for creating a new file or directory.
  _generate
  CommandMetaclass
A class having this as a metaclass will have its __call__() method automatically wrapped so that any exception occurring inside __call__() will be passed to the class's _except() method.
  Command
Parameterized command: any error when the command is run (called) will not raise an exception, but will instead generate a warning.
  ImportErrorObject
Raises an ImportError on any attempt to access an attribute, call, or get an item.
  ImportErrorRaisingFakeModule
Returns an ImportErrorObject for any attribute request.
  _VersionPrinter
When unpickled, prints version & release information about snapshot.
  param_formatter
  run_batch
Run a Topographica simulation in batch mode.
Functions [hide private]
 
generate_example(target)
Generate the saved network target, as defined in topo.misc.genexamples.
source code
 
save_input_generators()
Save a copy of the active_sim's current input_generators for all GeneratorSheets.
source code
 
restore_input_generators()
Restore previously saved input_generators for all of topo.sim's GeneratorSheets.
source code
 
clear_event_queue()
Remove pending events from the simulator's event queue.
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
 
save_snapshot(snapshot_name=None, xml=False)
Save a snapshot of the network's current state.
source code
 
_load_pickle(snapshot) source code
 
load_snapshot(snapshot_name)
Load the simulation stored in snapshot_name.
source code
 
save_script_repr(script_name=None)
Save the current simulation as a Topographica script.
source code
 
in_vc_topographica_dir(fn) source code
 
_get_vc_commands(*args, **kw) 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
 
default_analysis_function()
Basic example of an analysis command for run_batch; users are likely to need something similar but highly customized.
source code
 
wipe_out_activity()
Resets activity of all Sheets and their connections to zero.
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
 
print_sizes()
Format the results from n_conns() and n_bytes() for use in batch output.
source code
Variables [hide private]
  vc_topographica_dir = '/tmp/topographica'
  default_analysis_plotgroups = ['Orientation Preference', 'Acti...
  __package__ = 'topo.command'
  k = 'vc_topographica_dir'
  v = '/tmp/topographica'
Function Details [hide private]

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_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.

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.

_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.


Variables Details [hide private]

default_analysis_plotgroups

Value:
['Orientation Preference', 'Activity']