NEST  2.6.0,not_revisioned_source_dir@0
izhikevich.h
Go to the documentation of this file.
1 /*
2  * izhikevich.h
3  *
4  * This file is part of NEST.
5  *
6  * Copyright (C) 2004 The NEST Initiative
7  *
8  * NEST is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * NEST is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef IZHIKEVICH_H
24 #define IZHIKEVICH_H
25 
26 #include "nest.h"
27 #include "event.h"
28 #include "archiving_node.h"
29 #include "ring_buffer.h"
30 #include "connection.h"
31 #include "universal_data_logger.h"
32 
33 namespace nest
34 {
35 
36  class Network;
37 
38  /* BeginDocumentation
39  Name: izhikevich - Izhikevich neuron model
40 
41  Description:
42  Implementation of the simple spiking neuron model introduced by Izhikevich [1].
43  The dynamics are given by:
44  dv/dt = 0.04*v^2 + 5*v + 140 - u + I
45  du/dt = a*(b*v - u)
46 
47  if v >= V_th:
48  v is set to c
49  u is incremented by d
50 
51  v jumps on each spike arrival by the weight of the spike.
52 
53  As published in [1], the numerics differs from the standard forward Euler technique
54  in two ways:
55  1) the new value of u is calulated based on the new value of v, rather than the
56  previous value
57  2) the variable v is updated using a time step half the size of that used to update
58  variable u.
59 
60  This model offers both forms of integration, they can be selected using the
61  boolean parameter consistent_integration. To reproduce some results published on
62  the basis of this model, it is necessary to use the published form of the dynamics.
63  In this case, consistent_integration must be set to false. For all other purposes,
64  it is recommended to use the standard technique for forward Euler integration. In
65  this case, consistent_integration must be set to true (default).
66 
67 
68  Parameters:
69  The following parameters can be set in the status dictionary.
70 
71  V_m double - Membrane potential in mV
72  U_m double - Membrane potential recovery variable
73  V_th double - Spike threshold in mV.
74  I_e double - Constant input current in pA. (R=1)
75  V_min double - Absolute lower value for the membrane potential.
76  a double - describes time scale of recovery variable
77  b double - sensitivity of recovery variable
78  c double - after-spike reset value of V_m
79  d double - after-spike reset value of U_m
80  consistent_integration bool - use standard integration technique
81 
82 
83  References:
84  [1] Izhikevich, Simple Model of Spiking Neurons,
85  IEEE Transactions on Neural Networks (2003) 14:1569-1572
86 
87  Sends: SpikeEvent
88 
89  Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
90  FirstVersion: 2009
91  Author: Hanuschkin, Morrison, Kunkel
92  SeeAlso: iaf_psc_delta, mat2_psc_exp
93  */
94  class izhikevich : public Archiving_Node
95  {
96 
97  public:
98 
99  izhikevich();
100  izhikevich(const izhikevich &);
101 
106  using Node::handle;
108 
109  void handle(DataLoggingRequest &);
110  void handle(SpikeEvent &);
111  void handle(CurrentEvent &);
112 
116 
118 
119  void get_status(DictionaryDatum &) const;
120  void set_status(const DictionaryDatum &);
121 
122  private:
123  friend class RecordablesMap<izhikevich>;
124  friend class UniversalDataLogger<izhikevich>;
125 
126  void init_state_(const Node & proto);
127  void init_buffers_();
128  void calibrate();
129 
130  void update(Time const &, const long_t, const long_t);
131 
132  // ----------------------------------------------------------------
133 
137  struct Parameters_ {
142 
145 
148 
151 
154 
155  Parameters_();
156 
157  void get(DictionaryDatum&) const;
158  void set(const DictionaryDatum&);
159  };
160 
161  // ----------------------------------------------------------------
162 
166  struct State_ {
167  double_t v_; // membrane potential
168  double_t u_; // membrane recovery variable
169  double_t I_; // input current
170 
171 
176  State_();
177 
178  void get(DictionaryDatum&, const Parameters_&) const;
179  void set(const DictionaryDatum&, const Parameters_&);
180  };
181 
182  // ----------------------------------------------------------------
183 
187  struct Buffers_ {
191  Buffers_(izhikevich &);
192  Buffers_(const Buffers_ &, izhikevich &);
194 
198  };
199 
200  // ----------------------------------------------------------------
201 
205  struct Variables_ {};
206 
207  // Access functions for UniversalDataLogger -----------------------
208 
210  double_t get_V_m_() const { return S_.v_; }
212  double_t get_U_m_() const { return S_.u_; }
213 
214  // ----------------------------------------------------------------
215 
220 
225  };
226 
227  inline
229  {
230  SpikeEvent e;
231  e.set_sender(*this);
232 
233  return target.handles_test_event(e, receptor_type);
234  }
235 
236  inline
238  {
239  if (receptor_type != 0)
240  throw UnknownReceptorType(receptor_type, get_name());
241  return 0;
242  }
243 
244  inline
246  {
247  if (receptor_type != 0)
248  throw UnknownReceptorType(receptor_type, get_name());
249  return 0;
250  }
251 
252  inline
255  {
256  if (receptor_type != 0)
257  throw UnknownReceptorType(receptor_type, get_name());
258  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
259  }
260 
261  inline
263  {
264  P_.get(d);
265  S_.get(d, P_);
267  (*d)[names::recordables] = recordablesMap_.get_list();
268  }
269 
270  inline
272  {
273  Parameters_ ptmp = P_; // temporary copy in case of errors
274  ptmp.set(d); // throws if BadProperty
275  State_ stmp = S_; // temporary copy in case of errors
276  stmp.set(d, ptmp); // throws if BadProperty
277 
278  // We now know that (ptmp, stmp) are consistent. We do not
279  // write them back to (P_, S_) before we are also sure that
280  // the properties to be set in the parent class are internally
281  // consistent.
283 
284  // if we get here, temporaries contain consistent set of properties
285  P_ = ptmp;
286  S_ = stmp;
287  }
288 
289 } // namespace nest
290 
291 #endif /* #ifndef IZHIKEVICH_H */
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
Definition: izhikevich.h:94
bool consistent_integration_
Use standard integration numerics.
Definition: izhikevich.h:153
Definition of Archiving_Node which is capable of recording and managing a spike history.
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
UniversalDataLogger< izhikevich > logger_
Definition: izhikevich.h:193
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
double_t V_min_
Lower bound.
Definition: izhikevich.h:150
void calibrate()
Re-calculate dependent parameters of the node.
Definition: izhikevich.cpp:162
Internal variables of the model.
Definition: izhikevich.h:205
static RecordablesMap< izhikevich > recordablesMap_
Mapping of recordables names to access functions.
Definition: izhikevich.h:222
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
RingBuffer spikes_
buffers and sums up incoming spikes/currents
Definition: izhikevich.h:196
void set(const DictionaryDatum &, const Parameters_ &)
Definition: izhikevich.cpp:110
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: izhikevich.cpp:154
double_t c_
Definition: izhikevich.h:140
Event for electrical currents.
Definition: event.h:420
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
void get_status(DictionaryDatum &) const
Definition: izhikevich.h:262
Variables_ V_
Definition: izhikevich.h:218
void set_status(const DictionaryDatum &)
Definition: izhikevich.h:271
Parameters_()
Sets default parameter values.
Definition: izhikevich.cpp:58
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: izhikevich.cpp:171
State_()
Accumulate spikes arriving during refractory period, discounted for decay until end of refractory per...
Definition: izhikevich.cpp:69
Map names of recordables to data access functions.
Definition: recordables_map.h:58
double_t I_e_
External DC current.
Definition: izhikevich.h:144
Buffers_(izhikevich &)
Buffer for recording.
Definition: izhikevich.cpp:116
Definition: nest_time.h:130
Independent parameters of the model.
Definition: izhikevich.h:137
double_t get_V_m_() const
Read out the membrane potential.
Definition: izhikevich.h:210
double_t get_U_m_() const
Read out the recovery variable.
Definition: izhikevich.h:212
std::string get_name() const
Return class name.
Definition: node.cpp:83
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
RingBuffer currents_
Definition: izhikevich.h:197
State variables of the model.
Definition: izhikevich.h:166
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: izhikevich.cpp:148
double_t u_
Definition: izhikevich.h:168
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
double double_t
Double precision floating point numbers.
Definition: nest.h:93
Buffers_ B_
Definition: izhikevich.h:219
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: izhikevich.cpp:79
virtual port handles_test_event(SpikeEvent &, rport receptor_type)
Check if the node can handle a particular event and receptor type.
Definition: node.cpp:203
friend class UniversalDataLogger< izhikevich >
Definition: izhikevich.h:124
void get(DictionaryDatum &, const Parameters_ &) const
Definition: izhikevich.cpp:104
Request data to be logged/logged data to be sent.
Definition: event.h:486
State_ S_
Definition: izhikevich.h:217
Buffers of the model.
Definition: izhikevich.h:187
double_t b_
Definition: izhikevich.h:139
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
double_t d_
Definition: izhikevich.h:141
Event for spike information.
Definition: event.h:320
izhikevich()
Definition: izhikevich.cpp:128
Base class for all NEST network objects.
Definition: node.h:96
double_t a_
Definition: izhikevich.h:138
double_t V_th_
Threshold.
Definition: izhikevich.h:147
Parameters_ P_
Definition: izhikevich.h:216
port handles_test_event(DataLoggingRequest &, rport)
Definition: izhikevich.h:253
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: izhikevich.h:228
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: izhikevich.cpp:91
Buffer Layout.
Definition: ring_buffer.h:77
void handle(DataLoggingRequest &)
Handler for universal data logging request.
Definition: izhikevich.cpp:243
double_t v_
Definition: izhikevich.h:167
double_t I_
Definition: izhikevich.h:169