NEST  2.6.0,not_revisioned_source_dir@0
iaf_neuron.h
Go to the documentation of this file.
1 /*
2  * iaf_neuron.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 IAF_NEURON_H
24 #define IAF_NEURON_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  class Network;
36 
37  /* BeginDocumentation
38 Name: iaf_neuron - Leaky integrate-and-fire neuron model.
39 
40 Description:
41 
42  iaf_neuron is an implementation of a leaky integrate-and-fire model
43  with alpha-function shaped synaptic currents. Thus, synaptic currents
44  and the resulting post-synaptic potentials have a finite rise time.
45  The threshold crossing is followed by an absolute refractory period
46  during which the membrane potential is clamped to the resting potential.
47 
48  The subthreshold membrane potential dynamics are given by [3]
49 
50  dV_m/dt = - ( V_m - E_L ) / tau_m + I_syn(t) / C_m + I_e / C_m
51 
52  where I_syn(t) is the sum of alpha-shaped synaptic currents
53 
54  I_syn(t) = Sum[w_j alpha(t-t_j) for t_j in input spike times]
55 
56  w_j is the synaptic weight of the connection through which the spike
57  at time t_j arrived. Each individual alpha-current is given by
58 
59  alpha(t) = e * t/tau_s * e^{-t/tau_s} * Heaviside(t)
60 
61  alpha(t=tau_s) == 1 is the maximum of the alpha-current.
62 
63  The linear subthresold dynamics is integrated by the Exact
64  Integration scheme [1]. The neuron dynamics is solved on the time
65  grid given by the computation step size. Incoming as well as emitted
66  spikes are forced to that grid.
67 
68  An additional state variable and the corresponding differential
69  equation represents a piecewise constant external current.
70 
71  The general framework for the consistent formulation of systems with
72  neuron like dynamics interacting by point events is described in
73  [1]. A flow chart can be found in [2].
74 
75  Critical tests for the formulation of the neuron model are the
76  comparisons of simulation results for different computation step
77  sizes. sli/testsuite/nest contains a number of such tests.
78 
79  The iaf_neuron is the standard model used to check the consistency
80  of the nest simulation kernel because it is at the same time complex
81  enough to exhibit non-trivial dynamics and simple enough to compute
82  relevant measures analytically.
83 
84 
85 Parameters:
86 
87  The following parameters can be set in the status dictionary.
88 
89  V_m double - Membrane potential in mV
90  E_L double - Resting membrane potential in mV.
91  C_m double - Capacity of the membrane in pF
92  tau_m double - Membrane time constant in ms.
93  t_ref double - Duration of refractory period in ms.
94  V_th double - Spike threshold in mV.
95  V_reset double - Reset potential of the membrane in mV.
96  tau_syn double - Rise time of the excitatory synaptic alpha function in ms.
97  I_e double - Constant external input current in pA.
98 
99 Note:
100  tau_m != tau_syn is required by the current implementation to avoid a
101  degenerate case of the ODE describing the model [1]. For very similar values,
102  numerics will be unstable.
103 
104 References:
105  [1] Rotter S & Diesmann M (1999) Exact simulation of time-invariant linear
106  systems with applications to neuronal modeling. Biologial Cybernetics
107  81:381-402.
108  [2] Diesmann M, Gewaltig M-O, Rotter S, & Aertsen A (2001) State space
109  analysis of synchronous spiking in cortical neural networks.
110  Neurocomputing 38-40:565-571.
111  [3] Morrison A, Straube S, Plesser H E, & Diesmann M (2007) Exact subthreshold
112  integration with continuous spike times in discrete time neural network
113  simulations. Neural Computation 19:47-79.
114 
115 Sends: SpikeEvent
116 
117 Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
118 
119 Author: September 1999, Diesmann, Gewaltig
120 SeeAlso: iaf_psc_alpha, testsuite::test_iaf
121 */
122 
127  {
128 
129  public:
130 
131  iaf_neuron();
132  iaf_neuron(const iaf_neuron&);
133 
138  using Node::handle;
140 
142 
143  void handle(SpikeEvent &);
144  void handle(CurrentEvent &);
145  void handle(DataLoggingRequest &);
146 
150 
151  void get_status(DictionaryDatum &) const;
152  void set_status(const DictionaryDatum &);
153 
154  private:
155 
156  void init_state_(const Node& proto);
157  void init_buffers_();
158  void calibrate();
159 
160  void update(Time const &, const long_t, const long_t);
161 
162  // The next two classes need to be friends to access the State_ class/member
163  friend class RecordablesMap<iaf_neuron>;
164  friend class UniversalDataLogger<iaf_neuron>;
165 
166  // ----------------------------------------------------------------
167 
171  struct Parameters_ {
174 
177 
180 
183 
186 
190 
194 
197 
198  Parameters_();
199 
200  void get(DictionaryDatum&) const;
201 
205  double set(const DictionaryDatum&);
206  };
207 
208  // ----------------------------------------------------------------
209 
213  struct State_ {
218 
220 
221  State_();
222 
223  void get(DictionaryDatum&, const Parameters_&) const;
224 
230  void set(const DictionaryDatum&, const Parameters_&, double);
231  };
232 
233  // ----------------------------------------------------------------
234 
238  struct Buffers_ {
239  Buffers_(iaf_neuron &);
240  Buffers_(const Buffers_ &, iaf_neuron &);
241 
245 
248  };
249 
250  // ----------------------------------------------------------------
251 
255  struct Variables_ {
262 
270  };
271 
272  // Access functions for UniversalDataLogger -------------------------------
273 
275  double_t get_V_m_() const { return S_.y3_ + P_.U0_; }
276 
277  // ----------------------------------------------------------------
278 
292 
295 
298 };
299 
300 inline
302 {
303  SpikeEvent e;
304  e.set_sender(*this);
305 
306  return target.handles_test_event(e, receptor_type);
307 }
308 
309 inline
311 {
312  if (receptor_type != 0)
313  throw UnknownReceptorType(receptor_type, get_name());
314  return 0;
315 }
316 
317 inline
319 {
320  if (receptor_type != 0)
321  throw UnknownReceptorType(receptor_type, get_name());
322  return 0;
323 }
324 
325 inline
328 {
329  if (receptor_type != 0)
330  throw UnknownReceptorType(receptor_type, get_name());
331  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
332 }
333 
334 inline
336 {
337  P_.get(d);
338  S_.get(d, P_);
340  (*d)[names::recordables] = recordablesMap_.get_list();
341 }
342 
343 inline
345 {
346  Parameters_ ptmp = P_; // temporary copy in case of errors
347  const double delta_EL = ptmp.set(d); // throws if BadProperty
348  State_ stmp = S_; // temporary copy in case of errors
349  stmp.set(d, ptmp, delta_EL); // throws if BadProperty
350 
351  // We now know that (ptmp, stmp) are consistent. We do not
352  // write them back to (P_, S_) before we are also sure that
353  // the properties to be set in the parent class are internally
354  // consistent.
356 
357  // if we get here, temporaries contain consistent set of properties
358  P_ = ptmp;
359  S_ = stmp;
360 }
361 
362 } // namespace
363 
364 #endif /* #ifndef IAF_NEURON_H */
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
double set(const DictionaryDatum &)
Set values from dictionary.
Definition: iaf_neuron.cpp:92
int int_t
Integer number with at least 16 bit.
Definition: nest.h:95
Definition of Archiving_Node which is capable of recording and managing a spike history.
Variables_ V_
Definition: iaf_neuron.h:290
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
double_t y2_
Definition: iaf_neuron.h:216
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_neuron.cpp:191
double_t tau_syn_
Time constant of synaptic current in ms.
Definition: iaf_neuron.h:179
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
static RecordablesMap< iaf_neuron > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_neuron.h:294
void get_status(DictionaryDatum &) const
Definition: iaf_neuron.h:335
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_neuron.cpp:183
State_ S_
Definition: iaf_neuron.h:289
friend class UniversalDataLogger< iaf_neuron >
Definition: iaf_neuron.h:164
double_t y0_
Constant current.
Definition: iaf_neuron.h:214
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_neuron.h:310
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 handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_neuron.cpp:283
double_t P32_
Definition: iaf_neuron.h:267
Parameters_ P_
Definition: iaf_neuron.h:288
double_t I_e_
External current in pA.
Definition: iaf_neuron.h:196
double_t C_
Membrane capacitance in pF.
Definition: iaf_neuron.h:173
Buffers_ B_
Definition: iaf_neuron.h:291
Independent parameters of the model.
Definition: iaf_neuron.h:171
double_t TauR_
Refractory period in ms.
Definition: iaf_neuron.h:182
double_t P21_
Definition: iaf_neuron.h:264
State_()
Default initialization.
Definition: iaf_neuron.cpp:68
Map names of recordables to data access functions.
Definition: recordables_map.h:58
iaf_neuron()
Definition: iaf_neuron.cpp:157
Definition: nest_time.h:130
double_t PSCInitialValue_
Amplitude of the synaptic current.
Definition: iaf_neuron.h:260
Leaky integrate-and-fire neuron.
Definition: iaf_neuron.h:126
std::string get_name() const
Return class name.
Definition: node.cpp:83
void set_status(const DictionaryDatum &)
Definition: iaf_neuron.h:344
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_neuron.cpp:80
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
double_t P11_
Definition: iaf_neuron.h:263
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: iaf_neuron.cpp:238
double_t V_reset_
Reset value of the membrane potential, in mV.
Definition: iaf_neuron.h:189
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
int_t r_
number of refractory steps remaining
Definition: iaf_neuron.h:219
double_t P30_
Definition: iaf_neuron.h:268
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
Parameters_()
Sets default parameter values.
Definition: iaf_neuron.cpp:57
Buffers_(iaf_neuron &)
Definition: iaf_neuron.cpp:144
double double_t
Double precision floating point numbers.
Definition: nest.h:93
UniversalDataLogger< iaf_neuron > logger_
Logger for all analog data.
Definition: iaf_neuron.h:247
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_neuron.cpp:177
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
State variables of the model.
Definition: iaf_neuron.h:213
Request data to be logged/logged data to be sent.
Definition: event.h:486
RingBuffer spikes_
buffers and summs up incoming spikes/currents
Definition: iaf_neuron.h:243
void set(const DictionaryDatum &, const Parameters_ &, double)
Set values from dictionary.
Definition: iaf_neuron.cpp:136
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_neuron.h:301
void get(DictionaryDatum &, const Parameters_ &) const
Definition: iaf_neuron.cpp:131
Buffers of the model.
Definition: iaf_neuron.h:238
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
double_t Theta_
Threshold in mV.
Definition: iaf_neuron.h:193
double_t get_V_m_() const
Read out the real membrane potential.
Definition: iaf_neuron.h:275
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
Event for spike information.
Definition: event.h:320
int_t RefractoryCounts_
refractory time in steps
Definition: iaf_neuron.h:261
double_t Tau_
Membrane time constant in ms.
Definition: iaf_neuron.h:176
double_t U0_
Resting potential in mV.
Definition: iaf_neuron.h:185
double_t y1_
Definition: iaf_neuron.h:215
Base class for all NEST network objects.
Definition: node.h:96
double_t P33_
Definition: iaf_neuron.h:269
double_t P31_
Definition: iaf_neuron.h:266
RingBuffer currents_
Definition: iaf_neuron.h:244
double_t P22_
Definition: iaf_neuron.h:265
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
double_t y3_
This is the membrane potential RELATIVE TO RESTING POTENTIAL.
Definition: iaf_neuron.h:217
Internal variables of the model.
Definition: iaf_neuron.h:255
Buffer Layout.
Definition: ring_buffer.h:77