NEST main@f146f75
Loading...
Searching...
No Matches
aeif_cond_alpha.h
Go to the documentation of this file.
1/*
2 * aeif_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 AEIF_COND_ALPHA_H
24#define AEIF_COND_ALPHA_H
25
26// Generated includes:
27#include "config.h"
28
29#ifdef HAVE_GSL
30
31// External 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 aeif_cond_alpha_dynamics( double, const double*, double*, void* );
58
69extern "C" int aeif_cond_alpha_dynamics_DT0( double, const double*, double*, void* );
70
71/* BeginUserDocs: neuron, integrate-and-fire, adaptation, conductance-based, soft threshold
72
73Short description
74+++++++++++++++++
75
76Conductance based exponential integrate-and-fire neuron model
77
78Description
79+++++++++++
80
81``aeif_cond_alpha`` is the adaptive exponential integrate and fire neuron according
82to Brette and Gerstner (2005).
83Synaptic conductances are modelled as alpha-functions.
84
85This implementation uses the embedded 4th order Runge-Kutta-Fehlberg solver with
86adaptive step size to integrate the differential equation.
87
88The membrane potential is given by the following differential equation:
89
90.. math::
91
92 C_m \frac{dV}{dt} =
93 -g_L(V-E_L)+g_L\Delta_T\exp\left(\frac{V-V_{th}}{\Delta_T}\right) -
94 g_e(t)(V-E_e) \\
95 -g_i(t)(V-E_i)-w +I_e
96
97and
98
99.. math::
100
101 \tau_w \frac{dw}{dt} = a(V-E_L) - w
102
103For the reference implementation of this model, see
104`aeif_models_implementation <../model_details/aeif_models_implementation.ipynb>`_ notebook.
105
106
107.. note::
108
109 The default refractory period for ``aeif`` models is zero, consistent with the model definition in
110 Brette & Gerstner :footcite:p:`Brette2005`. Thus, an ``aeif`` neuron with default parameters can fire multiple
111 spikes in a single time step, which can lead to exploding spike numbers and extreme slow-down of simulations.
112
113 To avoid such unphysiological behavior, you should set a refractory time ``t_ref > 0``.
114
115.. note::
116
117 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
118 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
119 the inhibitory one. Only the absolute value of the weight sets the conductance
120 amplitude. Spike connections must use the default ``receptor_type`` of 0.
121
122 See :ref:`synapse_selection` for the conventions used by other models.
123
124Parameters
125++++++++++
126
127The following parameters can be set in the status Dictionary.
128
129======== ======= =======================================
130**Dynamic state variables:**
131--------------------------------------------------------
132 V_m mV Membrane potential
133 g_ex nS Excitatory synaptic conductance
134 dg_ex nS/ms First derivative of g_ex
135 g_in nS Inhibitory synaptic conductance
136 dg_in nS/ms First derivative of g_in
137 w pA Spike-adaptation current
138======== ======= =======================================
139
140======== ======= =======================================
141**Membrane Parameters**
142--------------------------------------------------------
143 C_m pF Capacity of the membrane
144 t_ref ms Duration of refractory period
145 V_reset mV Reset value for V_m after a spike
146 E_L mV Leak reversal potential
147 g_L nS Leak conductance
148 I_e pA Constant external input current
149======== ======= =======================================
150
151======== ======= ==================================
152**Spike adaptation parameters**
153---------------------------------------------------
154 a ns Subthreshold adaptation
155 b pA Spike-triggered adaptation
156 Delta_T mV Slope factor
157 tau_w ms Adaptation time constant
158 V_th mV Spike initiation threshold
159 V_peak mV Spike detection threshold
160======== ======= ==================================
161
162=========== ======= ===========================================================
163**Synaptic parameters**
164-------------------------------------------------------------------------------
165 E_ex mV Excitatory reversal potential
166 tau_syn_ex ms Rise time of excitatory synaptic conductance (alpha
167 function)
168 E_in mV Inhibitory reversal potential
169 tau_syn_in ms Rise time of the inhibitory synaptic conductance
170 (alpha function)
171=========== ======= ===========================================================
172
173============= ======= =========================================================
174**Integration parameters**
175-------------------------------------------------------------------------------
176gsl_error_tol real This parameter controls the admissible error of the
177 GSL integrator. Reduce it if NEST complains about
178 numerical instabilities.
179============= ======= =========================================================
180
181Sends
182+++++
183
184SpikeEvent
185
186Receives
187++++++++
188
189SpikeEvent, CurrentEvent, DataLoggingRequest
190
191References
192++++++++++
193
194.. footbibliography::
195
196See also
197++++++++
198
199iaf_cond_alpha, aeif_cond_exp
200
201Examples using this model
202+++++++++++++++++++++++++
203
204.. listexamples:: aeif_cond_alpha
205
206EndUserDocs */
207
208void register_aeif_cond_alpha( const std::string& name );
209
210class aeif_cond_alpha : public ArchivingNode
211{
212
213public:
214 aeif_cond_alpha();
215 aeif_cond_alpha( const aeif_cond_alpha& );
216 ~aeif_cond_alpha() override;
217
223 using Node::handle;
224 using Node::handles_test_event;
225
226 size_t send_test_event( Node&, size_t, synindex, bool ) override;
227
228 void handle( SpikeEvent& ) override;
229 void handle( CurrentEvent& ) override;
230 void handle( DataLoggingRequest& ) override;
231
232 size_t handles_test_event( SpikeEvent&, size_t ) override;
233 size_t handles_test_event( CurrentEvent&, size_t ) override;
234 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
235
236 void get_status( Dictionary& ) const override;
237 void set_status( const Dictionary& ) override;
238
239private:
240 void init_buffers_() override;
241 void pre_run_hook() override;
242 void update( Time const&, const long, const long ) override;
243
244 // END Boilerplate function declarations ----------------------------
245
246 // Friends --------------------------------------------------------
247
248 // make dynamics function quasi-member
249 friend int aeif_cond_alpha_dynamics( double, const double*, double*, void* );
250
251 // The next two classes need to be friends to access the State_ class/member
252 friend class RecordablesMap< aeif_cond_alpha >;
253 friend class UniversalDataLogger< aeif_cond_alpha >;
254
255private:
256 // ----------------------------------------------------------------
257
259 struct Parameters_
260 {
261 double V_peak_;
262 double V_reset_;
263 double t_ref_;
264
265 double g_L;
266 double C_m;
267 double E_ex;
268 double E_in;
269 double E_L;
270 double Delta_T;
271 double tau_w;
272 double a;
273 double b;
274 double V_th;
275 double tau_syn_ex;
276 double tau_syn_in;
277 double I_e;
278
279 double gsl_error_tol;
280
281 Parameters_();
282
283 void get( Dictionary& ) const;
284 void set( const Dictionary&, Node* node );
285 };
286
287public:
288 // ----------------------------------------------------------------
289
294 struct State_
295 {
302 enum StateVecElems
303 {
304 V_M = 0,
305 DG_EXC, // 1
306 G_EXC, // 2
307 DG_INH, // 3
308 G_INH, // 4
309 W, // 5
310 STATE_VEC_SIZE
311 };
312
313 double y_[ STATE_VEC_SIZE ];
315 unsigned int r_;
316
317 State_( const Parameters_& );
318 State_( const State_& );
319
320 State_& operator=( const State_& );
321
322 void get( Dictionary& ) const;
323 void set( const Dictionary&, const Parameters_&, Node* );
324 };
325
326 // ----------------------------------------------------------------
327
331 struct Buffers_
332 {
333 Buffers_( aeif_cond_alpha& );
334 Buffers_( const Buffers_&, aeif_cond_alpha& );
335
337 UniversalDataLogger< aeif_cond_alpha > logger_;
338
340 RingBuffer spike_exc_;
341 RingBuffer spike_inh_;
342 RingBuffer currents_;
343
345 gsl_odeiv_step* s_;
346 gsl_odeiv_control* c_;
347 gsl_odeiv_evolve* e_;
348 gsl_odeiv_system sys_;
349
350 // Since IntegrationStep_ is initialized with step_, and the resolution
351 // cannot change after nodes have been created, it is safe to place both
352 // here.
353 double step_;
354 double IntegrationStep_;
355
363 double I_stim_;
364 };
365
366 // ----------------------------------------------------------------
367
371 struct Variables_
372 {
374 double g0_ex_;
375
377 double g0_in_;
378
383 double V_peak;
384
385 unsigned int refractory_counts_;
386 };
387
388 // Access functions for UniversalDataLogger -------------------------------
389
391 template < State_::StateVecElems elem >
392 double
393 get_y_elem_() const
394 {
395 return S_.y_[ elem ];
396 }
397
398 // ----------------------------------------------------------------
399
400 Parameters_ P_;
401 State_ S_;
402 Variables_ V_;
403 Buffers_ B_;
404
406 static RecordablesMap< aeif_cond_alpha > recordablesMap_;
407};
408
409inline size_t
410aeif_cond_alpha::send_test_event( Node& target, size_t receptor_type, synindex, bool )
411{
413 e.set_sender( *this );
414
415 return target.handles_test_event( e, receptor_type );
416}
417
418inline size_t
419aeif_cond_alpha::handles_test_event( SpikeEvent&, size_t receptor_type )
420{
421 if ( receptor_type != 0 )
422 {
423 throw UnknownReceptorType( receptor_type, get_name() );
424 }
425 return 0;
426}
427
428inline size_t
429aeif_cond_alpha::handles_test_event( CurrentEvent&, size_t receptor_type )
430{
431 if ( receptor_type != 0 )
432 {
433 throw UnknownReceptorType( receptor_type, get_name() );
434 }
435 return 0;
436}
437
438inline size_t
439aeif_cond_alpha::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
440{
441 if ( receptor_type != 0 )
442 {
443 throw UnknownReceptorType( receptor_type, get_name() );
444 }
445 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
446}
447
448inline void
449aeif_cond_alpha::get_status( Dictionary& d ) const
450{
451 P_.get( d );
452 S_.get( d );
454
455 d[ names::recordables ] = recordablesMap_.get_list();
456}
457
458inline void
459aeif_cond_alpha::set_status( const Dictionary& d )
460{
461 Parameters_ ptmp = P_; // temporary copy in case of errors
462 ptmp.set( d, this ); // throws if BadProperty
463 State_ stmp = S_; // temporary copy in case of errors
464 stmp.set( d, ptmp, this ); // throws if BadProperty
465
466 // We now know that (ptmp, stmp) are consistent. We do not
467 // write them back to (P_, S_) before we are also sure that
468 // the properties to be set in the parent class are internally
469 // consistent.
471
472 // if we get here, temporaries contain consistent set of properties
473 P_ = ptmp;
474 S_ = stmp;
475}
476
477} // namespace
478
479#endif // HAVE_GSL
480#endif // AEIF_COND_ALPHA_H
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 tau_syn_in("tau_syn_in")
const std::string E_L("E_L")
const std::string I_e("I_e")
const std::string recordables("recordables")
const std::string C_m("C_m")
const std::string d("d")
const std::string gsl_error_tol("gsl_error_tol")
const std::string V_th("V_th")
const std::string a("a")
const std::string V_peak("V_peak")
const std::string E_in("E_in")
const std::string target("target")
const std::string tau_syn_ex("tau_syn_ex")
const std::string b("b")
const std::string tau_w("tau_w")
const std::string Delta_T("Delta_T")
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