NEST main@d22e9b2
 
Loading...
Searching...
No Matches
iaf_psc_alpha_ps.h
Go to the documentation of this file.
1/*
2 * iaf_psc_alpha_ps.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_PS_H
24#define IAF_PSC_ALPHA_PS_H
25
26// C++ includes:
27#include <vector>
28
29// Generated includes:
30#include "config.h"
31
32// Includes from libnestutil:
33#include "archiving_node.h"
34#include "connection.h"
35#include "event.h"
36#include "iaf_propagator.h"
37#include "nest_types.h"
38#include "ring_buffer.h"
39#include "slice_ring_buffer.h"
41
42namespace nest
43{
44
45// Disable clang-formatting for documentation due to over-wide tables.
46// clang-format off
47/* BeginUserDocs: neuron, integrate-and-fire, current-based, precise, hard threshold
48
49Short description
50+++++++++++++++++
51
52Current-based leaky integrate-and-fire neuron with alpha-shaped
53postsynaptic currents using regula falsi method for approximation of
54threshold crossing
55
56Description
57+++++++++++
58
59.. versionadded:: 2.18
60
61``iaf_psc_alpha_ps`` is the "canonical" implementation of the leaky
62integrate-and-fire model neuron with alpha-shaped postsynaptic
63currents in the sense of :footcite:p:`Morrison2007a`, that is, the most exact implementation
64available. It is a leaky integrate-and-fire neuron model with
65
66* a hard threshold,
67* a fixed refractory period,
68* :math:`\alpha`-shaped synaptic input currents,
69* precise spike times based on the regula falsi method :footcite:p:`Morrison2007a`, :footcite:p:`Hanuschkin2010`.
70
71Membrane potential evolution, spike emission, and refractoriness
72................................................................
73
74The membrane potential evolves according to
75
76.. math::
77
78 \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}}}
79
80where the synaptic input current :math:`I_{\text{syn}}(t)` is discussed below and :math:`I_\text{e}` is
81a constant input current set as a model parameter.
82
83A spike is emitted when the membrane potential crosses the threshold :math:`V_\text{th}` from below;
84the precise time of the crossing is determined by a regula falsi method (see below). Subsequently,
85
86.. math::
87
88 V_\text{m}(t) = V_{\text{reset}} \quad\text{for}\quad t^* \leq t \leq t^* + t_{\text{ref}} \;,
89
90that is, the membrane potential is clamped to :math:`V_{\text{reset}}` during the refractory period.
91
92Synaptic input
93..............
94
95The synaptic input current has an excitatory and an inhibitory component,
96
97.. math::
98
99 I_{\text{syn}}(t) = I_{\text{syn, ex}}(t) + I_{\text{syn, in}}(t)
100
101where
102
103.. math::
104
105 I_{\text{syn, X}}(t) = \sum_{j} w_j \sum_k i_{\text{syn, X}}(t-t_j^k-d_j) \;,
106
107where :math:`j` indexes either excitatory (:math:`\text{X} = \text{ex}`)
108or inhibitory (:math:`\text{X} = \text{in}`) presynaptic neurons,
109:math:`k` indexes the spike times of neuron :math:`j`, and :math:`d_j`
110is the delay from neuron :math:`j`.
111
112The individual post-synaptic currents (PSCs) are given by
113
114.. math::
115
116 i_{\text{syn, X}}(t) = \frac{e}{\tau_{\text{syn, X}}} t e^{-\frac{t}{\tau_{\text{syn, X}}}} \Theta(t) \;,
117
118where :math:`\Theta(x)` is the Heaviside step function. The PSCs are normalized to unit maximum, that is,
119
120.. math::
121
122 i_{\text{syn, X}}(t= \tau_{\text{syn, X}}) = 1 \;.
123
124As a consequence, the total charge :math:`q` transferred by a single PSC depends
125on the synaptic time constant according to
126
127.. math::
128
129 q = \int_0^{\infty} i_{\text{syn, X}}(t) dt = e \tau_{\text{syn, X}} \;.
130
131By default, :math:`V_\text{m}` is not bounded from below. To limit
132hyperpolarization to biophysically plausible values, set parameter
133:math:`V_{\text{min}}` as lower bound of :math:`V_\text{m}`.
134
135Precise implementation
136......................
137
138The precise implementation handles neuronal dynamics in a locally
139event-based manner with in coarse time grid defined by the minimum
140delay in the network, see :footcite:p:`Morrison2007a`. Incoming spikes are applied at the
141precise moment of their arrival, while the precise time of outgoing
142spikes is determined by a Regula Falsi method to approximate the timing
143of a threshold crossing :footcite:p:`Morrison2007a` :footcite:p:`Hanuschkin2010`. Return from refractoriness occurs
144precisely at spike time plus refractory period.
145
146This implementation is more complex than the plain iaf_psc_alpha
147neuron, but achieves much higher precision. In particular, spike times
148are not binned to the points of the simulation time grid. Depending on your
149application, the canonical implementation may provide superior overall
150performance given an accuracy goal; see :footcite:p:`Morrison2007a` for details. Subthreshold
151dynamics are integrated using exact integration between events :footcite:p:`Rotter1999`.
152
153This model transmits precise spike times to target nodes (on-grid spike
154time and offset). If this node is connected to a spike_recorder, the
155property "precise_times" of the spike_recorder has to be set to true in
156order to record the offsets in addition to the on-grid spike times.
157
158The iaf_psc_alpha_ps neuron accepts connections transmitting
159CurrentEvents. These events transmit stepwise-constant currents which
160can only change at on-grid times.
161
162.. note::
163
164 If :math:`\tau_{\text{m}}` is very close to :math:`\tau_{\text{syn, ex}}` or
165 :math:`\tau_{\text{syn, in}}`, the model will numerically behave as if :math:`\tau_{\text{m}}`
166 is equal to :math:`\tau_{\text{syn, ex}}` or :math:`\tau_{\text{syn, in}}`, respectively,
167 to avoid numerical instabilities.
168
169 For implementation details see the
170 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
171
172For details about exact subthreshold integration, please see
173:doc:`../neurons/exact-integration`.
174
175Parameters
176++++++++++
177
178The following parameters can be set in the status dictionary.
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}}` Rise time of the excitatory synaptic current
190``tau_syn_in`` 2 ms :math:`\tau_{\text{syn, in}}` Rise time of the inhibitory synaptic current
191``I_e`` 0 pA :math:`I_\text{e}` Constant input current
192``V_min`` :math:`-\infty` mV :math:`V_{\text{min}}` Absolute lower value for the membrane potential
193=============== ================== =============================== ========================================================================
194
195The following state variables evolve during simulation and are available either as neuron properties or as recordables.
196
197================== ================= ========================== =================================
198**State variable** **Initial value** **Math equivalent** **Description**
199================== ================= ========================== =================================
200``V_m`` -70 mV :math:`V_{\text{m}}` Membrane potential
201``I_syn_ex`` 0 pA :math:`I_{\text{syn, ex}}` Excitatory synaptic input current
202``I_syn_in`` 0 pA :math:`I_{\text{syn, in}}` Inhibitory synaptic input current
203================== ================= ========================== =================================
204
205References
206++++++++++
207
208.. footbibliography::
209
210Sends
211+++++
212
213SpikeEvent
214
215Receives
216++++++++
217
218SpikeEvent, CurrentEvent, DataLoggingRequest
219
220See also
221++++++++
222
223iaf_psc_alpha, iaf_psc_exp_ps
224
225Examples using this model
226+++++++++++++++++++++++++
227
228.. listexamples:: iaf_psc_alpha_ps
229
230EndUserDocs */
231// clang-format on
232
233void register_iaf_psc_alpha_ps( const std::string& name );
234
236{
237public:
243
252
258 using Node::handle;
260
261 size_t send_test_event( Node&, size_t, synindex, bool ) override;
262
263 size_t handles_test_event( SpikeEvent&, size_t ) override;
264 size_t handles_test_event( CurrentEvent&, size_t ) override;
265 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
266
267 void handle( SpikeEvent& ) override;
268 void handle( CurrentEvent& ) override;
269 void handle( DataLoggingRequest& ) override;
270
271 bool
272 is_off_grid() const override
273 {
274 return true;
275 } // uses off_grid events
276
277 void get_status( Dictionary& ) const override;
278 void set_status( const Dictionary& ) override;
279
289 double threshold_distance( double t_step ) const;
290
291private:
297 void init_buffers_() override;
298 void pre_run_hook() override;
299
300 bool get_next_event_( const long T, double& ev_offset, double& ev_weight, bool& end_of_refract );
301
319 void update( Time const& origin, const long from, const long to ) override;
320
322
328 void propagate_( const double dt );
329
341 void emit_spike_( Time const& origin, const long lag, const double t0, const double dt );
342
351 void emit_instant_spike_( Time const& origin, const long lag, const double spike_offset );
352
356
357 // The next two classes need to be friends to access the State_ class/member
358 friend class RecordablesMap< iaf_psc_alpha_ps >;
359 friend class UniversalDataLogger< iaf_psc_alpha_ps >;
360
361 // ----------------------------------------------------------------
362
367 {
368
370 double tau_m_;
371
375
377 double c_m_;
378
380 double t_ref_;
381
383 double E_L_;
384
386 double I_e_;
387
390 double U_th_;
391
394 double U_min_;
395
400 double U_reset_;
401
402 Parameters_();
403
404 void get( Dictionary& ) const;
405
409 double set( const Dictionary&, Node* );
410 };
411
412 // ----------------------------------------------------------------
413
417 struct State_
418 {
419 double y_input_;
420 double I_ex_;
421 double dI_ex_;
422 double I_in_;
423 double dI_in_;
424 double V_m_;
428
429 State_();
430
431 void get( Dictionary&, const Parameters_& ) const;
432
438 void set( const Dictionary&, const Parameters_&, double, Node* );
439 };
440
441 // ----------------------------------------------------------------
442
461
462 // ----------------------------------------------------------------
463
492
493 // Access functions for UniversalDataLogger -------------------------------
494
496 double
497 get_V_m_() const
498 {
499 return S_.V_m_ + P_.E_L_;
500 }
501
503 double
504 get_I_ex_() const
505 {
506 return S_.I_ex_;
507 }
508
510 double
512 {
513 return S_.dI_ex_;
514 }
515
517 double
518 get_I_in_() const
519 {
520 return S_.I_in_;
521 }
522
524 double
526 {
527 return S_.dI_in_;
528 }
529
530 // ----------------------------------------------------------------
531
546};
547
548inline size_t
549iaf_psc_alpha_ps::send_test_event( Node& target, size_t receptor_type, synindex, bool )
550{
551 SpikeEvent e;
552 e.set_sender( *this );
553 return target.handles_test_event( e, receptor_type );
554}
555
556inline size_t
558{
559 if ( receptor_type != 0 )
560 {
561 throw UnknownReceptorType( receptor_type, get_name() );
562 }
563 return 0;
564}
565
566inline size_t
568{
569 if ( receptor_type != 0 )
570 {
571 throw UnknownReceptorType( receptor_type, get_name() );
572 }
573 return 0;
574}
575
576inline size_t
578{
579 if ( receptor_type != 0 )
580 {
581 throw UnknownReceptorType( receptor_type, get_name() );
582 }
583 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
584}
585
586inline void
588{
589 P_.get( d );
590 S_.get( d, P_ );
592
593 d[ names::recordables ] = recordablesMap_.get_list();
594}
595
596inline void
598{
599 Parameters_ ptmp = P_; // temporary copy in case of errors
600 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
601 State_ stmp = S_; // temporary copy in case of errors
602 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
603
604 // We now know that (ptmp, stmp) are consistent. We do not
605 // write them back to (P_, S_) before we are also sure that
606 // the properties to be set in the parent class are internally
607 // consistent.
609
610 // if we get here, temporaries contain consistent set of properties
611 P_ = ptmp;
612 S_ = stmp;
613}
614
615} // namespace
616
617#endif // IAF_PSC_ALPHA_PS_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Exact integration voltage propagator for models with alpha psc.
Definition iaf_propagator.h:128
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
Buffer Layout.
Definition ring_buffer.h:83
Queue for all spikes arriving into a neuron.
Definition slice_ring_buffer.h:63
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_ps.h:236
IAFPropagatorAlpha propagator_in_
Definition iaf_psc_alpha_ps.h:355
void init_buffers_() override
Configure persistent internal data structures.
Definition iaf_psc_alpha_ps.cpp:251
void emit_instant_spike_(Time const &origin, const long lag, const double spike_offset)
Instantaneously emit a spike at the precise time defined by origin, lag and spike_offset and reset th...
Definition iaf_psc_alpha_ps.cpp:560
static RecordablesMap< iaf_psc_alpha_ps > recordablesMap_
Mapping of recordables names to access functions.
Definition iaf_psc_alpha_ps.h:545
Buffers_ B_
Definition iaf_psc_alpha_ps.h:541
bool get_next_event_(const long T, double &ev_offset, double &ev_weight, bool &end_of_refract)
Definition iaf_psc_alpha_ps.cpp:303
double get_I_in_() const
Read out state variable I_in.
Definition iaf_psc_alpha_ps.h:518
double get_dI_in_() const
Read out state variable derivative of I_ex.
Definition iaf_psc_alpha_ps.h:525
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition iaf_psc_alpha_ps.h:538
void update(Time const &origin, const long from, const long to) override
Time Evolution Operator.
Definition iaf_psc_alpha_ps.cpp:309
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition iaf_psc_alpha_ps.cpp:262
void propagate_(const double dt)
Propagate neuron state.
Definition iaf_psc_alpha_ps.cpp:501
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_alpha_ps.h:587
iaf_psc_alpha_ps()
Basic constructor.
Definition iaf_psc_alpha_ps.cpp:229
double get_I_ex_() const
Read out state variable I_ex.
Definition iaf_psc_alpha_ps.h:504
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition iaf_psc_alpha_ps.h:597
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition iaf_psc_alpha_ps.cpp:464
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_ps.h:549
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_ps.h:557
double threshold_distance(double t_step) const
Based on the current state, compute the value of the membrane potential after taking a timestep of le...
Definition iaf_psc_alpha_ps.cpp:582
double get_dI_ex_() const
Read out state variable derivative of I_ex.
Definition iaf_psc_alpha_ps.h:511
double get_V_m_() const
Read out the real membrane potential.
Definition iaf_psc_alpha_ps.h:497
State_ S_
Definition iaf_psc_alpha_ps.h:539
bool is_off_grid() const override
Returns true if the node sends/receives off-grid events.
Definition iaf_psc_alpha_ps.h:272
Variables_ V_
Definition iaf_psc_alpha_ps.h:540
void emit_spike_(Time const &origin, const long lag, const double t0, const double dt)
Trigger regula falsi method to find the precise spike time within the mini-timestep (t0,...
Definition iaf_psc_alpha_ps.cpp:536
friend class UniversalDataLogger< iaf_psc_alpha_ps >
Definition iaf_psc_alpha_ps.h:359
IAFPropagatorAlpha propagator_ex_
Propagator object for updating synaptic components.
Definition iaf_psc_alpha_ps.h:354
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_ps(const std::string &name)
Definition iaf_psc_alpha_ps.cpp:50
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition iaf_psc_alpha_ps.h:447
UniversalDataLogger< iaf_psc_alpha_ps > logger_
Logger for all analog data.
Definition iaf_psc_alpha_ps.h:459
RingBuffer currents_
Definition iaf_psc_alpha_ps.h:456
SliceRingBuffer events_
Queue for incoming events.
Definition iaf_psc_alpha_ps.h:455
Independent parameters of the model.
Definition iaf_psc_alpha_ps.h:367
double c_m_
Membrane capacitance in pF.
Definition iaf_psc_alpha_ps.h:377
double tau_m_
Membrane time constant in ms.
Definition iaf_psc_alpha_ps.h:370
Parameters_()
Sets default parameter values.
Definition iaf_psc_alpha_ps.cpp:73
double U_reset_
Reset potential.
Definition iaf_psc_alpha_ps.h:400
double tau_syn_in_
Definition iaf_psc_alpha_ps.h:374
double U_th_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha_ps.h:390
double E_L_
Resting potential in mV.
Definition iaf_psc_alpha_ps.h:383
void get(Dictionary &) const
Store current values in dictionary.
Definition iaf_psc_alpha_ps.cpp:105
double U_min_
Lower bound, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha_ps.h:394
double set(const Dictionary &, Node *)
Set values from dictionary.
Definition iaf_psc_alpha_ps.cpp:120
double tau_syn_ex_
Time constant of synaptic current in ms.
Definition iaf_psc_alpha_ps.h:373
double I_e_
External DC current [pA].
Definition iaf_psc_alpha_ps.h:386
double t_ref_
Refractory period in ms.
Definition iaf_psc_alpha_ps.h:380
State variables of the model.
Definition iaf_psc_alpha_ps.h:418
State_()
Default initialization.
Definition iaf_psc_alpha_ps.cpp:87
bool is_refractory_
true while refractory
Definition iaf_psc_alpha_ps.h:425
double V_m_
Membrane pot. rel. to resting pot. E_L_.
Definition iaf_psc_alpha_ps.h:424
double dI_in_
alpha current, second component
Definition iaf_psc_alpha_ps.h:423
void set(const Dictionary &, const Parameters_ &, double, Node *)
Set values from dictionary.
Definition iaf_psc_alpha_ps.cpp:202
double I_ex_
alpha current, first component
Definition iaf_psc_alpha_ps.h:420
void get(Dictionary &, const Parameters_ &) const
Definition iaf_psc_alpha_ps.cpp:191
double y_input_
external input current
Definition iaf_psc_alpha_ps.h:419
double dI_ex_
alpha current, second component
Definition iaf_psc_alpha_ps.h:421
long last_spike_step_
time stamp of most recent spike
Definition iaf_psc_alpha_ps.h:426
double last_spike_offset_
offset of most recent spike
Definition iaf_psc_alpha_ps.h:427
double I_in_
alpha current, first component
Definition iaf_psc_alpha_ps.h:422
Internal variables of the model.
Definition iaf_psc_alpha_ps.h:468
double P30_
progagator matrix elem, 3rd row
Definition iaf_psc_alpha_ps.h:476
long refractory_steps_
refractory time in steps
Definition iaf_psc_alpha_ps.h:472
double exp_tau_syn_in_
exp(-h/tau_syn_in)
Definition iaf_psc_alpha_ps.h:475
double inv_tau_syn_in_
1 / tau_syn_in
Definition iaf_psc_alpha_ps.h:489
double inv_tau_syn_ex_
1 / tau_syn_ex
Definition iaf_psc_alpha_ps.h:488
double P32_ex_
progagator matrix elem, 3rd row (ex)
Definition iaf_psc_alpha_ps.h:478
double exp_tau_syn_ex_
exp(-h/tau_syn_ex)
Definition iaf_psc_alpha_ps.h:474
double inv_c_m_
1 / c_m
Definition iaf_psc_alpha_ps.h:490
double y_input_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:481
double I_in_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:483
double P31_in_
progagator matrix elem, 3rd row (in)
Definition iaf_psc_alpha_ps.h:479
double dI_in_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:485
double inv_tau_m_
1 / tau_m
Definition iaf_psc_alpha_ps.h:487
double h_ms_
time resolution in ms
Definition iaf_psc_alpha_ps.h:469
double dI_ex_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:484
double psc_norm_in_
e / tau_syn_in
Definition iaf_psc_alpha_ps.h:471
double P31_ex_
progagator matrix elem, 3rd row (ex)
Definition iaf_psc_alpha_ps.h:477
double expm1_tau_m_
exp(-h/tau_m) - 1
Definition iaf_psc_alpha_ps.h:473
double psc_norm_ex_
e / tau_syn_ex
Definition iaf_psc_alpha_ps.h:470
double V_m_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:486
double I_ex_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:482
double P32_in_
progagator matrix elem, 3rd row (in)
Definition iaf_psc_alpha_ps.h:480