NEST main@caf0ae8
 
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-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
140Parameters
141++++++++++
142
143The following parameters can be set in the status dictionary.
144
145=============== ================== =============================== ========================================================================
146**Parameter** **Default** **Math equivalent** **Description**
147=============== ================== =============================== ========================================================================
148``E_L`` -70 mV :math:`E_\text{L}` Resting membrane potential
149``C_m`` 250 pF :math:`C_{\text{m}}` Capacity of the membrane
150``tau_m`` 10 ms :math:`\tau_{\text{m}}` Membrane time constant
151``t_ref`` 2 ms :math:`t_{\text{ref}}` Duration of refractory period
152``V_th`` -55 mV :math:`V_{\text{th}}` Spike threshold
153``V_reset`` -70 mV :math:`V_{\text{reset}}` Reset potential of the membrane
154``tau_syn_ex`` 2 ms :math:`\tau_{\text{syn, ex}}` Rise time of the excitatory synaptic alpha function
155``tau_syn_in`` 2 ms :math:`\tau_{\text{syn, in}}` Rise time of the inhibitory synaptic alpha function
156``I_e`` 0 pA :math:`I_\text{e}` Constant input current
157``V_min`` :math:`-\infty` mV :math:`V_{\text{min}}` Absolute lower value for the membrane potential
158=============== ================== =============================== ========================================================================
159
160The following state variables evolve during simulation and are available either as neuron properties or as recordables.
161
162================== ================= ========================== =================================
163**State variable** **Initial value** **Math equivalent** **Description**
164================== ================= ========================== =================================
165``V_m`` -70 mV :math:`V_{\text{m}}` Membrane potential
166``I_syn_ex`` 0 pA :math:`I_{\text{syn, ex}}` Excitatory synaptic input current
167``I_syn_in`` 0 pA :math:`I_{\text{syn, in}}` Inhibitory synaptic input current
168================== ================= ========================== =================================
169
170
171References
172++++++++++
173
174.. footbibliography::
175
176Sends
177+++++
178
179SpikeEvent
180
181Receives
182++++++++
183
184SpikeEvent, CurrentEvent, DataLoggingRequest
185
186See also
187++++++++
188
189iaf_psc_delta, iaf_psc_exp, iaf_cond_exp
190
191
192Examples using this model
193+++++++++++++++++++++++++
194
195.. listexamples:: iaf_psc_alpha
196
197EndUserDocs */
198// clang-format on
199
200void register_iaf_psc_alpha( const std::string& name );
201
203{
204
205public:
208
214 using Node::handle;
216
217 size_t send_test_event( Node&, size_t, synindex, bool ) override;
218
219 void handle( SpikeEvent& ) override;
220 void handle( CurrentEvent& ) override;
221 void handle( DataLoggingRequest& ) override;
222
223 size_t handles_test_event( SpikeEvent&, size_t ) override;
224 size_t handles_test_event( CurrentEvent&, size_t ) override;
225 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
226
227 void get_status( Dictionary& ) const override;
228 void set_status( const Dictionary& ) override;
229
230private:
231 void init_buffers_() override;
232 void pre_run_hook() override;
233
234 void update( Time const&, const long, const long ) override;
235
236 // The next two classes need to be friends to access the State_ class/member
237 friend class RecordablesMap< iaf_psc_alpha >;
238 friend class UniversalDataLogger< iaf_psc_alpha >;
239
240 // ----------------------------------------------------------------
241
243 {
245 double Tau_;
246
248 double C_;
249
251 double TauR_;
252
254 double E_L_;
255
257 double I_e_;
258
260 double V_reset_;
261
264 double Theta_;
265
269
271 double tau_ex_;
272
274 double tau_in_;
275
276 Parameters_();
277
278 void get( Dictionary& ) const;
279
283 double set( const Dictionary&, Node* node );
284 };
285
286 // ----------------------------------------------------------------
287
288 struct State_
289 {
290 double y0_;
291 double dI_ex_;
292 double I_ex_;
293 double dI_in_;
294 double I_in_;
296 double y3_;
297
298 int r_;
299
300 State_();
301
302 void get( Dictionary&, const Parameters_& ) const;
303
309 void set( const Dictionary&, const Parameters_&, double, Node* node );
310 };
311
312 // ----------------------------------------------------------------
313
335
336 // ----------------------------------------------------------------
337
339 {
340
348
349 double P11_ex_;
350 double P21_ex_;
351 double P22_ex_;
352 double P31_ex_;
353 double P32_ex_;
354 double P11_in_;
355 double P21_in_;
356 double P22_in_;
357 double P31_in_;
358 double P32_in_;
359 double P30_;
360 double P33_;
362
365 };
366
367 // Access functions for UniversalDataLogger -------------------------------
368
370 inline double
371 get_V_m_() const
372 {
373 return S_.y3_ + P_.E_L_;
374 }
375
376 inline double
378 {
379 return S_.I_ex_;
380 }
381
382 inline double
384 {
385 return S_.I_in_;
386 }
387
388 // Data members -----------------------------------------------------------
389
404};
405
406inline size_t
407iaf_psc_alpha::send_test_event( Node& target, size_t receptor_type, synindex, bool )
408{
409 SpikeEvent e;
410 e.set_sender( *this );
411 return target.handles_test_event( e, receptor_type );
412}
413
414inline size_t
416{
417 if ( receptor_type != 0 )
418 {
419 throw UnknownReceptorType( receptor_type, get_name() );
420 }
421 return 0;
422}
423
424inline size_t
426{
427 if ( receptor_type != 0 )
428 {
429 throw UnknownReceptorType( receptor_type, get_name() );
430 }
431 return 0;
432}
433
434inline size_t
436{
437 if ( receptor_type != 0 )
438 {
439 throw UnknownReceptorType( receptor_type, get_name() );
440 }
441 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
442}
443
444inline void
446{
447 P_.get( d );
448 S_.get( d, P_ );
450
451 d[ names::recordables ] = recordablesMap_.get_list();
452}
453
454inline void
456{
457 Parameters_ ptmp = P_; // temporary copy in case of errors
458 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
459 State_ stmp = S_; // temporary copy in case of errors
460 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
461
462 // We now know that (ptmp, stmp) are consistent. We do not
463 // write them back to (P_, S_) before we are also sure that
464 // the properties to be set in the parent class are internally
465 // consistent.
467
468 // if we get here, temporaries contain consistent set of properties
469 P_ = ptmp;
470 S_ = stmp;
471}
472
473} // namespace
474
475#endif /* #ifndef IAF_PSC_ALPHA_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
A node which archives spike history for the purposes of spike-timing dependent plasticity (STDP)
Definition archiving_node.h:49
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition archiving_node.cpp:220
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition archiving_node.cpp:236
Event for electrical currents.
Definition event.h:569
Request data to be logged/logged data to be sent.
Definition event.h:636
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:418
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 iaf_psc_alpha.h:203
static RecordablesMap< iaf_psc_alpha > recordablesMap_
Mapping of recordables names to access functions.
Definition iaf_psc_alpha.h:403
Variables_ V_
Definition iaf_psc_alpha.h:398
double get_I_syn_ex_() const
Definition iaf_psc_alpha.h:377
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:415
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:407
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition iaf_psc_alpha.h:396
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition iaf_psc_alpha.h:455
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:399
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition iaf_psc_alpha.cpp:373
double get_V_m_() const
Read out the real membrane potential.
Definition iaf_psc_alpha.h:371
friend class UniversalDataLogger< iaf_psc_alpha >
Definition iaf_psc_alpha.h:238
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:305
State_ S_
Definition iaf_psc_alpha.h:397
double get_I_syn_in_() const
Definition iaf_psc_alpha.h:383
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_alpha.h:445
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:271
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition node.cpp:265
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:115
Definition iaf_psc_alpha.h:315
UniversalDataLogger< iaf_psc_alpha > logger_
Logger for all analog data.
Definition iaf_psc_alpha.h:333
@ SYN_EX
Definition iaf_psc_alpha.h:324
@ SYN_IN
Definition iaf_psc_alpha.h:323
@ I0
Definition iaf_psc_alpha.h:325
@ NUM_INPUT_CHANNELS
Definition iaf_psc_alpha.h:326
MultiChannelInputBuffer< NUM_INPUT_CHANNELS > input_buffer_
buffers and sums up incoming spikes/currents
Definition iaf_psc_alpha.h:330
Definition iaf_psc_alpha.h:243
double V_reset_
Reset value of the membrane potential.
Definition iaf_psc_alpha.h:260
double C_
Membrane capacitance in pF.
Definition iaf_psc_alpha.h:248
double TauR_
Refractory period in ms.
Definition iaf_psc_alpha.h:251
double I_e_
External current in pA.
Definition iaf_psc_alpha.h:257
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:274
double LowerBound_
Lower bound, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha.h:268
double Tau_
Membrane time constant in ms.
Definition iaf_psc_alpha.h:245
double Theta_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha.h:264
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:271
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:254
Definition iaf_psc_alpha.h:289
State_()
Default initialization.
Definition iaf_psc_alpha.cpp:82
double dI_ex_
Definition iaf_psc_alpha.h:291
double I_in_
Definition iaf_psc_alpha.h:294
double y0_
Constant current.
Definition iaf_psc_alpha.h:290
int r_
Number of refractory steps remaining.
Definition iaf_psc_alpha.h:298
double dI_in_
Definition iaf_psc_alpha.h:293
double y3_
This is the membrane potential RELATIVE TO RESTING POTENTIAL.
Definition iaf_psc_alpha.h:296
double I_ex_
Definition iaf_psc_alpha.h:292
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:339
double P11_in_
Definition iaf_psc_alpha.h:354
double P32_in_
Definition iaf_psc_alpha.h:358
double P21_ex_
Definition iaf_psc_alpha.h:350
double P22_ex_
Definition iaf_psc_alpha.h:351
double weighted_spikes_in_
Definition iaf_psc_alpha.h:364
double P30_
Definition iaf_psc_alpha.h:359
double IPSCInitialValue_
Definition iaf_psc_alpha.h:346
double P31_in_
Definition iaf_psc_alpha.h:357
double EPSCInitialValue_
Amplitude of the synaptic current.
Definition iaf_psc_alpha.h:345
double P22_in_
Definition iaf_psc_alpha.h:356
double P21_in_
Definition iaf_psc_alpha.h:355
double P31_ex_
Definition iaf_psc_alpha.h:352
double P32_ex_
Definition iaf_psc_alpha.h:353
double expm1_tau_m_
Definition iaf_psc_alpha.h:361
int RefractoryCounts_
Definition iaf_psc_alpha.h:347
double P33_
Definition iaf_psc_alpha.h:360
double weighted_spikes_ex_
Definition iaf_psc_alpha.h:363
double P11_ex_
Definition iaf_psc_alpha.h:349