NEST main@f146f75
Loading...
Searching...
No Matches
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// Includes from nestkernel:
27#include "archiving_node.h"
28#include "connection.h"
29#include "event.h"
30#include "nest_types.h"
31#include "recordables_map.h"
32#include "ring_buffer.h"
34
35namespace nest
36{
37// Disable clang-formatting for documentation due to over-wide table.
38// clang-format off
39/* BeginUserDocs: neuron, integrate-and-fire, current-based, hard threshold
40
41Short description
42+++++++++++++++++
43
44Leaky integrate-and-fire neuron model with exponential-shaped input currents
45
46Description
47+++++++++++
48
49``iaf_psc_exp`` a leaky integrate-and-fire model with
50
51* a hard threshold (if :math:`\delta=0`, see below)
52* a fixed refractory period,
53* no adaptation mechanisms,
54* exponential-shaped synaptic input currents according to :footcite:p:`Tsodyks2000`.
55
56Membrane potential evolution, spike emission, and refractoriness
57................................................................
58
59The membrane potential evolves according to
60
61.. math::
62
63 \frac{dV_\text{m}}{dt} = -\frac{V_{\text{m}} - E_\text{L}}{\tau_{\text{m}}} + \frac{I_{\text{syn}} + I_\text{e}}{C_{\text{m}}}
64
65where the synaptic input current :math:`I_{\text{syn}}(t)` is discussed below and :math:`I_\text{e}` is
66a constant input current set as a model parameter.
67
68A spike is emitted at time step :math:`t^*=t_{k+1}` if
69
70.. math::
71
72 V_\text{m}(t_k) < V_{\text{th}} \quad\text{and}\quad V_\text{m}(t_{k+1})\geq V_\text{th} \;.
73
74Subsequently,
75
76.. math::
77
78 V_\text{m}(t) = V_{\text{reset}} \quad\text{for}\quad t^* \leq t < t^* + t_{\text{ref}} \;,
79
80that is, the membrane potential is clamped to :math:`V_{\text{reset}}` during the refractory period.
81
82.. note::
83
84 Spiking in this model can be either deterministic (:math:`\delta=0`) or stochastic (:math:`\delta > 0`).
85 In the stochastic case, this model implements a type of spike response model with escape noise.
86 Spiking is given by an inhomogeneous Poisson process with rate
87
88 .. math::
89 \rho \exp \left( \frac{V_{\text{m}} - V_{\text{th}}}{\delta} \right).
90
91Synaptic input
92..............
93
94The synaptic input current has an excitatory and an inhibitory component
95
96.. math::
97
98 I_{\text{syn}}(t) = I_{\text{syn, ex}}(t) + I_{\text{syn, in}}(t)
99
100where
101
102.. math::
103
104 I_{\text{syn, X}}(t) = \sum_{j} \sum_{k} i_{\text{syn, X}}(t-t_j^k-d_j) \;,
105
106where :math:`j` indexes either excitatory (:math:`\text{X} = \text{ex}`)
107or inhibitory (:math:`\text{X} = \text{in}`) presynaptic neurons,
108:math:`k` indexes the spike times of neuron :math:`j`, and :math:`d_j`
109is the delay from neuron :math:`j`.
110
111The individual post-synaptic currents (PSCs) are given by
112
113.. math::
114
115 i_{\text{syn, X}}(t) = w \cdot e^{-\frac{t}{\tau_{\text{syn, X}}}} \cdot \Theta(t)
116
117where :math:`w` is a weight (excitatory if :math:`w > 0` or inhibitory if :math:`w < 0`), and :math:`\Theta(x)` is the Heaviside step function. The time dependent components of the PSCs are normalized to unit maximum, so that,
118
119.. math::
120
121 i_{\text{syn, X}}(t= 0) = w \;.
122
123As a consequence, the total charge :math:`q` transferred by a single PSC depends
124on the synaptic time constant according to
125
126.. math::
127
128 q = \int_0^{\infty} i_{\text{syn, X}}(t) dt = w \cdot \tau_{\text{syn, X}} \;.
129
130
131.. note::
132
133
134 If ``tau_m`` is very close to ``tau_syn_ex`` or ``tau_syn_in``, the model
135 will numerically behave as if ``tau_m`` is equal to ``tau_syn_ex`` or
136 ``tau_syn_in``, respectively, to avoid numerical instabilities.
137
138 NEST uses exact integration :footcite:p:`Rotter1999`, :footcite:p:`Diesmann2001` to integrate subthreshold membrane dynamics
139 with maximum precision.
140
141 For implementation details see the
142 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
143
144``iaf_psc_exp`` can handle current input in two ways:
145
1461. Current input through ``receptor_type`` 0 is handled as a stepwise constant
147 current input as in other iaf models, that is, this current directly enters the
148 membrane potential equation.
1492. In contrast, current input through ``receptor_type`` 1 is filtered through an
150 exponential kernel with the time constant of the excitatory synapse,
151 ``tau_syn_ex``.
152
153 For an example application, see :footcite:p:`Schuecker2015`.
154
155 **Warning:** this current input is added to the state variable
156 ``i_syn_ex_``. If this variable is being recorded, its numerical value
157 will thus not correspond to the excitatory synaptic input current, but to
158 the sum of excitatory synaptic input current and the contribution from
159 receptor type 1 currents.
160
161For conversion between postsynaptic potentials (PSPs) and PSCs,
162please refer to the ``postsynaptic_potential_to_current`` function in
163`PyNEST Microcircuit: Helper Functions <https://github.com/INM-6/microcircuit-PD14-model/blob/main/PyNEST/src/microcircuit/helpers.py>`_.
164
165.. note::
166
167 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
168 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
169 the inhibitory one, and also sets the direction of the post-synaptic current.
170 Spike connections must use the default ``receptor_type`` of 0.
171
172 See :ref:`synapse_selection` for the conventions used by other models.
173
174Parameters
175++++++++++
176
177The following parameters can be set in the status dictionary.
178
179
180=============== ================== =============================== ========================================================================
181**Parameter** **Default** **Math equivalent** **Description**
182=============== ================== =============================== ========================================================================
183``E_L`` -70 mV :math:`E_\text{L}` Resting membrane potential
184``C_m`` 250 pF :math:`C_{\text{m}}` Capacity of the membrane
185``tau_m`` 10 ms :math:`\tau_{\text{m}}` Membrane time constant
186``t_ref`` 2 ms :math:`t_{\text{ref}}` Duration of refractory period
187``V_th`` -55 mV :math:`V_{\text{th}}` Spike threshold
188``V_reset`` -70 mV :math:`V_{\text{reset}}` Reset potential of the membrane
189``tau_syn_ex`` 2 ms :math:`\tau_{\text{syn, ex}}` Exponential decay time constant of excitatory postsynaptic current
190``tau_syn_in`` 2 ms :math:`\tau_{\text{syn, in}}` Exponential decay time constant of inhibitory postsynaptic current
191``I_e`` 0 pA :math:`I_\text{e}` Constant input current
192``delta`` 0 mV :math:`\delta` Parameter scaling stochastic spiking
193``rho`` 0.01 1/s :math:`\rho` Baseline stochastic spiking
194=============== ================== =============================== ========================================================================
195
196The following state variables evolve during simulation and are available either as neuron properties or as recordables.
197
198================== ================= ========================== =================================
199**State variable** **Initial value** **Math equivalent** **Description**
200================== ================= ========================== =================================
201``V_m`` -70 mV :math:`V_{\text{m}}` Membrane potential
202``I_syn_ex`` 0 pA :math:`I_{\text{syn, ex}}` Excitatory synaptic input current
203``I_syn_in`` 0 pA :math:`I_{\text{syn, in}}` Inhibitory synaptic input current
204================== ================= ========================== =================================
205
206
207References
208++++++++++
209
210.. footbibliography::
211
212Sends
213+++++
214
215SpikeEvent
216
217Receives
218++++++++
219
220SpikeEvent, CurrentEvent, DataLoggingRequest
221
222See also
223++++++++
224
225iaf_cond_exp, iaf_psc_exp_ps
226
227Examples using this model
228+++++++++++++++++++++++++
229
230.. listexamples:: iaf_psc_exp
231
232EndUserDocs */
233
248
249void register_iaf_psc_exp( const std::string& name );
250
252{
253
254public:
255 iaf_psc_exp();
256 iaf_psc_exp( const iaf_psc_exp& );
257
263 using Node::handle;
265
266 size_t send_test_event( Node&, size_t, synindex, bool ) override;
267
268 void handle( SpikeEvent& ) override;
269 bool
271 {
272 return true;
273 }
274
275 void handle( WeightCorrectionEvent& ) override;
276 void handle( CurrentEvent& ) override;
277 void handle( DataLoggingRequest& ) override;
278
279 size_t handles_test_event( SpikeEvent&, size_t ) override;
280 size_t handles_test_event( WeightCorrectionEvent&, size_t ) override;
281 size_t handles_test_event( CurrentEvent&, size_t ) override;
282 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
283
284 void get_status( Dictionary& ) const override;
285 void set_status( const Dictionary& ) override;
286
287private:
288 void init_buffers_() override;
289 void pre_run_hook() override;
290
291 void update( const Time&, const long, const long ) override;
292
293 // intensity function
294 double phi_() const;
295
296 // The next two classes need to be friends to access the State_ class/member
297 friend class RecordablesMap< iaf_psc_exp >;
298 friend class UniversalDataLogger< iaf_psc_exp >;
299
300 // ----------------------------------------------------------------
301
306 {
308 double Tau_;
309
311 double C_;
312
314 double t_ref_;
315
317 double E_L_;
318
320 double I_e_;
321
324 double Theta_;
325
327 double V_reset_;
328
330 double tau_ex_;
331
333 double tau_in_;
334
336 double rho_;
337
339 double delta_;
340
341 Parameters_();
342
343 void get( Dictionary& ) const;
344
348 double set( const Dictionary&, Node* node );
349 };
350
351 // ----------------------------------------------------------------
352
356 struct State_
357 {
358 // state variables
359 double i_0_;
360 double i_1_;
361 double i_syn_ex_;
363 double i_syn_in_;
364 double V_m_;
365 int r_ref_;
366
367 State_();
368
369 void get( Dictionary&, const Parameters_& ) const;
370
376 void set( const Dictionary&, const Parameters_&, const double, Node* );
377 };
378
379 // ----------------------------------------------------------------
380
405
406 // ----------------------------------------------------------------
407
412 {
418 // double PSCInitialValue_;
419
420 // time evolution operator
421 double P20_;
422 double P11ex_;
423 double P11in_;
424 double P21ex_;
425 double P21in_;
426 double P22_;
427
430
432
434 };
435
436 // Access functions for UniversalDataLogger -------------------------------
437
439 inline double
440 get_V_m_() const
441 {
442 return S_.V_m_ + P_.E_L_;
443 }
444
445 inline double
447 {
448 return S_.i_syn_ex_;
449 }
450
451 inline double
453 {
454 return S_.i_syn_in_;
455 }
456
457 // ----------------------------------------------------------------
458
470
473};
474
475
476inline size_t
477iaf_psc_exp::send_test_event( Node& target, size_t receptor_type, synindex, bool )
478{
479 SpikeEvent e;
480 e.set_sender( *this );
481 return target.handles_test_event( e, receptor_type );
482}
483
484inline size_t
486{
487 if ( receptor_type != 0 )
488 {
489 throw UnknownReceptorType( receptor_type, get_name() );
490 }
491 return 0;
492}
493
494inline size_t
496{
497 if ( receptor_type != 0 )
498 {
499 throw UnknownReceptorType( receptor_type, get_name() );
500 }
501 return 0;
502}
503
504inline size_t
506{
507 if ( receptor_type == 0 )
508 {
509 return 0;
510 }
511 else if ( receptor_type == 1 )
512 {
513 return 1;
514 }
515 else
516 {
517 throw UnknownReceptorType( receptor_type, get_name() );
518 }
519}
520
521inline size_t
523{
524 if ( receptor_type != 0 )
525 {
526 throw UnknownReceptorType( receptor_type, get_name() );
527 }
528 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
529}
530
531inline void
533{
534 P_.get( d );
535 S_.get( d, P_ );
537
538 d[ names::recordables ] = recordablesMap_.get_list();
539}
540
541inline void
543{
544 Parameters_ ptmp = P_; // temporary copy in case of errors
545 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
546 State_ stmp = S_; // temporary copy in case of errors
547 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
548
549 // We now know that (ptmp, stmp) are consistent. We do not
550 // write them back to (P_, S_) before we are also sure that
551 // the properties to be set in the parent class are internally
552 // consistent.
554
555 // if we get here, temporaries contain consistent set of properties
556 P_ = ptmp;
557 S_ = stmp;
558}
559
560inline double
562{
563 assert( P_.delta_ > 0. );
564 return P_.rho_ * std::exp( 1. / P_.delta_ * ( S_.V_m_ - P_.Theta_ ) );
565}
566
567} // namespace
568
569#endif // IAF_PSC_EXP_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
ArchivingNode()
Definition archiving_node.cpp:37
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition archiving_node.cpp:249
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition archiving_node.cpp:265
Event for electrical currents.
Definition event.h:608
Request data to be logged/logged data to be sent.
Definition event.h:675
Base class for all NEST network objects.
Definition node.h:99
std::string get_name() const
Return class name.
Definition node.cpp:105
Map names of recordables to data access functions.
Definition recordables_map.h:61
Event for spike information.
Definition event.h:420
Definition nest_time.h:135
Exception to be thrown if the specified receptor type does not exist in the node.
Definition exceptions.h:417
Definition event.h:457
Variables_ V_
Definition iaf_psc_exp.h:467
double get_I_syn_in_() const
Definition iaf_psc_exp.h:452
friend class UniversalDataLogger< iaf_psc_exp >
Definition iaf_psc_exp.h:298
iaf_psc_exp()
Definition iaf_psc_exp.cpp:214
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition iaf_psc_exp.h:477
bool supports_axonal_delay_corrections() const override
Whether this model can be the target of a synapse with predominantly axonal delay.
Definition iaf_psc_exp.h:270
friend class RecordablesMap< iaf_psc_exp >
Definition iaf_psc_exp.h:297
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_exp.h:532
void init_buffers_() override
Configure persistent internal data structures.
Definition iaf_psc_exp.cpp:236
Buffers_ B_
Definition iaf_psc_exp.h:468
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition iaf_psc_exp.h:465
double get_V_m_() const
Read out the real membrane potential.
Definition iaf_psc_exp.h:440
State_ S_
Definition iaf_psc_exp.h:466
double phi_() const
Definition iaf_psc_exp.h:561
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition iaf_psc_exp.cpp:244
void update(const Time &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition iaf_psc_exp.cpp:290
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition iaf_psc_exp.h:542
static RecordablesMap< iaf_psc_exp > recordablesMap_
Mapping of recordables names to access functions.
Definition iaf_psc_exp.h:472
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition iaf_psc_exp.cpp:355
double get_I_syn_ex_() const
Definition iaf_psc_exp.h:446
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition iaf_psc_exp.h:485
virtual size_t handles_test_event(SpikeEvent &, size_t receptor_type)
Check if the node can handle a particular event and receptor type.
Definition node.cpp:282
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition node.cpp:271
const std::string recordables("recordables")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
BaseRandomGenerator * RngPtr
Definition random_generators.h:50
void register_iaf_psc_exp(const std::string &name)
The present implementation uses individual variables for the components of the state vector and the n...
Definition iaf_psc_exp.cpp:50
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:121
Buffers of the model.
Definition iaf_psc_exp.h:385
@ NUM_INPUT_CHANNELS
Definition iaf_psc_exp.h:396
@ SYN_EX
Definition iaf_psc_exp.h:393
@ I0
Definition iaf_psc_exp.h:394
@ SYN_IN
Definition iaf_psc_exp.h:392
@ I1
Definition iaf_psc_exp.h:395
UniversalDataLogger< iaf_psc_exp > logger_
Logger for all analog data.
Definition iaf_psc_exp.h:403
Buffers_(iaf_psc_exp &)
Definition iaf_psc_exp.cpp:200
MultiChannelInputBuffer< NUM_INPUT_CHANNELS > input_buffer_
buffers and sums up incoming spikes/currents
Definition iaf_psc_exp.h:400
Independent parameters of the model.
Definition iaf_psc_exp.h:306
double t_ref_
Refractory period in ms.
Definition iaf_psc_exp.h:314
double delta_
Width of threshold region in mV.
Definition iaf_psc_exp.h:339
double tau_in_
Time constant of inhibitory synaptic current in ms.
Definition iaf_psc_exp.h:333
double tau_ex_
Time constant of excitatory synaptic current in ms.
Definition iaf_psc_exp.h:330
double Tau_
Membrane time constant in ms.
Definition iaf_psc_exp.h:308
Parameters_()
Sets default parameter values.
Definition iaf_psc_exp.cpp:71
double V_reset_
reset value of the membrane potential
Definition iaf_psc_exp.h:327
double E_L_
Resting potential in mV.
Definition iaf_psc_exp.h:317
double Theta_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_exp.h:324
double C_
Membrane capacitance in pF.
Definition iaf_psc_exp.h:311
double rho_
Stochastic firing intensity at threshold in 1/s.
Definition iaf_psc_exp.h:336
double I_e_
External current in pA.
Definition iaf_psc_exp.h:320
double set(const Dictionary &, Node *node)
Set values from dictionary.
Definition iaf_psc_exp.cpp:117
void get(Dictionary &) const
Store current values in dictionary.
Definition iaf_psc_exp.cpp:101
State variables of the model.
Definition iaf_psc_exp.h:357
double i_syn_ex_
Definition iaf_psc_exp.h:361
int r_ref_
Absolute refractory counter (no membrane potential propagation).
Definition iaf_psc_exp.h:365
void set(const Dictionary &, const Parameters_ &, const double, Node *)
Set values from dictionary.
Definition iaf_psc_exp.cpp:188
double V_m_
Membrane potential.
Definition iaf_psc_exp.h:364
double i_0_
Stepwise constant input current.
Definition iaf_psc_exp.h:359
State_()
Default initialization.
Definition iaf_psc_exp.cpp:86
double i_1_
Current input that is filtered through the excitatory synapse exponential kernel.
Definition iaf_psc_exp.h:360
double i_syn_in_
Postsynaptic current for inhibitory inputs.
Definition iaf_psc_exp.h:363
void get(Dictionary &, const Parameters_ &) const
Definition iaf_psc_exp.cpp:182
Internal variables of the model.
Definition iaf_psc_exp.h:412
double P21ex_
Definition iaf_psc_exp.h:424
RngPtr rng_
random number generator of my own thread
Definition iaf_psc_exp.h:433
double weighted_spikes_ex_
Definition iaf_psc_exp.h:428
double P21in_
Definition iaf_psc_exp.h:425
double P20_
Amplitude of the synaptic current.
Definition iaf_psc_exp.h:421
double weighted_spikes_in_
Definition iaf_psc_exp.h:429
double P22_
Definition iaf_psc_exp.h:426
double P11in_
Definition iaf_psc_exp.h:423
int RefractoryCounts_
Definition iaf_psc_exp.h:431
double P11ex_
Definition iaf_psc_exp.h:422