snntoolbox.bin

snntoolbox.bin.run

The purpose of this module is to provide an executable for running the SNN conversion toolbox, either from terminal or using a GUI.

During installation of the toolbox, python creates an entry point to the main function of this module. See Getting started for how call this executable.

@author: rbodo

snntoolbox.bin.run.main(filepath=None)[source]

Entry point for running the toolbox.

Note

There is no need to call this function directly, because python sets up an executable during Installation that can be called from terminal.

snntoolbox.bin.utils

This module bundles all the tools of the SNN conversion toolbox.

Important functions:

run_pipeline Convert an analog network to a spiking network and simulate it.
update_setup Update default settings with user settings and check they are valid.

@author: rbodo

snntoolbox.bin.utils.run_pipeline(config, queue=None)[source]

Convert an analog network to a spiking network and simulate it.

Complete pipeline of
  1. loading and testing a pretrained ANN,
  2. normalizing parameters
  3. converting it to SNN,
  4. running it on a simulator,
  5. given a specified hyperparameter range params, repeat simulations with modified parameters.
Parameters:
  • config (configparser.ConfigParser) – ConfigParser containing the user settings.
  • queue (Optional[Queue.Queue]) – Results are added to the queue to be displayed in the GUI.
Returns:

results – List of the accuracies obtained after simulating with each parameter value in config.get(‘parameter_sweep’, ‘param_values’).

Return type:

list

snntoolbox.bin.utils.is_stop(queue)[source]

Determine if the user pressed ‘stop’ in the GUI.

Parameters:queue (Queue.Queue) – Event queue.
Returns:True if user pressed ‘stop’ in GUI, False otherwise.
Return type:bool
snntoolbox.bin.utils.run_parameter_sweep(config, queue)[source]

Decorator to perform a parameter sweep using the run_single function. Need an aditional wrapping layer to be able to pass decorator arguments.

snntoolbox.bin.utils.import_target_sim(config)[source]
snntoolbox.bin.utils.load_config(filepath)[source]

Load a config file from filepath.

snntoolbox.bin.utils.update_setup(config_filepath)[source]

Update default settings with user settings and check they are valid.

Load settings from configuration file at config_filepath, and check that parameter choices are valid. Non-specified settings are filled in with defaults.

snntoolbox.bin.utils.initialize_simulator(config)[source]

Import a module that contains utility functions of spiking simulator.

snntoolbox.bin.utils.get_log_keys(config)[source]
snntoolbox.bin.utils.get_plot_keys(config)[source]
snntoolbox.bin.utils.config_string_to_set_of_strings(string)[source]

snntoolbox.bin.gui

snntoolbox.bin.gui.gui

Graphical User interface for the SNN conversion toolbox.

Features

  • Allows setting parameters and what tools to use during an experiment.
  • Performs basic checks that specified parameters are valid.
  • Preferences can be saved and reloaded.
  • Tooltips explain the functionality.
  • Automatically recognizes result plots and allows displaying them in a separate window.

Note

Due to rapid extensions in the main toolbox, we have not always been able to update the GUI to cover all functionality of the toolbox. We are currently not maintaining the GUI and recommend using the terminal to run experiments.

@author: rbodo

class snntoolbox.bin.gui.gui.SNNToolboxGUI(root, config)[source]

Bases: object

define_style()[source]

Define apperance style.

initialize_thread()[source]

Separate thread for conversion process.

globalparams_widgets()[source]

Global parameters widgets.

cellparams_widgets()[source]

Create a container for individual parameter widgets.

simparams_widgets()[source]

Create a container for individual parameter widgets.

tools_widgets()[source]

Create tools widgets.

edit_normalization_settings()[source]

Settings menu for parameter normalization

edit_experimental_settings()[source]

Settings menu for experimental features.

edit_dataset_settings()[source]

Settings menu for dataset parameters.

graph_widgets()[source]

Create graph widgets.

select_plots_dir_rb()[source]

Select plots directory.

select_layer_rb()[source]

Select layer.

draw_canvas()[source]

Draw canvas figure.

close_window()[source]

Close window function.

display_graphs()[source]

Display graphs.

top_level_menu()[source]

Top level menu settings.

static documentation()[source]

Open documentation.

static about()[source]

About message.

quit_toolbox()[source]

Quit toolbox function.

declare_parameter_vars()[source]

Preferenece collection.

restore_default_params()[source]

Restore default parameters.

set_preferences(p)[source]

Set preferences.

save_settings()[source]

Save current settings.

load_settings(s=None)[source]

Load a perferences settings.

start_processing()[source]

Start processing.

stop_processing()[source]

Stop processing.

update()[source]

Update GUI with items from the queue.

check_sample(p)[source]

Check samples.

check_file(p)[source]

Check files.

check_path(p)[source]

Check path.

check_runlabel(p)[source]

Check runlabel.

check_dataset_path(p)[source]
Parameters:p
set_cwd()[source]

Set current working directory.

set_dataset_path()[source]

Set path to dataset.

toggle_state_pynn(val)[source]

Toogle state for pyNN.

toggle_start_state(val)[source]

Toggle start state.

toggle_stop_state(val)[source]

Toggle stop state.

toggle_num_to_test_state(val)[source]

Toggle number to test state.

toggle_poisson_input_state()[source]

Toggle poisson input.

snntoolbox.bin.gui.gui.main()[source]