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

The standard Monitor object to record spikes from a SpikingGroup and write them to a text file. More...

#include <SpikeMonitor.h>

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

Public Member Functions

 SpikeMonitor (SpikingGroup *source, std::string filename)
 Default constructor. More...
 
 SpikeMonitor (SpikingGroup *source, std::string filename, NeuronID to)
 Default constructor which records from limited number of neurons. More...
 
 SpikeMonitor (SpikingGroup *source, std::string filename, NeuronID from, NeuronID to)
 Default constructor which records from a range of neurons. More...
 
void set_every (NeuronID every)
 Sets every parameter that ellow to record only from every X neuron. More...
 
virtual ~SpikeMonitor ()
 Default destructor. More...
 
void execute ()
 Propagate function for internal use. More...
 
- Public Member Functions inherited from auryn::Monitor
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...
 
- Public Member Functions inherited from auryn::Device
 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 ()
 

Public Attributes

bool active
 
- Public Attributes inherited from auryn::Monitor
bool active
 Standard active switch. More...
 
- Public Attributes inherited from auryn::Device
bool active
 Standard active switch. More...
 

Additional Inherited Members

- 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)
 
- Protected Member Functions inherited from auryn::Device
void init ()
 Standard initializer to be called by the constructor. More...
 
- Protected Attributes inherited from auryn::Monitor
std::ofstream outfile
 
std::string fname
 
std::string default_file_extension
 
- Protected Attributes inherited from auryn::Device
std::string device_name
 Identifying name for device. More...
 

Detailed Description

The standard Monitor object to record spikes from a SpikingGroup and write them to a text file.

SpikeMonitor is specified with a source group of type SpikingGroup and writes all or a specified range of the neurons spikes to a text (ras) file that has to be given at construction time.

SpikeMonitor writes spikes into rank specific files and timestamps them before the axonal delay (this is generally what you want). DelaySpikeMonitor in contrast writes spikes after the axonal delay and records all spikes from all ranks and all all ranks (this is maninly for debugging).

Constructor & Destructor Documentation

◆ SpikeMonitor() [1/3]

SpikeMonitor::SpikeMonitor ( SpikingGroup source,
std::string  filename 
)

Default constructor.

Parameters
sourceSpecifies the source SpikingGroup to record from
filenameSpecifies the filename to write to. This filename needs to be rank specific to avoid problems in parallelm mode
43  : Monitor(filename)
44 {
45  init(source,filename,0,source->get_size());
46 }
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
NeuronID get_size()
Returns the size of the group.
Definition: SpikingGroup.cpp:304
Here is the call graph for this function:

◆ SpikeMonitor() [2/3]

SpikeMonitor::SpikeMonitor ( SpikingGroup source,
std::string  filename,
NeuronID  to 
)

Default constructor which records from limited number of neurons.

Parameters
sourceSpecifies the source SpikingGroup to record from
filenameSpecifies the filename to write to. This filename needs to be rank specific to avoid problems in parallelm mode
toThe last NeuronID to record from starting from 0.
37  : Monitor(filename)
38 {
39  init(source,filename,0,to);
40 }
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:

◆ SpikeMonitor() [3/3]

SpikeMonitor::SpikeMonitor ( SpikingGroup source,
std::string  filename,
NeuronID  from,
NeuronID  to 
)

Default constructor which records from a range of neurons.

Parameters
sourceSpecifies the source SpikingGroup to record from
filenameSpecifies the filename to write to. This filename needs to be rank specific to avoid problems in parallelm mode
fromThe first NeuronID to record from.
toThe last NeuronID to record from.
31  : Monitor(filename)
32 {
33  init(source,filename,from,to);
34 }
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:

◆ ~SpikeMonitor()

SpikeMonitor::~SpikeMonitor ( )
virtual

Default destructor.

49 {
50  free();
51 }
Here is the call graph for this function:

Member Function Documentation

◆ execute()

void SpikeMonitor::execute ( )
virtual

Propagate function for internal use.

Reimplemented from auryn::Device.

78 {
79  if ( !active ) return;
80 
81  for (it = src->get_spikes_immediate()->begin() ; it < src->get_spikes_immediate()->end() ; ++it ) {
82  if (*it >= n_from ) {
83  if ( *it < n_to && (*it%n_every==0) ) {
84  // using the good old stdio.h for formatting seems a bit faster
85  char buffer[255];
86  int n = sprintf(buffer,"%f %u\n",auryn::sys->get_time(), *it);
87  outfile.write(buffer,n);
88  }
89  }
90  }
91 }
int n
Definition: mkpat.py:5
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
bool active
Definition: SpikeMonitor.h:65
SpikeContainer * get_spikes_immediate()
Returns pointer to SpikeContainer of spikes generated during the last evolve() step.
Definition: SpikingGroup.cpp:250
Here is the call graph for this function:

◆ set_every()

void SpikeMonitor::set_every ( NeuronID  every)

Sets every parameter that ellow to record only from every X neuron.

Parameters
thenumber X as described above.
73 {
74  n_every = every;
75 }

Member Data Documentation

◆ active

bool auryn::SpikeMonitor::active

Switch variable to enable/disable recording.


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