Auryn simulator
v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
|
Monitors the evolution of a single or a set of weights. More...
#include <WeightMonitor.h>
Public Member Functions | |
WeightMonitor (SparseConnection *source, string filename, AurynDouble interval=10.0) | |
Default constructor. More... | |
WeightMonitor (SparseConnection *source, ForwardMatrix *m, string filename, AurynDouble interval=10.0) | |
Specific weight matrix constructor. More... | |
WeightMonitor (SparseConnection *source, NeuronID i, NeuronID j, string filename, AurynDouble interval=10.0, RecordingMode mode=SINGLE, StateID z=0) | |
Single weight constructor. More... | |
virtual | ~WeightMonitor () |
void | execute () |
propagate function used by System class internally More... | |
void | set_mat (ForwardMatrix *m) |
Sets target matrix to read from. More... | |
void | add_to_list_by_data_index (AurynLong index, StateID z=0) |
Adds a single element to the recording list which is identified by its data index and z-state. More... | |
void | add_to_list (AurynWeight *ptr) |
Adds a single element to the recording list which is identified by a pointer. More... | |
void | add_to_list (NeuronID i, NeuronID j, StateID z=0) |
Adds a single element identified matrix coordinates (row,col,z) to the recording list. More... | |
void | add_to_list (std::vector< neuron_pair > vec, string label="") |
Adds a list vector<neuron_pair> vec the the recording list. More... | |
void | add_equally_spaced (NeuronID number, NeuronID z=0) |
Adds number of elements to the recording list that are equally spaced in the data vector of the connection matrix. More... | |
void | load_pattern_connections (string filename, unsigned int maxcon=5, unsigned int maxpat=10, PatternMode patmod=ALLTOALL) |
Adds connections inside a pattern and between patterns. Since such lists can become large quickly the amount of patterns and connections for each pattern to be monitored can be limited by maxcon and maxpat. More... | |
void | load_pattern_connections (string filename_pre, string filename_post, unsigned int maxcon=5, unsigned int maxpat=10, PatternMode patmod=ALLTOALL) |
void | load_data_range (AurynLong i, AurynLong j) |
Adds connections from a given range in the sparse matrix data array. More... | |
Protected Member Functions | |
void | init (SparseConnection *source, NeuronID i, NeuronID j, string filename, AurynTime interval) |
void | record_single_synapses () |
void | record_synapse_groups () |
std::vector< type_pattern > * | load_patfile (string filename, unsigned int maxpat) |
Protected Member Functions inherited from auryn::Monitor | |
virtual void | open_output_file (std::string filename) |
virtual void | virtual_serialize (boost::archive::binary_oarchive &ar, const unsigned int version) |
virtual void | virtual_serialize (boost::archive::binary_iarchive &ar, const unsigned int version) |
virtual void | flush () |
Flush to file. More... | |
Monitor (std::string filename, std::string default_extension="dat") | |
Standard constructor with file name. More... | |
Monitor () | |
Constructor which does not open a text file for output. More... | |
std::string | generate_filename (std::string name_hint="") |
Generates a default filename from the device ID. More... | |
virtual | ~Monitor () |
Standard destructor. More... | |
Protected Member Functions inherited from auryn::Device | |
void | init () |
Standard initializer to be called by the constructor. More... | |
Device () | |
Standard constructor. More... | |
void | set_name (std::string s) |
Set device name. More... | |
std::string | get_name () |
Get device name. More... | |
int | get_id () |
Get numeric device id. More... | |
virtual | ~Device () |
Standard destructor. More... | |
virtual void | evolve () |
Protected Attributes | |
SparseConnection * | src |
ForwardMatrix * | mat |
RecordingMode | recordingmode |
NeuronID | elem_i |
NeuronID | elem_j |
AurynTime | ssize |
std::vector< AurynLong > * | element_list |
std::vector< NeuronID > | group_indices |
Protected Attributes inherited from auryn::Monitor | |
std::ofstream | outfile |
std::string | fname |
std::string | default_file_extension |
bool | active |
Standard active switch. More... | |
Protected Attributes inherited from auryn::Device | |
std::string | device_name |
Identifying name for device. More... | |
bool | active |
Standard active switch. More... | |
Monitors the evolution of a single or a set of weights.
This class perform online monitoring of synaptic weights in a Connection. The class supports different recording modes for single individual weights or multiple weights. Output is written to a human readable text file.
WeightMonitor::WeightMonitor | ( | SparseConnection * | source, |
std::string | filename, | ||
AurynDouble | interval = 10.0 |
||
) |
Default constructor.
This initializes the WeightMonitor and specifies and output file and a sampling interval. Per default WeightMonitor is in multi recording mode. That means it maintains a list of pointers to weights which you would like to monitor. This list is initally empty and needs to be populated after initializating with the appropriate add ... functions.
source | The connection object to record from |
filename | The file to record to |
interval | The sampling interval in simulation interval in seconds |
WeightMonitor::WeightMonitor | ( | SparseConnection * | source, |
ForwardMatrix * | m, | ||
std::string | filename, | ||
AurynDouble | interval = 10.0 |
||
) |
Specific weight matrix constructor.
This initializes the WeightMonitor and specifies and output file and a sampling interval. The constructor does not specify which weights to monitor. interpreted as range i..j in the data array of the source Connection. Note that in DATARANGE mode the Monitor could in principle also monitor zero connections. However in SINGLE it records only non-zero elements.
source | The connection object to record from |
filename | The file to record to |
m | A pointer to the weight matrix to record from |
interval | The sampling interval in simulation interval in seconds |
WeightMonitor::WeightMonitor | ( | SparseConnection * | source, |
NeuronID | i, | ||
NeuronID | j, | ||
std::string | filename, | ||
AurynDouble | interval = 10.0 , |
||
RecordingMode | mode = SINGLE , |
||
StateID | z = 0 |
||
) |
Single weight constructor.
This initializes the WeightMonitor and specifies and output file and a sampling interval. It moreover puts the WeightMonitor in RecordingMode mode SINGLE in which it records a single synaptic connection specified by i and j. If mode is set to DATARANGE instead, the arguments i and j are instead interpreted as range i..j in the data index array of the source Connection.
source | The connection object to record from |
i | Parameter i (either row position of synapse in WeightMatrix or start index in data array depending on mode) |
j | Parameter j (either col position of synapse in WeightMatrix or stop index in data array depending on mode) |
filename | The file to record to |
interval | The sampling interval in simulation interval (1s default) |
mode | The recording mode (one of RecordingMode datatype) |
z | The z state the complex matrix state to record from |
|
virtual |
Adds number of elements to the recording list that are equally spaced in the data vector of the connection matrix.
This effectively corresponds to a number of random connection matrix elements (if a random matrix is used). The second argument can be used to specify which complex synapse state should be used for this operation when complex synapses are used.
void WeightMonitor::add_to_list | ( | AurynWeight * | ptr | ) |
Adds a single element to the recording list which is identified by a pointer.
Adds a single element identified matrix coordinates (row,col,z) to the recording list.
void WeightMonitor::add_to_list | ( | std::vector< neuron_pair > | vec, |
std::string | label = "" |
||
) |
Adds a list vector<neuron_pair> vec the the recording list.
Such a list can for instance be generated by a SparseConnection with the get_block function.
Adds a single element to the recording list which is identified by its data index and z-state.
index | The index in the data array of this sparse matrix. |
z | The id of the complex matrix state to record from. |
|
virtual |
propagate function used by System class internally
Reimplemented from auryn::Device.
|
protected |
Adds connections from a given range in the sparse matrix data array.
|
protected |
void WeightMonitor::load_pattern_connections | ( | std::string | filename, |
unsigned int | maxcon = 5 , |
||
unsigned int | maxpat = 10 , |
||
PatternMode | patmod = ALLTOALL |
||
) |
Adds connections inside a pattern and between patterns. Since such lists can become large quickly the amount of patterns and connections for each pattern to be monitored can be limited by maxcon and maxpat.
filename | The filename of the .pat file |
maxcon | maximum number of connection per pattern or between patterns |
maxpat | maximum number of patterns to read from .pat file |
patmod | ALLTOALL means from all patterns to all patterns. ASSEMBLIES_ONLY only adds connections inside single patterns. |
void WeightMonitor::load_pattern_connections | ( | std::string | filename_pre, |
std::string | filename_post, | ||
unsigned int | maxcon = 5 , |
||
unsigned int | maxpat = 10 , |
||
PatternMode | patmod = ALLTOALL |
||
) |
|
protected |
|
protected |
void WeightMonitor::set_mat | ( | ForwardMatrix * | m | ) |
Sets target matrix to read from.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |