NEST main@f146f75
Loading...
Searching...
No Matches
iaf_cond_alpha.h
Go to the documentation of this file.
1/*
2 * iaf_cond_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_COND_ALPHA_H
24#define IAF_COND_ALPHA_H
25
26// Generated includes:
27#include "config.h"
28
29#ifdef HAVE_GSL
30
31// C includes:
32#include <gsl/gsl_errno.h>
33#include <gsl/gsl_matrix.h>
34#include <gsl/gsl_odeiv.h>
35
36// Includes from nestkernel:
37#include "archiving_node.h"
38#include "connection.h"
39#include "event.h"
40#include "nest_types.h"
41#include "recordables_map.h"
42#include "ring_buffer.h"
44
45namespace nest
46{
57extern "C" int iaf_cond_alpha_dynamics( double, const double*, double*, void* );
58
59// Disable clang-formatting for documentation due to over-wide tables.
60// clang-format off
61/* BeginUserDocs: neuron, integrate-and-fire, conductance-based, hard threshold
62
63Short description
64+++++++++++++++++
65
66Leaky integrate-and-fire neuron model with alpha-function shaped synaptic conductances
67
68Description
69+++++++++++
70
71``iaf_cond_alpha`` is a leaky integrate-and-fire neuron model with
72
73* a hard threshold,
74* a fixed refractory period,
75* :math:`\alpha`-shaped synaptic conductances, normalized such that an event of weight 1.0 results in a peak conductance of 1 nS.
76
77The model follows the conductance-based integrate-and-fire framework discussed in
78:footcite:p:`Meffin2004`, :footcite:p:`Bernander1991`, :footcite:p:`Kuhn2004`.
79
80Membrane potential evolution, spike emission, and refractoriness
81................................................................
82
83The membrane potential evolves according to
84
85.. math::
86
87 \frac{dV_\text{m}}{dt} = \frac{ -g_{\text{L}} (V_{\text{m}} - E_{\text{L}}) - I_{\text{syn}} + I_\text{e} } {C_{\text{m}}}
88
89where the synaptic input current :math:`I_{\text{syn}}(t)` is discussed below and :math:`I_\text{e}` is
90a constant input current set as a model parameter.
91
92A spike is emitted at time step :math:`t^*=t^{k+1}` if
93
94.. math::
95
96 V_\text{m}(t_k) < V_{th} \quad\text{and}\quad V_\text{m}(t^{k+1})\geq V_\text{th} \;.
97
98Subsequently,
99
100.. math::
101
102 V_\text{m}(t) = V_{\text{reset}} \quad\text{for}\quad t^* \leq t \leq t^* + t_{\text{ref}} \;,
103
104that is, the membrane potential is clamped to :math:`V_{\text{reset}}` during the refractory period.
105
106Synaptic input
107..............
108
109The synaptic input current has an excitatory and an inhibitory component
110
111.. math::
112
113 I_{\text{syn}}(t) = I_{\text{syn, ex}}(t) + I_{\text{syn, in}}(t)
114
115where
116
117.. math::
118
119 I_{\text{syn, X}}(t) = (V_{\text{m}}(t) - E_{\text{syn, X}}) \sum_{j} w_j \sum_k g_{\text{X}}(t-t_j^k-d_j) \;,
120
121where :math:`j` indexes either excitatory (:math:`\text{X} = \text{ex}`)
122or inhibitory (:math:`\text{X} = \text{in}`) presynaptic neurons,
123:math:`k` indexes the spike times of neuron :math:`j`, and :math:`d_j`
124is the delay from neuron :math:`j`.
125
126The individual synaptic conductances are given by
127
128.. math::
129
130 g_{\text{X}}(t) = \frac{e}{\tau_{\text{syn, X}}} \, t \, e^{-\frac{t}{\tau_{\text{syn, X}}}} \Theta(t)
131
132where :math:`\Theta(x)` is the Heaviside step function. The conductances are normalized to unit
133peak, that is,
134
135.. math::
136
137 g_{\text{X}}(t= \tau_{\text{syn, X}}) = 1 \;,
138
139as the connnection of the weight :math:`w_{j}` from neuron :math:`j` (excitatory if
140:math:`w_{j} > 0` or inhibitory if :math:`w_{j} < 0`) is written explicitly in the equation for total
141synaptic current.
142
143.. note::
144
145 This model integrates the subthreshold and synaptic dynamics with an
146 adaptive-step-size Runge-Kutta-Fehlberg solver from the GNU Scientific Library.
147
148.. note::
149
150 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
151 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
152 the inhibitory one. Only the absolute value of the weight sets the conductance
153 amplitude. Spike connections must use the default ``receptor_type`` of 0.
154
155 See :ref:`synapse_selection` for the conventions used by other models.
156
157Parameters
158++++++++++
159
160The following parameters can be set in the status dictionary.
161
162=============== ================== =============================== ========================================================================
163**Parameter** **Default** **Math equivalent** **Description**
164=============== ================== =============================== ========================================================================
165``E_L`` -70 mV :math:`E_\text{L}` Leak reversal potential
166``C_m`` 250 pF :math:`C_{\text{m}}` Capacity of the membrane
167``t_ref`` 2 ms :math:`t_{\text{ref}}` Duration of refractory period
168``V_th`` -55 mV :math:`V_{\text{th}}` Spike threshold
169``V_reset`` -60 mV :math:`V_{\text{reset}}` Reset potential of the membrane
170``E_ex`` 0 mV :math:`E_\text{ex}` Excitatory reversal potential
171``E_in`` -85 mV :math:`E_\text{in}` Inhibitory reversal potential
172``g_L`` 16.6667 nS :math:`g_\text{L}` Leak conductance
173``tau_syn_ex`` 0.2 ms :math:`\tau_{\text{syn, ex}}` Rise time of the excitatory synaptic conductance
174``tau_syn_in`` 2.0 ms :math:`\tau_{\text{syn, in}}` Rise time of the inhibitory synaptic conductance
175``I_e`` 0 pA :math:`I_\text{e}` Constant input current
176=============== ================== =============================== ========================================================================
177
178The following state variables evolve during simulation and are available either as neuron properties or as recordables.
179
180================== ================= ========================== =================================
181**State variable** **Initial value** **Math equivalent** **Description**
182================== ================= ========================== =================================
183``V_m`` -70 mV :math:`V_{\text{m}}` Membrane potential
184``g_ex`` 0 nS :math:`g_{\text{ex}}` Excitatory synaptic conductance
185``g_in`` 0 nS :math:`g_{\text{in}}` Inhibitory synaptic conductance
186================== ================= ========================== =================================
187
188Sends
189+++++
190
191SpikeEvent
192
193Receives
194++++++++
195
196SpikeEvent, CurrentEvent, DataLoggingRequest
197
198References
199++++++++++
200
201.. footbibliography::
202
203See also
204++++++++
205
206iaf_cond_exp, iaf_cond_alpha_mc
207
208Examples using this model
209+++++++++++++++++++++++++
210
211.. listexamples:: iaf_cond_alpha
212
213EndUserDocs */
214// clang-format on
215
216void register_iaf_cond_alpha( const std::string& name );
217
218class iaf_cond_alpha : public ArchivingNode
219{
220
221 // Boilerplate function declarations --------------------------------
222
223public:
224 iaf_cond_alpha();
225 iaf_cond_alpha( const iaf_cond_alpha& );
226 ~iaf_cond_alpha() override;
227
228 /*
229 * Import all overloaded virtual functions that we
230 * override in this class. For background information,
231 * see http://www.gotw.ca/gotw/005.htm.
232 */
233
234 using Node::handle;
235 using Node::handles_test_event;
236
237 size_t send_test_event( Node& tagret, size_t receptor_type, synindex, bool ) override;
238
239 size_t handles_test_event( SpikeEvent&, size_t ) override;
240 size_t handles_test_event( CurrentEvent&, size_t ) override;
241 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
242
243 void handle( SpikeEvent& ) override;
244 void handle( CurrentEvent& ) override;
245 void handle( DataLoggingRequest& ) override;
246
247 void get_status( Dictionary& ) const override;
248 void set_status( const Dictionary& ) override;
249
250private:
251 void init_buffers_() override;
252 void pre_run_hook() override;
253 void update( Time const&, const long, const long ) override;
254
255 // END Boilerplate function declarations ----------------------------
256
257 // Friends --------------------------------------------------------
258
259 // make dynamics function quasi-member
260 friend int iaf_cond_alpha_dynamics( double, const double*, double*, void* );
261
262 // The next two classes need to be friends to access the State_ class/member
263 friend class RecordablesMap< iaf_cond_alpha >;
264 friend class UniversalDataLogger< iaf_cond_alpha >;
265
266private:
267 // Parameters class -------------------------------------------------
268
270 struct Parameters_
271 {
272 double V_th;
273 double V_reset;
274 double t_ref;
275 double g_L;
276 double C_m;
277 double E_ex;
278 double E_in;
279 double E_L;
280 double tau_synE;
281 double tau_synI;
282 double I_e;
283
284 Parameters_();
285
286 void get( Dictionary& ) const;
287 void set( const Dictionary&, Node* node );
288 };
289
290 // State variables class --------------------------------------------
291
301public:
302 struct State_
303 {
305 enum StateVecElems
306 {
307 V_M = 0,
308 DG_EXC,
309 G_EXC,
310 DG_INH,
311 G_INH,
312 STATE_VEC_SIZE
313 };
314
316 double y[ STATE_VEC_SIZE ];
317
319 int r;
320
321 State_( const Parameters_& );
322 State_( const State_& );
323
324 State_& operator=( const State_& );
325
326 void get( Dictionary& ) const;
327
332 void set( const Dictionary&, const Parameters_&, Node* );
333 };
334
335private:
336 // Buffers class --------------------------------------------------------
337
344 struct Buffers_
345 {
346 Buffers_( iaf_cond_alpha& );
347 Buffers_( const Buffers_&, iaf_cond_alpha& );
348
350 UniversalDataLogger< iaf_cond_alpha > logger_;
351
353 RingBuffer spike_exc_;
354 RingBuffer spike_inh_;
355 RingBuffer currents_;
356
357 /* GSL ODE stuff */
358 gsl_odeiv_step* s_;
359 gsl_odeiv_control* c_;
360 gsl_odeiv_evolve* e_;
361 gsl_odeiv_system sys_;
362
363 // Since IntegrationStep_ is initialized with step_, and the resolution
364 // cannot change after nodes have been created, it is safe to place both
365 // here.
366 double step_;
367 double IntegrationStep_;
368
376 double I_stim_;
377 };
378
379 // Variables class -------------------------------------------------------
380
385 struct Variables_
386 {
391 double PSConInit_E;
392
397 double PSConInit_I;
398
400 int RefractoryCounts;
401 };
402
403 // Access functions for UniversalDataLogger -------------------------------
404
406 template < State_::StateVecElems elem >
407 double
408 get_y_elem_() const
409 {
410 return S_.y[ elem ];
411 }
412
414 double
415 get_r_() const
416 {
417 return Time::get_resolution().get_ms() * S_.r;
418 }
419
420 // Data members -----------------------------------------------------------
421
422 // keep the order of these lines, seems to give best performance
423 Parameters_ P_;
424 State_ S_;
425 Variables_ V_;
426 Buffers_ B_;
427
429 static RecordablesMap< iaf_cond_alpha > recordablesMap_;
430};
431
432
433// Boilerplate inline function definitions ----------------------------------
434
435inline size_t
436iaf_cond_alpha::send_test_event( Node& target, size_t receptor_type, synindex, bool )
437{
439 e.set_sender( *this );
440 return target.handles_test_event( e, receptor_type );
441}
442
443inline size_t
444iaf_cond_alpha::handles_test_event( SpikeEvent&, size_t receptor_type )
445{
446 if ( receptor_type != 0 )
447 {
448 throw UnknownReceptorType( receptor_type, get_name() );
449 }
450 return 0;
451}
452
453inline size_t
454iaf_cond_alpha::handles_test_event( CurrentEvent&, size_t receptor_type )
455{
456 if ( receptor_type != 0 )
457 {
458 throw UnknownReceptorType( receptor_type, get_name() );
459 }
460 return 0;
461}
462
463inline size_t
464iaf_cond_alpha::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
465{
466 if ( receptor_type != 0 )
467 {
468 throw UnknownReceptorType( receptor_type, get_name() );
469 }
470 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
471}
472
473inline void
474iaf_cond_alpha::get_status( Dictionary& d ) const
475{
476 P_.get( d );
477 S_.get( d );
479
480 d[ names::recordables ] = recordablesMap_.get_list();
481}
482
483inline void
484iaf_cond_alpha::set_status( const Dictionary& d )
485{
486 Parameters_ ptmp = P_; // temporary copy in case of errors
487 ptmp.set( d, this ); // throws if BadProperty
488 State_ stmp = S_; // temporary copy in case of errors
489 stmp.set( d, ptmp, this ); // throws if BadProperty
490
491 // We now know that (ptmp, stmp) are consistent. We do not
492 // write them back to (P_, S_) before we are also sure that
493 // the properties to be set in the parent class are internally
494 // consistent.
496
497 // if we get here, temporaries contain consistent set of properties
498 P_ = ptmp;
499 S_ = stmp;
500}
501
502} // namespace
503
504#endif // IAF_COND_ALPHA_H
505
506#endif // HAVE_GSL
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: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
Event for spike information.
Definition event.h:420
Exception to be thrown if the specified receptor type does not exist in the node.
Definition exceptions.h:417
const std::string t_ref("t_ref")
const std::string E_L("E_L")
const std::string I_e("I_e")
const std::string V_reset("V_reset")
const std::string recordables("recordables")
const std::string C_m("C_m")
const std::string d("d")
const std::string V_th("V_th")
const std::string y("y")
const std::string E_in("E_in")
const std::string target("target")
const std::string E_ex("E_ex")
const std::string g_L("g_L")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
RecordablesMap< binary_neuron< TGainfunction > > binary_neuron< TGainfunction >::recordablesMap_
Definition binary_neuron.h:319
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:121
const double e
Definition numerics.cpp:32