NEST  2.6.0,not_revisioned_source_dir@0
mat2_psc_exp.h
Go to the documentation of this file.
1 /*
2  * mat2_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 
24 #ifndef MAT2_PSC_EXP_H
25 #define MAT2_PSC_EXP_H
26 
27 #include "nest.h"
28 #include "event.h"
29 #include "archiving_node.h"
30 #include "ring_buffer.h"
31 #include "connection.h"
32 #include "universal_data_logger.h"
33 #include "recordables_map.h"
34 
35 namespace nest
36 {
37 
38  class Network;
39 
40  /* BeginDocumentation
41  Name: mat2_psc_exp - Non-resetting leaky integrate-and-fire neuron model with
42  exponential PSCs and adaptive threshold.
43 
44  Description:
45  mat2_psc_exp is an implementation of a leaky integrate-and-fire model
46  with exponential shaped postsynaptic currents (PSCs). Thus, postsynaptic currents
47  have an infinitely short rise time.
48 
49  The threshold is lifted when the neuron is fired and then decreases in a fixed
50  time scale toward a fixed level [3].
51 
52  The threshold crossing is followed by a total refractory period
53  during which the neuron is not allowed to fire, even if the membrane
54  potential exceeds the threshold. The membrane potential is NOT reset,
55  but continuously integrated.
56 
57  The linear subthresold dynamics is integrated by the Exact
58  Integration scheme [1]. The neuron dynamics is solved on the time
59  grid given by the computation step size. Incoming as well as emitted
60  spikes are forced to that grid.
61 
62  An additional state variable and the corresponding differential
63  equation represents a piecewise constant external current.
64 
65  The general framework for the consistent formulation of systems with
66  neuron like dynamics interacting by point events is described in
67  [1]. A flow chart can be found in [2].
68 
69  Remarks:
70  The present implementation uses individual variables for the
71  components of the state vector and the non-zero matrix elements of
72  the propagator. Because the propagator is a lower triangular matrix
73  no full matrix multiplication needs to be carried out and the
74  computation can be done "in place" i.e. no temporary state vector
75  object is required.
76 
77  Parameters:
78  The following parameters can be set in the status dictionary:
79 
80  C_m double - Capacity of the membrane in pF
81  E_L double - Resting potential in mV
82  tau_m double - Membrane time constant in ms
83  tau_syn_ex double - Time constant of postsynaptic excitatory currents in ms
84  tau_syn_in double - Time constant of postsynaptic inhibitory currents in ms
85  t_ref double - Duration of absolute refractory period (no spiking) in ms
86  V_m double - Membrane potential in mV
87  I_e double - Constant input current in pA
88  t_spike double - Point in time of last spike in ms
89  tau_1 double - Short time constant of adaptive threshold in ms
90  tau_2 double - Long time constant of adaptive threshold in ms
91  alpha_1 double - Amplitude of short time threshold adaption in mV [3]
92  alpha_2 double - Amplitude of long time threshold adaption in mV [3]
93  omega double - Resting spike threshold in mV (absolute value, not relative to E_L as in [3])
94 
95  The following state variables can be read out with the multimeter device:
96 
97  V_m Non-resetting membrane potential
98  V_th Two-timescale adaptive threshold
99 
100  Note:
101  tau_m != tau_syn_{ex,in} is required by the current implementation to avoid a
102  degenerate case of the ODE describing the model [1]. For very similar values,
103  numerics will be unstable.
104 
105  References:
106  [1] Rotter S & Diesmann M (1999) Exact simulation of
107  time-invariant linear systems with applications to neuronal
108  modeling. Biologial Cybernetics 81:381-402.
109  [2] Diesmann M, Gewaltig M-O, Rotter S, & Aertsen A (2001) State
110  space analysis of synchronous spiking in cortical neural
111  networks. Neurocomputing 38-40:565-571.
112  [3] Kobayashi R, Tsubo Y and Shinomoto S (2009) Made-to-order
113  spiking neuron model equipped with a multi-timescale adaptive
114  threshold. Front. Comput. Neurosci. 3:9. doi:10.3389/neuro.10.009.2009
115 
116  Sends: SpikeEvent
117 
118  Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
119 
120  FirstVersion: Mai 2009
121  Author: Thomas Pfeil (modified iaf_psc_exp model of Moritz Helias)
122  */
123 
128  class mat2_psc_exp:
129  public Archiving_Node
130  {
131 
132  public:
133 
134  mat2_psc_exp();
135  mat2_psc_exp(const mat2_psc_exp&);
136 
141  using Node::handle;
143 
145 
149 
150  void handle(SpikeEvent &);
151  void handle(CurrentEvent &);
152  void handle(DataLoggingRequest &);
153 
154  void get_status(DictionaryDatum &) const;
155  void set_status(const DictionaryDatum &);
156 
157  private:
158 
159  void init_state_(const Node& proto);
160  void init_buffers_();
161  void calibrate();
162  void update(Time const &, const long_t, const long_t);
163 
164  // The next two classes need to be friends to access private members
166  friend class UniversalDataLogger<mat2_psc_exp>;
167 
168  // ----------------------------------------------------------------
169 
173  struct Parameters_ {
174 
177 
180 
183 
186 
189 
192 
195 
199 
203 
209 
210  Parameters_();
211 
212  void get(DictionaryDatum&) const;
213 
217  double set(const DictionaryDatum&);
218  };
219 
220  // ----------------------------------------------------------------
221 
225  struct State_ {
226  // state variables
227  double_t i_0_; // synaptic dc input current, variable 0
228  double_t i_syn_ex_; // postsynaptic current for exc. inputs, variable 1
229  double_t i_syn_in_; // postsynaptic current for inh. inputs, variable 1
230  double_t V_m_; // membrane potential, variable 2
231  double_t V_th_1_; // short time adaptive threshold (related to tau_1_), variable 1
232  double_t V_th_2_; // long time adaptive threshold (related to tau_2_), variable 2
233 
234  int_t r_; // total refractory counter (no spikes can be generated)
235 
236  State_();
237 
238  void get(DictionaryDatum&, const Parameters_&) const;
239 
245  void set(const DictionaryDatum&, const Parameters_&, double);
246  };
247 
248  // ----------------------------------------------------------------
249 
253  struct Buffers_ {
255  Buffers_(const Buffers_&, mat2_psc_exp&);
256 
261 
264  };
265 
266  // ----------------------------------------------------------------
267 
271  struct Variables_ {
272 
278  // double_t PSCInitialValue_;
279 
280  // time evolution operator of membrane potential
281  double_t P20_; // constant currents
287 
288  // time evolution operator of dynamic threshold
289  //P = ( exp(-h/tau_1) 0 )
290  // ( 0 exp(-h/tau_2) )
293 
295  };
296  // ----------------------------------------------------------------
297 
299  double_t get_V_m_() const { return S_.V_m_ + P_.U0_; }
300  double_t get_V_th_() const { return P_.U0_ + P_.omega_ + S_.V_th_1_ + S_.V_th_2_; }
301 
302  // ----------------------------------------------------------------
303 
319  };
320 
321 
322 inline
324 {
325  SpikeEvent e;
326  e.set_sender(*this);
327 
328  return target.handles_test_event(e, receptor_type);
329 }
330 
331 
332 inline
334 {
335  if (receptor_type != 0)
336  throw UnknownReceptorType(receptor_type, get_name());
337  return 0;
338 }
339 
340 inline
342 {
343  if (receptor_type != 0)
344  throw UnknownReceptorType(receptor_type, get_name());
345  return 0;
346 }
347 
348 inline
351 {
352  if (receptor_type != 0)
353  throw UnknownReceptorType(receptor_type, get_name());
354  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
355 }
356 
357 inline
359  {
360  P_.get(d);
361  S_.get(d, P_);
363 
364  (*d)[names::recordables] = recordablesMap_.get_list();
365  }
366 
367  inline
369  {
370  Parameters_ ptmp = P_; // temporary copy in case of errors
371  const double delta_EL = ptmp.set(d); // throws if BadProperty
372  State_ stmp = S_; // temporary copy in case of errors
373  stmp.set(d, ptmp, delta_EL); // throws if BadProperty
374 
375  // We now know that (ptmp, stmp) are consistent. We do not
376  // write them back to (P_, S_) before we are also sure that
377  // the properties to be set in the parent class are internally
378  // consistent.
380 
381  // if we get here, temporaries contain consistent set of properties
382  P_ = ptmp;
383  S_ = stmp;
384  }
385 
386 } // namespace
387 
388 #endif //MAT2_PSC_EXP_H
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
Independent parameters of the model.
Definition: mat2_psc_exp.h:173
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.
double_t tau_ex_
Time constant of excitatory synaptic current in ms.
Definition: mat2_psc_exp.h:191
double_t P11th_
Definition: mat2_psc_exp.h:291
Internal variables of the model.
Definition: mat2_psc_exp.h:271
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
double_t omega_
Resting threshold in mV (relative to resting potential).
Definition: mat2_psc_exp.h:208
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
friend class UniversalDataLogger< mat2_psc_exp >
Definition: mat2_psc_exp.h:166
double_t P21in_
Definition: mat2_psc_exp.h:285
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: mat2_psc_exp.h:323
void get(DictionaryDatum &, const Parameters_ &) const
Definition: mat2_psc_exp.cpp:146
double_t get_V_m_() const
Read out state variables, used by UniversalDataLogger.
Definition: mat2_psc_exp.h:299
double_t i_0_
Definition: mat2_psc_exp.h:227
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
double_t tau_ref_
Refractory period in ms.
Definition: mat2_psc_exp.h:182
Non-resetting leaky integrate-and-fire neuron model with exponential PSCs and adaptive threshold...
Definition: mat2_psc_exp.h:128
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: mat2_psc_exp.cpp:332
double_t i_syn_in_
Definition: mat2_psc_exp.h:229
RingBuffer currents_
Definition: mat2_psc_exp.h:260
Buffers_ B_
Definition: mat2_psc_exp.h:314
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: mat2_psc_exp.cpp:279
RingBuffer spikes_ex_
buffers and sums up incoming spikes/currents
Definition: mat2_psc_exp.h:258
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
Parameters_()
Sets default parameter values.
Definition: mat2_psc_exp.cpp:61
Variables_ V_
Definition: mat2_psc_exp.h:313
double_t P21ex_
Definition: mat2_psc_exp.h:284
double_t tau_2_
Definition: mat2_psc_exp.h:198
mat2_psc_exp()
Definition: mat2_psc_exp.cpp:183
void calibrate()
Re-calculate dependent parameters of the node.
Definition: mat2_psc_exp.cpp:220
State_()
Default initialization.
Definition: mat2_psc_exp.cpp:79
double_t i_syn_ex_
Definition: mat2_psc_exp.h:228
double_t tau_in_
Time constant of inhibitory synaptic current in ms.
Definition: mat2_psc_exp.h:194
Parameters_ P_
Definition: mat2_psc_exp.h:311
Map names of recordables to data access functions.
Definition: recordables_map.h:58
double_t P20_
Amplitude of the synaptic current.
Definition: mat2_psc_exp.h:281
Definition: nest_time.h:130
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: mat2_psc_exp.h:333
State variables of the model.
Definition: mat2_psc_exp.h:225
double_t V_m_
Definition: mat2_psc_exp.h:230
std::string get_name() const
Return class name.
Definition: node.cpp:83
double_t U0_
Resting potential in mV.
Definition: mat2_psc_exp.h:185
void set(const DictionaryDatum &, const Parameters_ &, double)
Set values from dictionary.
Definition: mat2_psc_exp.cpp:154
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
double_t V_th_1_
Definition: mat2_psc_exp.h:231
Buffers of the model.
Definition: mat2_psc_exp.h:253
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
double_t tau_1_
Short and long time constant of adaptive threshold.
Definition: mat2_psc_exp.h:197
double_t P11ex_
Definition: mat2_psc_exp.h:282
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
double_t P22th_
Definition: mat2_psc_exp.h:292
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: mat2_psc_exp.cpp:203
State_ S_
Definition: mat2_psc_exp.h:312
void get_status(DictionaryDatum &) const
Definition: mat2_psc_exp.h:358
double_t C_
Membrane capacitance in pF.
Definition: mat2_psc_exp.h:179
double_t V_th_2_
Definition: mat2_psc_exp.h:232
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
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: mat2_psc_exp.cpp:209
double double_t
Double precision floating point numbers.
Definition: nest.h:93
int_t r_
Definition: mat2_psc_exp.h:234
int_t RefractoryCountsTot_
Definition: mat2_psc_exp.h:294
double_t alpha_2_
Definition: mat2_psc_exp.h:202
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
UniversalDataLogger< mat2_psc_exp > logger_
Logger for all analog data.
Definition: mat2_psc_exp.h:263
static RecordablesMap< mat2_psc_exp > recordablesMap_
Mapping of recordables names to access functions.
Definition: mat2_psc_exp.h:318
double_t get_V_th_() const
Definition: mat2_psc_exp.h:300
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
Event for spike information.
Definition: event.h:320
double set(const DictionaryDatum &)
Set values from dictionary.
Definition: mat2_psc_exp.cpp:109
RingBuffer spikes_in_
Definition: mat2_psc_exp.h:259
double_t Tau_
Membrane time constant in ms.
Definition: mat2_psc_exp.h:176
Base class for all NEST network objects.
Definition: node.h:96
double_t P22_expm1_
Definition: mat2_psc_exp.h:286
double_t I_e_
External current in pA.
Definition: mat2_psc_exp.h:188
double_t P11in_
Definition: mat2_psc_exp.h:283
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
void set_status(const DictionaryDatum &)
Definition: mat2_psc_exp.h:368
Buffer Layout.
Definition: ring_buffer.h:77
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: mat2_psc_exp.cpp:93
Buffers_(mat2_psc_exp &)
Sets buffer pointers to 0.
Definition: mat2_psc_exp.cpp:165
double_t alpha_1_
Amplitudes of threshold adaption.
Definition: mat2_psc_exp.h:201