Utility classes and functions¶
- 
init_logging(logfile, debug=False, num_processes=1, rank=0, level=None)[source]¶
- Simple configuration of logging. 
- 
get_simulator(*arguments)[source]¶
- Import and return a PyNN simulator backend module based on command-line arguments. - The simulator name should be the first positional argument. If your script needs additional arguments, you can specify them as (name, help_text) tuples. If you need more complex argument handling, you should use argparse directly. - Returns (simulator, command-line arguments) 
- 
class Timer[source]¶
- For timing script execution. - Timing starts on creation of the timer. - 
elapsed_time(format=None)[source]¶
- Return the elapsed time in seconds but keep the clock running. - If called with - format="long", return a text representation of the time. Examples:- >>> timer.elapsed_time() 987 >>> timer.elapsed_time(format='long') 16 minutes, 27 seconds 
 - 
elapsedTime(**kwargs)¶
- Deprecated. Use - elapsed_time()instead.
 - 
diff(format=None)[source]¶
- Return the time since the last time - elapsed_time()or- diff()was called.- If called with - format='long', return a text representation of the time.
 - 
static time_in_words(s)[source]¶
- Formats a time in seconds as a string containing the time in days, hours, minutes, seconds. Examples: - >>> Timer.time_in_words(1) 1 second >>> Timer.time_in_words(123) 2 minutes, 3 seconds >>> Timer.time_in_words(24*3600) 1 day 
 - 
mark(label)[source]¶
- Store the time since the last time since the last time - elapsed_time(),- diff()or- mark()was called, together with the provided label, in the attribute ‘marks’.
 
- 
- 
notify(msg='Simulation finished.', subject='Simulation finished.', smtphost=None, address=None)[source]¶
- Send an e-mail stating that the simulation has finished. 
- 
save_population(population, filename, variables=None)[source]¶
- Saves the spike_times of a population and the size, structure, labels such that one can load it back into a SpikeSourceArray population using the load_population() function. 
- 
load_population(filename, sim)[source]¶
- Loads a population that was saved with the save_population() function into SpikeSourceArray. 
Basic plotting¶
- 
class Figure(*panels, **options)[source]¶
- Provide simple, declarative specification of multi-panel figures. - Example: - Figure( Panel(segment.filter(name="v")[0], ylabel="Membrane potential (mV)") Panel(segment.spiketrains, xlabel="Time (ms)"), title="Network activity", ).save("figure3.png") - Valid options are:
- settings:
- for figure settings, e.g. {‘font.size’: 9} 
- annotations:
- a (multi-line) string to be printed at the bottom of the figure. 
- title:
- a string to be printed at the top of the figure. 
 
 
- 
class Panel(*data, **options)[source]¶
- Represents a single panel in a multi-panel figure. - A panel is a Matplotlib Axes or Subplot instance. A data item may be an AnalogSignal, AnalogSignal, or a list of SpikeTrains. The Panel will automatically choose an appropriate representation. Multiple data items may be plotted in the same panel. - Valid options are any valid Matplotlib formatting options that should be applied to the Axes/Subplot, plus in addition: - data_labels:
- a list of strings of the same length as the number of data items. 
- line_properties:
- a list of dicts containing Matplotlib formatting options, of the same length as the number of data items. 
 
