Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
PoissonStimulator.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 POISSONSTIMULATOR_H_
27 #define POISSONSTIMULATOR_H_
28 
29 #include "auryn_definitions.h"
30 #include "AurynVector.h"
31 #include "System.h"
32 #include "Logger.h"
33 #include "Device.h"
34 #include "NeuronGroup.h"
35 
36 #include <boost/random/mersenne_twister.hpp>
37 #include <boost/random/variate_generator.hpp>
38 #include <boost/random/poisson_distribution.hpp>
39 
40 namespace auryn {
41 
47 class PoissonStimulator : protected Device
48 {
49 private:
50 
51  static boost::mt19937 gen;
52  boost::poisson_distribution<int> * dist;
53  boost::variate_generator<boost::mt19937&, boost::poisson_distribution<int> > * die;
54 
55 
57  AurynState * currents;
58 
60  AurynState * newcurrents;
61 
63  auryn_vector_float * target_vector;
64 
66  AurynFloat poisson_rate;
67 
69  AurynFloat poisson_weight;
70 
72  void init(NeuronGroup * target, AurynFloat rate, AurynWeight w );
73 
74  void free();
75 
77  AurynFloat get_lambda();
78 
79 protected:
80 
83 
84 
85 public:
91  PoissonStimulator(NeuronGroup * target, AurynFloat rate=100.0, AurynWeight w = 0.1 );
92 
94  virtual ~PoissonStimulator();
95 
96 
100  void set_rate(AurynFloat rate);
101 
104 
111  void seed(int s);
112 
113 
117  void set_target_state( string state_name = "mem" );
118 
120  void execute();
121 
122 };
123 
124 }
125 
126 #endif /*POISSONSTIMULATOR_H_*/
Stimulator class to inject timeseries of currents NeuronGroups.
Definition: PoissonStimulator.h:47
NeuronGroup * dst
Definition: PoissonStimulator.h:82
virtual ~PoissonStimulator()
Default Destructor.
Definition: PoissonStimulator.cpp:65
AurynFloat get_rate()
Returns the event rate of the underlying Poisson generator.
Definition: PoissonStimulator.cpp:86
AurynFloat AurynWeight
Unit of synaptic weights.
Definition: auryn_definitions.h:159
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
float AurynFloat
Low precision floating point datatype.
Definition: auryn_definitions.h:157
void execute()
Implementation of necessary execute() function.
Definition: PoissonStimulator.cpp:70
void set_rate(AurynFloat rate)
Sets the event rate of the underlying Poisson generator.
Definition: PoissonStimulator.cpp:80
Abstract base class for all neuron groups.
Definition: NeuronGroup.h:45
Default AurynVectorFloat class for performance computation.
Definition: AurynVector.h:796
void set_target_state(string state_name="mem")
Sets the state that is stimulated.
Definition: PoissonStimulator.cpp:94
void seed(int s)
Seeds the random number generator of all PoissonStimulator objects on this rank.
Definition: PoissonStimulator.cpp:98
PoissonStimulator(NeuronGroup *target, AurynFloat rate=100.0, AurynWeight w=0.1)
Default Constructor.
Definition: PoissonStimulator.cpp:32
Abstract base class for all Device, Stimulator, etc objects.
Definition: Device.h:47