Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
FileInputGroup.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 FILEINPUTGROUP_H_
27 #define FILEINPUTGROUP_H_
28 
29 #include <fstream>
30 #include <sstream>
31 
32 #include "auryn_definitions.h"
33 #include "AurynVector.h"
34 #include "System.h"
35 #include "SpikingGroup.h"
36 
37 namespace auryn {
38 
47 {
48 private:
49  AurynTime next_event_time;
50  NeuronID next_event_spike;
51 
53  AurynTime loop_grid_size;
54 
55  AurynTime time_offset;
56  AurynTime reset_time;
57 
58 
59  std::vector<SpikeEvent_type> input_spikes;
60  std::vector<SpikeEvent_type>::const_iterator spike_iter;
61 
62  void init();
63 
64  AurynTime get_offset_clock();
65  AurynTime get_next_grid_point( AurynTime time );
66 
67 public:
68 
70  bool playinloop;
71 
74 
76  FileInputGroup( NeuronID n, string filename , bool loop=false, AurynFloat delay=0.0 );
77 
84 
85  virtual ~FileInputGroup();
86  virtual void evolve();
87 
95  void set_loop_grid(AurynDouble grid_size);
96 
100  void load_spikes(std::string filename);
101 
107  void add_spike(double spiketime, NeuronID neuron_id=0);
108 
113  void sort_spikes();
114 };
115 
116 }
117 
118 #endif /*FILEINPUTROUP_H_*/
Reads spikes from a ras file and emits them as SpikingGroup in a simulation.
Definition: FileInputGroup.h:46
Abstract base class of all objects producing spikes.
Definition: SpikingGroup.h:67
void sort_spikes()
Sorts spikes by time.
Definition: FileInputGroup.cpp:103
double AurynDouble
Higher precision floating point datatype.
Definition: auryn_definitions.h:158
virtual ~FileInputGroup()
Definition: FileInputGroup.cpp:59
int n
Definition: mkpat.py:5
AurynTime time_delay
Time delay after each replay of the input pattern in loop mode (default 0s)
Definition: FileInputGroup.h:73
Definition: ABSConnection.h:38
virtual void evolve()
Virtual pure evolve function which needs to be implemented by derived classes.
Definition: FileInputGroup.cpp:123
float AurynFloat
Low precision floating point datatype.
Definition: auryn_definitions.h:157
void set_loop_grid(AurynDouble grid_size)
Aligned loop blocks to a temporal grid of this size.
Definition: FileInputGroup.cpp:149
bool playinloop
Switch that activates the loop mode of FileInputGroup when set to true.
Definition: FileInputGroup.h:70
void add_spike(double spiketime, NeuronID neuron_id=0)
Adds a spike to the buffer manually and then temporally sorts the buffer.
Definition: FileInputGroup.cpp:158
SpikeDelay * delay
Definition: SpikingGroup.h:144
FileInputGroup(NeuronID n, string filename, bool loop=false, AurynFloat delay=0.0)
Default constructor.
Definition: FileInputGroup.cpp:47
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
void load_spikes(std::string filename)
Load spikes from file.
Definition: FileInputGroup.cpp:65
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151