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

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

#include <PopulationRateMonitor.h>

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

Public Member Functions

 PopulationRateMonitor (SpikingGroup *source, string filename="", AurynDouble binsize=0.1)
 Default Constructor. More...
 
virtual ~PopulationRateMonitor ()
 Default Destructor. More...
 
void execute ()
 Implementation of necessary execute() function. More...
 

Protected Member Functions

void init (SpikingGroup *source, string filename, AurynDouble binsize)
 Default init method. More...
 
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)
 
- Protected Member Functions inherited from auryn::Monitor
virtual void open_output_file (std::string filename)
 
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
 The source SpikingGroup. More...
 
- 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 population firing rates.

Instances of this class record the population firing rate of the src SpikingGroup assigned. Binning is done discretely in bins of size bsize that is directly transformed in discrete AurynTime steps. The default

Constructor & Destructor Documentation

◆ PopulationRateMonitor()

PopulationRateMonitor::PopulationRateMonitor ( SpikingGroup source,
std::string  filename = "",
AurynDouble  binsize = 0.1 
)

Default Constructor.

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

◆ ~PopulationRateMonitor()

PopulationRateMonitor::~PopulationRateMonitor ( )
virtual

Default Destructor.

36 {
37 }

Member Function Documentation

◆ execute()

void PopulationRateMonitor::execute ( )
virtual

Implementation of necessary execute() function.

Reimplemented from auryn::Device.

57 {
58  if ( src->evolve_locally() ) {
59  counter += src->get_spikes_immediate()->size();
60  if (auryn::sys->get_clock()%ssize==0) {
61  double rate = invbsize*counter/src->get_rank_size();
62  counter = 0;
63  outfile << auryn::sys->get_time() << " " << rate << "\n";
64  }
65  }
66 }
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
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
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
AurynDouble get_time()
Gets the current system time in [s].
Definition: System.cpp:226
SpikeContainer * get_spikes_immediate()
Returns pointer to SpikeContainer of spikes generated during the last evolve() step.
Definition: SpikingGroup.cpp:250
SpikingGroup * src
The source SpikingGroup.
Definition: PopulationRateMonitor.h:58
Here is the call graph for this function:

◆ init()

void PopulationRateMonitor::init ( SpikingGroup source,
std::string  filename,
AurynDouble  binsize 
)
protected

Default init method.

40 {
42 
43  src = source;
44  invbsize = 1.0/binsize;
45  ssize = (1.0*binsize/auryn_timestep);
46  if ( ssize < 1 ) ssize = 1;
47  counter = 0;
48 
49  std::stringstream oss;
50  oss << "PopulationRateMonitor:: Setting binsize " << binsize << "s";
51  auryn::logger->msg(oss.str(),NOTIFICATION);
52 
53  // outfile << std::setiosflags(ios::fixed) << setprecision(6);
54 }
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
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
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
SpikingGroup * src
The source SpikingGroup.
Definition: PopulationRateMonitor.h:58
Here is the call graph for this function:

◆ virtual_serialize() [1/2]

void PopulationRateMonitor::virtual_serialize ( boost::archive::binary_oarchive &  ar,
const unsigned int  version 
)
protectedvirtual

Functions necesssary for serialization and loading saving to netstate files.

Reimplemented from auryn::Monitor.

69 {
70  ar & counter ;
71 }

◆ virtual_serialize() [2/2]

void PopulationRateMonitor::virtual_serialize ( boost::archive::binary_iarchive &  ar,
const unsigned int  version 
)
protectedvirtual

Reimplemented from auryn::Monitor.

74 {
75  ar & counter ;
76 }

Member Data Documentation

◆ src

SpikingGroup* auryn::PopulationRateMonitor::src
protected

The source SpikingGroup.


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