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::RateMonitor Class Reference

Monitor class to record neural firing rates. More...

#include <RateMonitor.h>

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

Public Member Functions

 RateMonitor (SpikingGroup *source, string filename, AurynFloat samplinginterval=1)
 
virtual ~RateMonitor ()
 
void execute ()
 

Protected Member Functions

void init (SpikingGroup *source, string filename, AurynFloat samplinginterval)
 
- 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

SpikingGroupsrc
 
- 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

Monitor class to record neural firing rates.

Instances of this class record the firing rates of all neurons in the src SpikingGroup. To estimate rates online it uses an exponential filter with a time constant that is three times the sampling interval. To do so the class uses a synaptic trace. Each rank only records spikes from local neurons.

Constructor & Destructor Documentation

◆ RateMonitor()

RateMonitor::RateMonitor ( SpikingGroup source,
std::string  filename,
AurynFloat  samplinginterval = 1 
)

Default Constructor

Parameters
30  : Monitor(filename)
31 {
32  init(source,filename,samplinginterval);
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:

◆ ~RateMonitor()

RateMonitor::~RateMonitor ( )
virtual

Default Destructor

36 {
37 }

Member Function Documentation

◆ execute()

void RateMonitor::execute ( )
virtual

Implementation of necessary execute() function.

Reimplemented from auryn::Device.

59 {
60  if ( src->evolve_locally() ) {
61  if (auryn::sys->get_clock()%ssize==0) {
63  for (NeuronID i = 0 ; i < src->get_rank_size() ; ++i ) {
64  outfile << tr_post->normalized_get(i)
65  << " ";
66  }
67  outfile << "\n";
68  }
69  }
70 }
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
virtual AurynFloat normalized_get(NeuronID i)
Get trace value of trace dived by tau.
Definition: Trace.cpp:67
bool evolve_locally()
Returns true if the calling instance has units which are integrated on the current rank...
Definition: SpikingGroup.cpp:323
std::ofstream outfile
Definition: Monitor.h:58
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
SpikingGroup * src
Definition: RateMonitor.h:62
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
AurynTime get_clock()
Gets the current clock value in AurynTime.
Definition: System.cpp:231
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
Here is the call graph for this function:

◆ init()

void RateMonitor::init ( SpikingGroup source,
std::string  filename,
AurynFloat  samplinginterval 
)
protected

Default init method

40 {
42 
43  src = source;
44  ssize = samplinginterval/auryn_timestep;
45  if ( ssize < 1 ) ssize = 1;
46 
47  tau_filter = 3*samplinginterval;
48 
49  tr_post = source->get_post_trace(tau_filter);
50 
51  std::stringstream oss;
52  oss << "RateMonitor:: Setting sampling interval " << samplinginterval << "s";
53  auryn::logger->msg(oss.str(),NOTIFICATION);
54 
55  outfile << std::setiosflags(std::ios::fixed) << std::setprecision(6);
56 }
Definition: Logger.h:41
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
std::ofstream outfile
Definition: Monitor.h:58
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
SpikingGroup * src
Definition: RateMonitor.h:62
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
Trace * get_post_trace(AurynFloat x)
Returns a post trace with time constant x.
Definition: SpikingGroup.cpp:390
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Here is the call graph for this function:

Member Data Documentation

◆ src

SpikingGroup* auryn::RateMonitor::src
protected

The source SpikingGroup


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