Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
BinaryStateMonitor.h
Go to the documentation of this file.
1 /*
2 * Copyright 2014-2018 Friedemann Zenke
3 *
4 * This file is part of Auryn, a simulation package for plastic
5 * spiking neural networks.
6 *
7 * Auryn is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Auryn is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Auryn. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * If you are using Auryn or parts of it for your work please cite:
21 * Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations
22 * of spiking neural networks using general-purpose computers.
23 * Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076
24 */
25 
26 #ifndef BINARYSTATEMONITOR_H_
27 #define BINARYSTATEMONITOR_H_
28 
29 #include "auryn_definitions.h"
30 #include "AurynVector.h"
31 #include "Monitor.h"
32 #include "System.h"
33 #include "Connection.h"
34 #include <fstream>
35 #include <iomanip>
36 
37 namespace auryn {
38 
43 {
44 private:
45  static const std::string default_extension;
46 
47  void write_frame(const AurynTime time, const AurynState value);
48  void open_output_file(std::string filename);
49 
50 protected:
53 
56 
60 
63 
66 
69 
71  void init(string filename, AurynDouble stepsize);
72 
73 public:
84 
93  BinaryStateMonitor(SpikingGroup * source, NeuronID id, string statename, std::string filename="", AurynDouble sampling_interval=auryn_timestep);
94 
101  BinaryStateMonitor(auryn_vector_float * state, NeuronID id, std::string filename="", AurynDouble sampling_interval=auryn_timestep);
102 
109  BinaryStateMonitor(Trace * trace, NeuronID id, std::string filename="", AurynDouble sampling_interval=auryn_timestep);
110 
117  void record_for(AurynDouble time=10.0);
118 
120  void set_stop_time(AurynDouble time=10.0);
121 
122  virtual ~BinaryStateMonitor();
123  void execute();
124 };
125 
126 }
127 
128 #endif /*BINARYSTATEMONITOR_H_*/
Abstract base class for all Monitor objects.
Definition: Monitor.h:47
AurynState lastval
Last value (used for compression)
Definition: BinaryStateMonitor.h:58
void set_stop_time(AurynDouble time=10.0)
Set an absolute time when to stop recording.
Definition: BinaryStateMonitor.cpp:162
AurynState * target_variable
Target variable.
Definition: BinaryStateMonitor.h:55
AurynTime ssize
The step size (sampling interval) in units of auryn_timestep.
Definition: BinaryStateMonitor.h:65
Abstract base class of all objects producing spikes.
Definition: SpikingGroup.h:67
void record_for(AurynDouble time=10.0)
Sets relative time at which to stop recording.
Definition: BinaryStateMonitor.cpp:168
double AurynDouble
Higher precision floating point datatype.
Definition: auryn_definitions.h:158
AurynTime t_stop
Defines the maximum recording time in AurynTime to save space.
Definition: BinaryStateMonitor.h:68
AurynState lastder
Definition: BinaryStateMonitor.h:59
Abstract base class of synaptic traces.
Definition: Trace.h:36
void init()
Standard initializer to be called by the constructor.
Definition: Device.cpp:32
Definition: ABSConnection.h:38
AurynFloat AurynState
Type for Auryn state variables (default single precision since it needs to be compatible with auryn_v...
Definition: auryn_definitions.h:160
NeuronID nid
The source neuron id to record from.
Definition: BinaryStateMonitor.h:62
void execute()
Definition: BinaryStateMonitor.cpp:140
Records from an arbitray state vector of one unit from the source SpikingGroup to a binary file...
Definition: BinaryStateMonitor.h:42
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
BinaryStateMonitor(SpikingGroup *source, NeuronID id, string statename, std::string filename="", AurynDouble sampling_interval=auryn_timestep)
Standard constructor.
Definition: BinaryStateMonitor.cpp:32
virtual ~BinaryStateMonitor()
Definition: BinaryStateMonitor.cpp:119
SpikingGroup * src
The source SpikingGroup to record from.
Definition: BinaryStateMonitor.h:52
bool enable_compression
Switch to enable/disable output compression.
Definition: BinaryStateMonitor.h:83
Default AurynVectorFloat class for performance computation.
Definition: AurynVector.h:796
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
std::string string
Standard library string type which is imported into Auryn namespace.
Definition: auryn_definitions.h:156
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151