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

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

#include <BinarySpikeMonitor.h>

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

Public Member Functions

 BinarySpikeMonitor (SpikingGroup *source, std::string filename="")
 
 BinarySpikeMonitor (SpikingGroup *source, std::string filename, NeuronID to)
 
 BinarySpikeMonitor (SpikingGroup *source, std::string filename, NeuronID from, NeuronID to)
 
void set_offset (NeuronID of)
 
void set_every (NeuronID every)
 
virtual ~BinarySpikeMonitor ()
 
virtual void execute ()
 
virtual void flush ()
 Flush to file. More...
 
- Public Member Functions inherited from auryn::Monitor
 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 ()
 

Additional Inherited Members

- Public Attributes inherited from auryn::Monitor
bool active
 Standard active switch. More...
 
- Public Attributes inherited from auryn::Device
bool active
 Standard active switch. More...
 
- Protected Member Functions inherited from auryn::Monitor
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 binary file.

BinarySpikeMonitor is specified with a source group of type SpikingGroup and writes all or a specified range of the neurons spikes to a file that has to be given at construction time. The output files can be read and converted to ascii ras files using the tool aube (Auryn Binary Extractor) which compiles in the tools folder.

Constructor & Destructor Documentation

◆ BinarySpikeMonitor() [1/3]

BinarySpikeMonitor::BinarySpikeMonitor ( SpikingGroup source,
std::string  filename = "" 
)
43  : Monitor(filename, default_extension)
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:

◆ BinarySpikeMonitor() [2/3]

BinarySpikeMonitor::BinarySpikeMonitor ( SpikingGroup source,
std::string  filename,
NeuronID  to 
)
38  : Monitor(filename, default_extension)
39 {
40  init(source,filename,0,to);
41 }
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:

◆ BinarySpikeMonitor() [3/3]

BinarySpikeMonitor::BinarySpikeMonitor ( SpikingGroup source,
std::string  filename,
NeuronID  from,
NeuronID  to 
)
33  : Monitor(filename, default_extension)
34 {
35  init(source,filename,from,to);
36 }
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:

◆ ~BinarySpikeMonitor()

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

Member Function Documentation

◆ execute()

void BinarySpikeMonitor::execute ( )
virtual

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

Reimplemented from auryn::Device.

109 {
110  if ( !active ) return;
111 
112  SpikeEvent_type spikeData;
113  spikeData.time = auryn::sys->get_clock();
114  for (it = src->get_spikes_immediate()->begin() ; it < src->get_spikes_immediate()->end() ; ++it ) {
115  if (*it >= n_from ) {
116  if ( *it < n_to && (*it%n_every==0) )
117  {
118  spikeData.neuronID = (*it + offset);
119  outfile.write((char*)&spikeData, sizeof(SpikeEvent_type));
120  }
121  }
122  }
123 }
AurynTime time
Definition: auryn_definitions.h:196
NeuronID neuronID
Definition: auryn_definitions.h:197
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
Standard active switch.
Definition: Monitor.h:77
SpikeContainer * get_spikes_immediate()
Returns pointer to SpikeContainer of spikes generated during the last evolve() step.
Definition: SpikingGroup.cpp:250
AurynTime get_clock()
Gets the current clock value in AurynTime.
Definition: System.cpp:231
Auryn spike event for binary monitors.
Definition: auryn_definitions.h:194
Here is the call graph for this function:

◆ flush()

void BinarySpikeMonitor::flush ( )
virtual

Flush to file.

Reimplemented from auryn::Monitor.

126 {
127  outfile.flush();
128 }
std::ofstream outfile
Definition: Monitor.h:58

◆ set_every()

void BinarySpikeMonitor::set_every ( NeuronID  every)
104 {
105  n_every = every;
106 }

◆ set_offset()

void BinarySpikeMonitor::set_offset ( NeuronID  of)
99 {
100  offset = of;
101 }

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