NEST  2.6.0,not_revisioned_source_dir@0
iaf_psc_exp.h
Go to the documentation of this file.
1 /*
2  * iaf_psc_exp.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_PSC_EXP_H
24 #define IAF_PSC_EXP_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 #include "recordables_map.h"
33 
34 namespace nest
35 {
36  class Network;
37 
38  /* BeginDocumentation
39  Name: iaf_psc_exp - Leaky integrate-and-fire neuron model with exponential PSCs.
40 
41  Description:
42  iaf_psc_expp is an implementation of a leaky integrate-and-fire model
43  with exponential shaped postsynaptic currents (PSCs) according to [1].
44  Thus, postsynaptic currents have an infinitely short rise time.
45 
46  The threshold crossing is followed by an absolute refractory period (t_ref)
47  during which the membrane potential is clamped to the resting potential
48  and spiking is prohibited.
49 
50  The linear subthresold dynamics is integrated by the Exact
51  Integration scheme [2]. The neuron dynamics is solved on the time
52  grid given by the computation step size. Incoming as well as emitted
53  spikes are forced to that grid.
54 
55  An additional state variable and the corresponding differential
56  equation represents a piecewise constant external current. If the
57  corresponding current event is connected with port 1 the current
58  is filtered by the synapse (using the time constant of post-synaptic
59  excitatory currents)
60 
61  The general framework for the consistent formulation of systems with
62  neuron like dynamics interacting by point events is described in
63  [2]. A flow chart can be found in [3].
64 
65  Remarks:
66  The present implementation uses individual variables for the
67  components of the state vector and the non-zero matrix elements of
68  the propagator. Because the propagator is a lower triangular matrix
69  no full matrix multiplication needs to be carried out and the
70  computation can be done "in place" i.e. no temporary state vector
71  object is required.
72 
73  The template support of recent C++ compilers enables a more succinct
74  formulation without loss of runtime performance already at minimal
75  optimization levels. A future version of iaf_psc_exp will probably
76  address the problem of efficient usage of appropriate vector and
77  matrix objects.
78 
79  Parameters:
80  The following parameters can be set in the status dictionary.
81 
82  E_L double - Resting membrane potential in mV.
83  C_m double - Capacity of the membrane in pF
84  tau_m double - Membrane time constant in ms.
85  tau_syn_ex double - Time constant of postsynaptic excitatory currents in ms
86  tau_syn_in double - Time constant of postsynaptic inhibitory currents in ms
87  t_ref double - Duration of refractory period (V_m = V_reset) in ms.
88  V_m double - Membrane potential in mV
89  V_th double - Spike threshold in mV.
90  V_reset double - Reset membrane potential after a spike in mV.
91  I_e double - Constant input current in pA.
92  t_spike double - Point in time of last spike in ms.
93 
94  Note:
95  tau_m != tau_syn_{ex,in} is required by the current implementation to avoid a
96  degenerate case of the ODE describing the model [1]. For very similar values,
97  numerics will be unstable.
98 
99  References:
100  [1] Misha Tsodyks, Asher Uziel, and Henry Markram (2000) Synchrony Generation in Recurrent
101  Networks with Frequency-Dependent Synapses, The Journal of Neuroscience, 2000, Vol. 20 RC50 p. 1-5
102  [2] Rotter S & Diesmann M (1999) Exact simulation of time-invariant linear
103  systems with applications to neuronal modeling. Biologial Cybernetics
104  81:381-402.
105  [3] Diesmann M, Gewaltig M-O, Rotter S, & Aertsen A (2001) State space
106  analysis of synchronous spiking in cortical neural networks.
107  Neurocomputing 38-40:565-571.
108 
109  Sends: SpikeEvent
110 
111  Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
112 
113  SeeAlso: iaf_psc_exp_ps
114 
115  FirstVersion: March 2006
116  Author: Moritz Helias
117  */
118 
122  class iaf_psc_exp:
123  public Archiving_Node
124  {
125 
126  public:
127 
128  iaf_psc_exp();
129  iaf_psc_exp(const iaf_psc_exp&);
130 
135  using Node::handle;
137 
139 
140  void handle(SpikeEvent &);
141  void handle(CurrentEvent &);
142  void handle(DataLoggingRequest &);
143 
147 
148  void get_status(DictionaryDatum &) const;
149  void set_status(const DictionaryDatum &);
150 
151  private:
152 
153  void init_state_(const Node& proto);
154  void init_buffers_();
155  void calibrate();
156 
157  void update(const Time &, const long_t, const long_t);
158 
159  // The next two classes need to be friends to access the State_ class/member
161  friend class UniversalDataLogger<iaf_psc_exp>;
162 
163  // ----------------------------------------------------------------
164 
168  struct Parameters_
169  {
170 
173 
176 
179 
182 
185 
189 
192 
195 
198 
199  Parameters_();
200 
201  void get(DictionaryDatum&) const;
202 
206  double set(const DictionaryDatum&);
207  };
208 
209  // ----------------------------------------------------------------
210 
214  struct State_
215  {
216  // state variables
217  double_t i_0_; // synaptic stepwise constant input current, variable 0
218  double_t i_1_; // presynaptic stepwise constant input current
219  double_t i_syn_ex_; // postsynaptic current for exc. inputs, variable 1
220  double_t i_syn_in_; // postsynaptic current for inh. inputs, variable 1
221  double_t V_m_; // membrane potential, variable 2
222 
223  int_t r_ref_; // absolute refractory counter (no membrane potential propagation)
224 
225  State_();
226 
227  void get(DictionaryDatum&, const Parameters_ &) const;
228 
234  void set(const DictionaryDatum&, const Parameters_ &, const double);
235  };
236 
237  // ----------------------------------------------------------------
238 
242  struct Buffers_
243  {
245  Buffers_(const Buffers_ &, iaf_psc_exp &);
246 
250  std::vector<RingBuffer> currents_;
251 
254  };
255 
256  // ----------------------------------------------------------------
257 
261  struct Variables_
262  {
268  // double_t PSCInitialValue_;
269 
270  // time evolution operator
277 
280 
282  };
283 
284  // Access functions for UniversalDataLogger -------------------------------
285 
287  double_t get_V_m_() const { return S_.V_m_ + P_.U0_; }
288 
293 
294  // ----------------------------------------------------------------
295 
311  };
312 
313 
314 inline
316 {
317  SpikeEvent e;
318  e.set_sender(*this);
319  return target.handles_test_event(e, receptor_type);
320 }
321 
322 inline
324 {
325  if (receptor_type != 0)
326  throw UnknownReceptorType(receptor_type, get_name());
327  return 0;
328 }
329 
330 inline
332 {
333  if (receptor_type == 0)
334  return 0;
335  else if (receptor_type == 1)
336  return 1;
337  else
338  throw UnknownReceptorType(receptor_type, get_name());
339 }
340 
341 inline
344 {
345  if (receptor_type != 0)
346  throw UnknownReceptorType(receptor_type, get_name());
347  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
348 }
349 
350  inline
352  {
353  P_.get(d);
354  S_.get(d, P_);
356 
357  (*d)[names::recordables] = recordablesMap_.get_list();
358  }
359 
360  inline
362  {
363  Parameters_ ptmp = P_; // temporary copy in case of errors
364  const double delta_EL = ptmp.set(d); // throws if BadProperty
365  State_ stmp = S_; // temporary copy in case of errors
366  stmp.set(d, ptmp, delta_EL); // throws if BadProperty
367 
368  // We now know that (ptmp, stmp) are consistent. We do not
369  // write them back to (P_, S_) before we are also sure that
370  // the properties to be set in the parent class are internally
371  // consistent.
373 
374  // if we get here, temporaries contain consistent set of properties
375  P_ = ptmp;
376  S_ = stmp;
377  }
378 
379 } // namespace
380 
381 #endif // IAF_PSC_EXP_H
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
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.
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_psc_exp.cpp:308
State_ S_
Definition: iaf_psc_exp.h:304
void set_status(const DictionaryDatum &)
Definition: iaf_psc_exp.h:361
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
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_psc_exp.h:315
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
double_t P21in_
Definition: iaf_psc_exp.h:275
double_t i_syn_ex_
Definition: iaf_psc_exp.h:219
Buffers of the model.
Definition: iaf_psc_exp.h:242
double_t V_reset_
reset value of the membrane potential
Definition: iaf_psc_exp.h:191
double_t i_0_
Definition: iaf_psc_exp.h:217
void get_status(DictionaryDatum &) const
Definition: iaf_psc_exp.h:351
RingBuffer spikes_ex_
buffers and sums up incoming spikes/currents
Definition: iaf_psc_exp.h:248
int_t RefractoryCounts_
Definition: iaf_psc_exp.h:281
double_t Tau_
Membrane time constant in ms.
Definition: iaf_psc_exp.h:172
State_()
Default initialization.
Definition: iaf_psc_exp.cpp:73
double_t i_1_
Definition: iaf_psc_exp.h:218
Independent parameters of the model.
Definition: iaf_psc_exp.h:168
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 set(const DictionaryDatum &, const Parameters_ &, const double)
Set values from dictionary.
Definition: iaf_psc_exp.cpp:146
Leaky integrate-and-fire neuron with exponential PSCs.
Definition: iaf_psc_exp.h:122
Variables_ V_
Definition: iaf_psc_exp.h:305
friend class UniversalDataLogger< iaf_psc_exp >
Definition: iaf_psc_exp.h:161
double_t C_
Membrane capacitance in pF.
Definition: iaf_psc_exp.h:175
double_t P22_
Definition: iaf_psc_exp.h:276
double_t weighted_spikes_ex_
Definition: iaf_psc_exp.h:278
Map names of recordables to data access functions.
Definition: recordables_map.h:58
Parameters_ P_
Definition: iaf_psc_exp.h:303
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_psc_exp.cpp:193
Buffers_ B_
Definition: iaf_psc_exp.h:306
std::vector< RingBuffer > currents_
Definition: iaf_psc_exp.h:250
Internal variables of the model.
Definition: iaf_psc_exp.h:261
State variables of the model.
Definition: iaf_psc_exp.h:214
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_psc_exp.cpp:202
Definition: nest_time.h:130
double_t Theta_
Threshold, RELATIVE TO RESTING POTENTAIL(!).
Definition: iaf_psc_exp.h:188
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_psc_exp.h:323
std::string get_name() const
Return class name.
Definition: node.cpp:83
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
iaf_psc_exp()
Definition: iaf_psc_exp.cpp:167
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
void get(DictionaryDatum &, const Parameters_ &) const
Definition: iaf_psc_exp.cpp:141
UniversalDataLogger< iaf_psc_exp > logger_
Logger for all analog data.
Definition: iaf_psc_exp.h:253
double_t get_weighted_spikes_in_() const
Definition: iaf_psc_exp.h:290
double_t P11in_
Definition: iaf_psc_exp.h:273
double_t tau_ex_
Time constant of excitatory synaptic current in ms.
Definition: iaf_psc_exp.h:194
double_t U0_
Resting potential in mV.
Definition: iaf_psc_exp.h:181
double_t P21ex_
Definition: iaf_psc_exp.h:274
double_t t_ref_
Refractory period in ms.
Definition: iaf_psc_exp.h:178
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
double_t I_e_
External current in pA.
Definition: iaf_psc_exp.h:184
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
static RecordablesMap< iaf_psc_exp > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_psc_exp.h:310
double double_t
Double precision floating point numbers.
Definition: nest.h:93
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
Request data to be logged/logged data to be sent.
Definition: event.h:486
void update(const Time &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: iaf_psc_exp.cpp:259
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_psc_exp.cpp:85
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
double_t tau_in_
Time constant of inhibitory synaptic current in ms.
Definition: iaf_psc_exp.h:197
double_t get_V_m_() const
Read out the real membrane potential.
Definition: iaf_psc_exp.h:287
int_t r_ref_
Definition: iaf_psc_exp.h:223
double_t P20_
Amplitude of the synaptic current.
Definition: iaf_psc_exp.h:271
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
double_t V_m_
Definition: iaf_psc_exp.h:221
Event for spike information.
Definition: event.h:320
Parameters_()
Sets default parameter values.
Definition: iaf_psc_exp.cpp:61
double_t get_input_currents_in_() const
Definition: iaf_psc_exp.h:292
Base class for all NEST network objects.
Definition: node.h:96
Buffers_(iaf_psc_exp &)
Definition: iaf_psc_exp.cpp:155
double set(const DictionaryDatum &)
Set values from dictionary.
Definition: iaf_psc_exp.cpp:98
double_t weighted_spikes_in_
Definition: iaf_psc_exp.h:279
double_t P11ex_
Definition: iaf_psc_exp.h:272
double_t get_weighted_spikes_ex_() const
Definition: iaf_psc_exp.h:289
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
RingBuffer spikes_in_
Definition: iaf_psc_exp.h:249
double_t i_syn_in_
Definition: iaf_psc_exp.h:220
double_t get_input_currents_ex_() const
Definition: iaf_psc_exp.h:291
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_psc_exp.cpp:187
Buffer Layout.
Definition: ring_buffer.h:77