Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
auryn::WeightMatrixMonitor Class Reference

Saves the weight matrix of a given connection in regular time intervals. More...

#include <WeightMatrixMonitor.h>

Inheritance diagram for auryn::WeightMatrixMonitor:
Inheritance graph
[legend]
Collaboration diagram for auryn::WeightMatrixMonitor:
Collaboration graph
[legend]

Public Member Functions

 WeightMatrixMonitor (Connection *source, string filename, AurynFloat stepsize=600.)
 
virtual ~WeightMatrixMonitor ()
 
void execute ()
 

Protected Member Functions

void init (Connection *source, AurynFloat stepsize)
 
- 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

Connectionsrc
 
AurynTime ssize
 
AurynInt filecount
 
- 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...
 

Detailed Description

Saves the weight matrix of a given connection in regular time intervals.

Constructor & Destructor Documentation

◆ WeightMatrixMonitor()

WeightMatrixMonitor::WeightMatrixMonitor ( Connection source,
std::string  filename,
AurynFloat  stepsize = 600. 
)
30  : Monitor(filename)
31 {
32  init(source,stepsize);
33 }
void init()
Standard initializer to be called by the constructor.
Definition: Device.cpp:32
Monitor()
Constructor which does not open a text file for output.
Definition: Monitor.cpp:47
Here is the call graph for this function:

◆ ~WeightMatrixMonitor()

WeightMatrixMonitor::~WeightMatrixMonitor ( )
virtual
36 {
37 }

Member Function Documentation

◆ execute()

void WeightMatrixMonitor::execute ( )
virtual

Virtual execute function to be called at the end of central simulation loop in System

Reimplemented from auryn::Device.

51 {
52  if (auryn::sys->get_clock()%ssize==0) {
53  AurynDouble mean,std;
54  src->stats(mean,std);
55 
56  char wmatfilename [255];
57  sprintf(wmatfilename, "%s%.2d", fname.c_str(), filecount);
58  src->write_to_file(wmatfilename);
59  filecount++;
60 
61  outfile << auryn_timestep*(auryn::sys->get_clock()) << " " << mean << " " << std << " " << wmatfilename << std::endl;
62  }
63 
64 }
virtual bool write_to_file(std::string filename)=0
Implements save to file functionality. Also called in save_network_state from System class...
STL namespace.
double AurynDouble
Higher precision floating point datatype.
Definition: auryn_definitions.h:158
virtual void stats(AurynDouble &mean, AurynDouble &std, StateID zid=0)=0
Computes mean synaptic weight and std dev of all weights in this connection.
std::ofstream outfile
Definition: Monitor.h:58
AurynInt filecount
Definition: WeightMatrixMonitor.h:46
AurynTime ssize
Definition: WeightMatrixMonitor.h:45
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
std::string fname
Definition: Monitor.h:61
Connection * src
Definition: WeightMatrixMonitor.h:44
AurynTime get_clock()
Gets the current clock value in AurynTime.
Definition: System.cpp:231
Here is the call graph for this function:

◆ init()

void WeightMatrixMonitor::init ( Connection source,
AurynFloat  stepsize 
)
protected
40 {
42 
43  src = source;
44  ssize = (AurynTime) (stepsize/auryn_timestep);
45  outfile << std::setiosflags(std::ios::fixed) << std::setprecision(6);
46 
47  filecount = 0;
48 }
std::ofstream outfile
Definition: Monitor.h:58
AurynInt filecount
Definition: WeightMatrixMonitor.h:46
AurynTime ssize
Definition: WeightMatrixMonitor.h:45
void register_device(Device *device)
Registers an instance of Device to the devices vector.
Definition: System.cpp:272
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
Connection * src
Definition: WeightMatrixMonitor.h:44
NeuronID AurynTime
Defines Auryns discrete time unit of the System clock. Change to AurynLong if 120h of simtime are not...
Definition: auryn_definitions.h:155
Here is the call graph for this function:

Member Data Documentation

◆ filecount

AurynInt auryn::WeightMatrixMonitor::filecount
protected

◆ src

Connection* auryn::WeightMatrixMonitor::src
protected

◆ ssize

AurynTime auryn::WeightMatrixMonitor::ssize
protected

The documentation for this class was generated from the following files: