NEST main@f146f75
Loading...
Searching...
No Matches
iaf_psc_alpha.h
Go to the documentation of this file.
1/*
2 * iaf_psc_alpha.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_ALPHA_H
24#define IAF_PSC_ALPHA_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 model with alpha-function shaped input currents
45
46Description
47+++++++++++
48
49``iaf_psc_alpha`` is a leaky integrate-and-fire neuron model with
50
51* a hard threshold,
52* a fixed refractory period,
53* no adaptation mechanisms,
54* :math:`\alpha`-shaped synaptic input currents.
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_{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
82Synaptic input
83..............
84
85The synaptic input current has an excitatory and an inhibitory component
86
87.. math::
88
89 I_{\text{syn}}(t) = I_{\text{syn, ex}}(t) + I_{\text{syn, in}}(t)
90
91where
92
93.. math::
94
95 I_{\text{syn, X}}(t) = \sum_{j} w_j \sum_k i_{\text{syn, X}}(t-t_j^k-d_j) \;,
96
97where :math:`j` indexes either excitatory (:math:`\text{X} = \text{ex}`)
98or inhibitory (:math:`\text{X} = \text{in}`) presynaptic neurons,
99:math:`k` indexes the spike times of neuron :math:`j`, and :math:`d_j`
100is the delay from neuron :math:`j`.
101
102The individual post-synaptic currents (PSCs) are given by
103
104.. math::
105
106 i_{\text{syn, X}}(t) = \frac{e}{\tau_{\text{syn, X}}} t e^{-\frac{t}{\tau_{\text{syn, X}}}} \Theta(t)
107
108where :math:`\Theta(x)` is the Heaviside step function. The PSCs are normalized to unit maximum, that is,
109
110.. math::
111
112 i_{\text{syn, X}}(t= \tau_{\text{syn, X}}) = 1 \;.
113
114As a consequence, the total charge :math:`q` transferred by a single PSC depends
115on the synaptic time constant according to
116
117.. math::
118
119 q = \int_0^{\infty} i_{\text{syn, X}}(t) dt = e \tau_{\text{syn, X}} \;.
120
121By default, :math:`V_\text{m}` is not bounded from below. To limit
122hyperpolarization to biophysically plausible values, set parameter
123:math:`V_{\text{min}}` as lower bound of :math:`V_\text{m}`.
124
125.. note::
126
127 NEST uses exact integration :footcite:p:`Rotter1999`, :footcite:p:`Diesmann2001` to integrate subthreshold membrane
128 dynamics with maximum precision; see also :footcite:p:`Morrison2007a`.
129
130 If :math:`\tau_\text{m}\approx \tau_{\text{syn, ex}}` or
131 :math:`\tau_\text{m}\approx \tau_{\text{syn, in}}`, the model will
132 numerically behave as if :math:`\tau_\text{m} = \tau_{\text{syn, ex}}` or
133 :math:`\tau_\text{m} = \tau_{\text{syn, in}}`, respectively, to avoid
134 numerical instabilities.
135
136 For implementation details see the
137 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
138
139
140.. note::
141
142 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
143 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
144 the inhibitory one, and also sets the direction of the post-synaptic current.
145 Spike connections must use the default ``receptor_type`` of 0.
146
147 See :ref:`synapse_selection` for the conventions used by other models.
148
149Parameters
150++++++++++
151
152The following parameters can be set in the status dictionary.
153
154=============== ================== =============================== ========================================================================
155**Parameter** **Default** **Math equivalent** **Description**
156=============== ================== =============================== ========================================================================
157``E_L`` -70 mV :math:`E_\text{L}` Resting membrane potential
158``C_m`` 250 pF :math:`C_{\text{m}}` Capacity of the membrane
159``tau_m`` 10 ms :math:`\tau_{\text{m}}` Membrane time constant
160``t_ref`` 2 ms :math:`t_{\text{ref}}` Duration of refractory period
161``V_th`` -55 mV :math:`V_{\text{th}}` Spike threshold
162``V_reset`` -70 mV :math:`V_{\text{reset}}` Reset potential of the membrane
163``tau_syn_ex`` 2 ms :math:`\tau_{\text{syn, ex}}` Rise time of the excitatory postsynaptic current (alpha function)
164``tau_syn_in`` 2 ms :math:`\tau_{\text{syn, in}}` Rise time of the inhibitory postsynaptic current (alpha function)
165``I_e`` 0 pA :math:`I_\text{e}` Constant input current
166``V_min`` :math:`-\infty` mV :math:`V_{\text{min}}` Absolute lower value for the membrane potential
167=============== ================== =============================== ========================================================================
168
169The following state variables evolve during simulation and are available either as neuron properties or as recordables.
170
171================== ================= ========================== =================================
172**State variable** **Initial value** **Math equivalent** **Description**
173================== ================= ========================== =================================
174``V_m`` -70 mV :math:`V_{\text{m}}` Membrane potential
175``I_syn_ex`` 0 pA :math:`I_{\text{syn, ex}}` Excitatory synaptic input current
176``I_syn_in`` 0 pA :math:`I_{\text{syn, in}}` Inhibitory synaptic input current
177================== ================= ========================== =================================
178
179
180References
181++++++++++
182
183.. footbibliography::
184
185Sends
186+++++
187
188SpikeEvent
189
190Receives
191++++++++
192
193SpikeEvent, CurrentEvent, DataLoggingRequest
194
195See also
196++++++++
197
198iaf_psc_delta, iaf_psc_exp, iaf_cond_exp
199
200
201Examples using this model
202+++++++++++++++++++++++++
203
204.. listexamples:: iaf_psc_alpha
205
206EndUserDocs */
207// clang-format on
208
209void register_iaf_psc_alpha( const std::string& name );
210
212{
213
214public:
217
223 using Node::handle;
225
226 size_t send_test_event( Node&, size_t, synindex, bool ) override;
227
228 void handle( SpikeEvent& ) override;
229 bool
231 {
232 return true;
233 }
234
235 void handle( WeightCorrectionEvent& ) override;
236 void handle( CurrentEvent& ) override;
237 void handle( DataLoggingRequest& ) override;
238
239 size_t handles_test_event( SpikeEvent&, size_t ) override;
240 size_t handles_test_event( WeightCorrectionEvent&, size_t ) override;
241 size_t handles_test_event( CurrentEvent&, size_t ) override;
242 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
243
244 void get_status( Dictionary& ) const override;
245 void set_status( const Dictionary& ) override;
246
247private:
248 void init_buffers_() override;
249 void pre_run_hook() override;
250
251 void update( Time const&, const long, const long ) override;
252
253 // The next two classes need to be friends to access the State_ class/member
254 friend class RecordablesMap< iaf_psc_alpha >;
255 friend class UniversalDataLogger< iaf_psc_alpha >;
256
257 // ----------------------------------------------------------------
258
260 {
262 double Tau_;
263
265 double C_;
266
268 double TauR_;
269
271 double E_L_;
272
274 double I_e_;
275
277 double V_reset_;
278
281 double Theta_;
282
286
288 double tau_ex_;
289
291 double tau_in_;
292
293 Parameters_();
294
295 void get( Dictionary& ) const;
296
300 double set( const Dictionary&, Node* node );
301 };
302
303 // ----------------------------------------------------------------
304
305 struct State_
306 {
307 double y0_;
308 double dI_ex_;
309 double I_ex_;
310 double dI_in_;
311 double I_in_;
313 double y3_;
314
315 int r_;
316
317 State_();
318
319 void get( Dictionary&, const Parameters_& ) const;
320
326 void set( const Dictionary&, const Parameters_&, double, Node* node );
327 };
328
329 // ----------------------------------------------------------------
330
352
353 // ----------------------------------------------------------------
354
356 {
357
365
366 double P11_ex_;
367 double P21_ex_;
368 double P22_ex_;
369 double P31_ex_;
370 double P32_ex_;
371 double P11_in_;
372 double P21_in_;
373 double P22_in_;
374 double P31_in_;
375 double P32_in_;
376 double P30_;
377 double P33_;
379
382 };
383
384 // Access functions for UniversalDataLogger -------------------------------
385
387 inline double
388 get_V_m_() const
389 {
390 return S_.y3_ + P_.E_L_;
391 }
392
393 inline double
395 {
396 return S_.I_ex_;
397 }
398
399 inline double
401 {
402 return S_.I_in_;
403 }
404
405 // Data members -----------------------------------------------------------
406
418
421};
422
423inline size_t
424iaf_psc_alpha::send_test_event( Node& target, size_t receptor_type, synindex, bool )
425{
426 SpikeEvent e;
427 e.set_sender( *this );
428 return target.handles_test_event( e, receptor_type );
429}
430
431inline size_t
433{
434 if ( receptor_type != 0 )
435 {
436 throw UnknownReceptorType( receptor_type, get_name() );
437 }
438 return 0;
439}
440
441inline size_t
443{
444 if ( receptor_type != 0 )
445 {
446 throw UnknownReceptorType( receptor_type, get_name() );
447 }
448 return 0;
449}
450
451inline size_t
453{
454 if ( receptor_type != 0 )
455 {
456 throw UnknownReceptorType( receptor_type, get_name() );
457 }
458 return 0;
459}
460
461inline size_t
463{
464 if ( receptor_type != 0 )
465 {
466 throw UnknownReceptorType( receptor_type, get_name() );
467 }
468 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
469}
470
471inline void
473{
474 P_.get( d );
475 S_.get( d, P_ );
477
478 d[ names::recordables ] = recordablesMap_.get_list();
479}
480
481inline void
483{
484 Parameters_ ptmp = P_; // temporary copy in case of errors
485 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
486 State_ stmp = S_; // temporary copy in case of errors
487 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
488
489 // We now know that (ptmp, stmp) are consistent. We do not
490 // write them back to (P_, S_) before we are also sure that
491 // the properties to be set in the parent class are internally
492 // consistent.
494
495 // if we get here, temporaries contain consistent set of properties
496 P_ = ptmp;
497 S_ = stmp;
498}
499
500} // namespace
501
502#endif /* #ifndef IAF_PSC_ALPHA_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
static RecordablesMap< iaf_psc_alpha > recordablesMap_
Mapping of recordables names to access functions.
Definition iaf_psc_alpha.h:420
Variables_ V_
Definition iaf_psc_alpha.h:415
double get_I_syn_ex_() const
Definition iaf_psc_alpha.h:394
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition iaf_psc_alpha.h:432
iaf_psc_alpha()
Definition iaf_psc_alpha.cpp:216
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_alpha.h:424
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition iaf_psc_alpha.h:413
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition iaf_psc_alpha.h:482
friend class RecordablesMap< iaf_psc_alpha >
Definition iaf_psc_alpha.h:254
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition iaf_psc_alpha.cpp:248
Buffers_ B_
Definition iaf_psc_alpha.h:416
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition iaf_psc_alpha.cpp:377
double get_V_m_() const
Read out the real membrane potential.
Definition iaf_psc_alpha.h:388
friend class UniversalDataLogger< iaf_psc_alpha >
Definition iaf_psc_alpha.h:255
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition iaf_psc_alpha.cpp:307
State_ S_
Definition iaf_psc_alpha.h:414
double get_I_syn_in_() const
Definition iaf_psc_alpha.h:400
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_alpha.h:472
bool supports_axonal_delay_corrections() const override
Whether this model can be the target of a synapse with predominantly axonal delay.
Definition iaf_psc_alpha.h:230
void init_buffers_() override
Configure persistent internal data structures.
Definition iaf_psc_alpha.cpp:238
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
void register_iaf_psc_alpha(const std::string &name)
Definition iaf_psc_alpha.cpp:44
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:121
Definition iaf_psc_alpha.h:332
Buffers_(iaf_psc_alpha &)
Definition iaf_psc_alpha.cpp:201
UniversalDataLogger< iaf_psc_alpha > logger_
Logger for all analog data.
Definition iaf_psc_alpha.h:350
@ SYN_EX
Definition iaf_psc_alpha.h:341
@ SYN_IN
Definition iaf_psc_alpha.h:340
@ I0
Definition iaf_psc_alpha.h:342
@ NUM_INPUT_CHANNELS
Definition iaf_psc_alpha.h:343
MultiChannelInputBuffer< NUM_INPUT_CHANNELS > input_buffer_
buffers and sums up incoming spikes/currents
Definition iaf_psc_alpha.h:347
Definition iaf_psc_alpha.h:260
double V_reset_
Reset value of the membrane potential.
Definition iaf_psc_alpha.h:277
double C_
Membrane capacitance in pF.
Definition iaf_psc_alpha.h:265
double TauR_
Refractory period in ms.
Definition iaf_psc_alpha.h:268
double I_e_
External current in pA.
Definition iaf_psc_alpha.h:274
void get(Dictionary &) const
Store current values in dictionary.
Definition iaf_psc_alpha.cpp:98
double tau_in_
Time constant of inhibitory synaptic current in ms.
Definition iaf_psc_alpha.h:291
double LowerBound_
Lower bound, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha.h:285
double Tau_
Membrane time constant in ms.
Definition iaf_psc_alpha.h:262
double Theta_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha.h:281
Parameters_()
Sets default parameter values.
Definition iaf_psc_alpha.cpp:68
double tau_ex_
Time constant of excitatory synaptic current in ms.
Definition iaf_psc_alpha.h:288
double set(const Dictionary &, Node *node)
Set values from dictionary.
Definition iaf_psc_alpha.cpp:113
double E_L_
Resting potential in mV.
Definition iaf_psc_alpha.h:271
Definition iaf_psc_alpha.h:306
State_()
Default initialization.
Definition iaf_psc_alpha.cpp:82
double dI_ex_
Definition iaf_psc_alpha.h:308
double I_in_
Definition iaf_psc_alpha.h:311
double y0_
Constant current.
Definition iaf_psc_alpha.h:307
int r_
Number of refractory steps remaining.
Definition iaf_psc_alpha.h:315
double dI_in_
Definition iaf_psc_alpha.h:310
double y3_
This is the membrane potential RELATIVE TO RESTING POTENTIAL.
Definition iaf_psc_alpha.h:313
double I_ex_
Definition iaf_psc_alpha.h:309
void set(const Dictionary &, const Parameters_ &, double, Node *node)
Set values from dictionary.
Definition iaf_psc_alpha.cpp:189
void get(Dictionary &, const Parameters_ &) const
Definition iaf_psc_alpha.cpp:183
Definition iaf_psc_alpha.h:356
double P11_in_
Definition iaf_psc_alpha.h:371
double P32_in_
Definition iaf_psc_alpha.h:375
double P21_ex_
Definition iaf_psc_alpha.h:367
double P22_ex_
Definition iaf_psc_alpha.h:368
double weighted_spikes_in_
Definition iaf_psc_alpha.h:381
double P30_
Definition iaf_psc_alpha.h:376
double IPSCInitialValue_
Definition iaf_psc_alpha.h:363
double P31_in_
Definition iaf_psc_alpha.h:374
double EPSCInitialValue_
Amplitude of the synaptic current.
Definition iaf_psc_alpha.h:362
double P22_in_
Definition iaf_psc_alpha.h:373
double P21_in_
Definition iaf_psc_alpha.h:372
double P31_ex_
Definition iaf_psc_alpha.h:369
double P32_ex_
Definition iaf_psc_alpha.h:370
double expm1_tau_m_
Definition iaf_psc_alpha.h:378
int RefractoryCounts_
Definition iaf_psc_alpha.h:364
double P33_
Definition iaf_psc_alpha.h:377
double weighted_spikes_ex_
Definition iaf_psc_alpha.h:380
double P11_ex_
Definition iaf_psc_alpha.h:366