NEST main@caf0ae8
 
Loading...
Searching...
No Matches
aeif_cond_beta_multisynapse.h
Go to the documentation of this file.
1/*
2 * aeif_cond_beta_multisynapse.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_BETA_MULTISYNAPSE_H
24#define AEIF_COND_BETA_MULTISYNAPSE_H
25
26// Generated includes:
27#include "config.h"
28#include <sstream>
29
30#ifdef HAVE_GSL
31
32// External includes:
33#include <gsl/gsl_errno.h>
34#include <gsl/gsl_matrix.h>
35#include <gsl/gsl_odeiv.h>
36
37// Includes from nestkernel:
38#include "archiving_node.h"
39#include "connection.h"
40#include "event.h"
41#include "nest_types.h"
42#include "ring_buffer.h"
44
45namespace nest
46{
57extern "C" int aeif_cond_beta_multisynapse_dynamics( double, const double*, double*, void* );
58
59/* BeginUserDocs: neuron, adaptation, integrate-and-fire, conductance-based, soft threshold
60
61Short description
62+++++++++++++++++
63
64Conductance based adaptive exponential integrate-and-fire neuron model
65
66Description
67+++++++++++
68
69``aeif_cond_beta_multisynapse`` is a conductance-based adaptive exponential
70integrate-and-fire neuron model, according to Brette and Gerstner (2005) with
71multiple synaptic rise time and decay time constants, and synaptic conductance
72modeled by a beta function.
73
74It allows an arbitrary number of synaptic
75rise time and decay time constants. Synaptic conductance is modeled by a
76beta function, as described by A. Roth and M.C.W. van Rossum
77in Computational Modeling Methods for Neuroscientists, MIT Press 2013,
78Chapter 6.
79
80The time constants are supplied by two arrays, ``tau_rise`` and ``tau_decay`` for
81the synaptic rise time and decay time, respectively. The synaptic
82reversal potentials are supplied by the array ``E_rev``. The port numbers
83are automatically assigned in the range from 1 to n_receptors.
84During connection, the ports are selected with the property ``receptor_type``.
85
86When connecting to conductance-based multisynapse models, all synaptic weights
87must be non-negative.
88
89The membrane potential is given by the following differential equation:
90
91.. math::
92
93 C dV/dt = -g_L(V-E_L) + g_L \cdot \Delta_T \cdot \exp((V-V_T)/\Delta_T)
94 + I_{syn_{tot}}(V, t) - w + I_e
95
96
97where:
98
99.. math::
100
101 I_{syn_{tot}}(V,t) = \sum_i g_i(t) (V - E_{rev,i}) ,
102
103the synapse `i` is excitatory or inhibitory depending on the value of
104:math:`E_{rev,i}`
105and the differential equation for the spike-adaptation current `w` is:
106
107.. math::
108
109 \tau_w \cdot dw/dt = a(V - E_L) - w
110
111When the neuron fires a spike, the adaptation current `w <- w + b`.
112
113For implementation details see the
114`aeif_models_implementation <../model_details/aeif_models_implementation.ipynb>`_ notebook.
115
116.. note::
117
118 The default refractory period for ``aeif`` models is zero, consistent with the model definition in
119 Brette & Gerstner :footcite:p:`Brette2005`. Thus, an ``aeif`` neuron with default parameters can fire multiple
120 spikes in a single time step, which can lead to exploding spike numbers and extreme slow-down of simulations.
121
122 To avoid such unphysiological behavior, you should set a refractory time ``t_ref > 0``.
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 w pA Spike-adaptation current
134======== ======= =======================================
135
136======== ======= =======================================
137**Membrane Parameters**
138--------------------------------------------------------
139 C_m pF Capacity of the membrane
140 t_ref ms Duration of refractory period
141 V_reset mV Reset value for V_m after a spike
142 E_L mV Leak reversal potential
143 g_L nS Leak conductance
144 I_e pA Constant external input current
145 Delta_T mV Slope factor
146 V_th mV Spike initiation threshold
147 V_peak mV Spike detection threshold
148======== ======= =======================================
149
150======== ======= ==================================
151**Spike adaptation parameters**
152---------------------------------------------------
153 a nS Subthreshold adaptation
154 b pA Spike-triggered adaptation
155 tau_w ms Adaptation time constant
156======== ======= ==================================
157
158======== ============= ========================================================
159**Synaptic parameters**
160-------------------------------------------------------------------------------
161E_rev list of mV Reversal potential
162tau_syn list of ms Time constant of synaptic conductance
163======== ============= ========================================================
164
165============= ======= =========================================================
166**Integration parameters**
167-------------------------------------------------------------------------------
168gsl_error_tol real This parameter controls the admissible error of the
169 GSL integrator. Reduce it if NEST complains about
170 numerical instabilities.
171============= ======= =========================================================
172
173Sends
174+++++
175
176SpikeEvent
177
178Receives
179++++++++
180
181SpikeEvent, CurrentEvent, DataLoggingRequest
182
183References
184++++++++++
185
186.. footbibliography::
187
188See also
189++++++++
190
191aeif_cond_alpha_multisynapse
192
193Examples using this model
194+++++++++++++++++++++++++
195
196.. listexamples:: aeif_cond_beta_multisynapse
197
198EndUserDocs */
199
200void register_aeif_cond_beta_multisynapse( const std::string& name );
201
202class aeif_cond_beta_multisynapse : public ArchivingNode
203{
204
205public:
206 aeif_cond_beta_multisynapse();
207 aeif_cond_beta_multisynapse( const aeif_cond_beta_multisynapse& );
208 ~aeif_cond_beta_multisynapse() override;
209
210 friend int aeif_cond_beta_multisynapse_dynamics( double, const double*, double*, void* );
211
217 using Node::handle;
218 using Node::handles_test_event;
219
220 size_t send_test_event( Node&, size_t, synindex, bool ) override;
221
222 void handle( SpikeEvent& ) override;
223 void handle( CurrentEvent& ) override;
224 void handle( DataLoggingRequest& ) override;
225
226 size_t handles_test_event( SpikeEvent&, size_t ) override;
227 size_t handles_test_event( CurrentEvent&, size_t ) override;
228 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
229
230 void get_status( Dictionary& ) const override;
231 void set_status( const Dictionary& ) override;
232
233private:
234 void init_buffers_() override;
235 void pre_run_hook() override;
236 void update( Time const&, const long, const long ) override;
237
238 // The next three classes need to be friends to access the State_ class/member
239 friend class DynamicRecordablesMap< aeif_cond_beta_multisynapse >;
240 friend class DynamicUniversalDataLogger< aeif_cond_beta_multisynapse >;
241 friend class DataAccessFunctor< aeif_cond_beta_multisynapse >;
242
243 // ----------------------------------------------------------------
244
248 struct Parameters_
249 {
250 double V_peak_;
251 double V_reset_;
252 double t_ref_;
253
254 double g_L;
255 double C_m;
256 double E_L;
257 double Delta_T;
258 double tau_w;
259 double a;
260 double b;
261 double V_th;
262
263 std::vector< double > tau_rise;
264 std::vector< double > tau_decay;
265 std::vector< double > E_rev;
266
267 double I_e;
268
269 double gsl_error_tol;
270
271 bool has_connections_;
272
273 Parameters_();
274
275 void get( Dictionary& ) const;
276 void set( const Dictionary&, Node* node );
277
279 inline size_t
280 n_receptors() const
281 {
282 return E_rev.size();
283 };
284 };
285
286 // ----------------------------------------------------------------
287
292 struct State_
293 {
302 enum StateVecElems
303 {
304 V_M = 0,
305 W, // 1
306 DG, // 2
307 G, // 3
308 STATE_VECTOR_MIN_SIZE
309 };
310
311 static const size_t NUMBER_OF_FIXED_STATES_ELEMENTS = 2; // V_M, W
312 static const size_t NUM_STATE_ELEMENTS_PER_RECEPTOR = 2; // DG, G
313
314 std::vector< double > y_;
315 int r_;
316
317 State_( const Parameters_& );
318
319 void get( Dictionary& ) const;
320 void set( const Dictionary&, Node* node );
321
322 }; // State_
323
324 // ----------------------------------------------------------------
325
329 struct Buffers_
330 {
331 Buffers_( aeif_cond_beta_multisynapse& );
332 Buffers_( const Buffers_&, aeif_cond_beta_multisynapse& );
333
335 DynamicUniversalDataLogger< aeif_cond_beta_multisynapse > logger_;
336
338 std::vector< RingBuffer > spikes_;
339 RingBuffer currents_;
340
342 gsl_odeiv_step* s_;
343 gsl_odeiv_control* c_;
344 gsl_odeiv_evolve* e_;
345 gsl_odeiv_system sys_;
346
347 // Since IntegrationStep_ is initialized with step_, and the resolution
348 // cannot change after nodes have been created, it is safe to place both
349 // here.
350 double step_;
351 double IntegrationStep_;
353
361 double I_stim_;
362 };
363
364 // ----------------------------------------------------------------
365
369 struct Variables_
370 {
371
373 std::vector< double > g0_;
374
379 double V_peak;
380
381 unsigned int refractory_counts_;
382 };
383
384 // Data members -----------------------------------------------------------
385
392 Parameters_ P_;
393 State_ S_;
394 Variables_ V_;
395 Buffers_ B_;
398 // Access functions for UniversalDataLogger -------------------------------
399
401 DynamicRecordablesMap< aeif_cond_beta_multisynapse > recordablesMap_;
402
403 // Data Access Functor getter
404 DataAccessFunctor< aeif_cond_beta_multisynapse > get_data_access_functor( size_t elem );
405 inline double
406 get_state_element( size_t elem )
407 {
408 return S_.y_[ elem ];
409 };
410
411 // Utility function that inserts the synaptic conductances to the
412 // recordables map
413
414 std::string get_g_receptor_name( size_t receptor );
415 void insert_conductance_recordables( size_t first = 0 );
416};
417
418inline size_t
419aeif_cond_beta_multisynapse::send_test_event( Node& target, size_t receptor_type, synindex, bool )
420{
421 SpikeEvent e;
422 e.set_sender( *this );
423
424 return target.handles_test_event( e, receptor_type );
425}
426
427inline size_t
428aeif_cond_beta_multisynapse::handles_test_event( CurrentEvent&, size_t receptor_type )
429{
430 if ( receptor_type != 0 )
431 {
432 throw UnknownReceptorType( receptor_type, get_name() );
433 }
434 return 0;
435}
436
437inline size_t
438aeif_cond_beta_multisynapse::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
439{
440 if ( receptor_type != 0 )
441 {
442 throw UnknownReceptorType( receptor_type, get_name() );
443 }
444 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
445}
446
447inline void
448aeif_cond_beta_multisynapse::get_status( Dictionary& d ) const
449{
450 P_.get( d );
451 S_.get( d );
453
454 d[ names::recordables ] = recordablesMap_.get_list();
455}
456
457} // namespace
458
459#endif // HAVE_GSL
460#endif // AEIF_COND_BETA_MULTISYNAPSE_H //
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition archiving_node.cpp:220
const std::string tau_rise("tau_rise")
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 n_receptors("n_receptors")
const std::string tau_decay("tau_decay")
const std::string target("target")
const std::string b("b")
const std::string tau_w("tau_w")
const std::string Delta_T("Delta_T")
const std::string E_rev("E_rev")
const std::string g_L("g_L")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
const double e
Definition numerics.cpp:32