NEST main@caf0ae8
 
Loading...
Searching...
No Matches
aeif_psc_delta_clopath.h
Go to the documentation of this file.
1/*
2 * aeif_psc_delta_clopath.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_PSC_DELTA_CLOPATH_H
24#define AEIF_PSC_DELTA_CLOPATH_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:
38#include "connection.h"
39#include "event.h"
40#include "nest_types.h"
41#include "recordables_map.h"
42#include "ring_buffer.h"
44
45
46namespace nest
47{
48
59extern "C" int aeif_psc_delta_clopath_dynamics( double, const double*, double*, void* );
60
61/* BeginUserDocs: neuron, adaptation, integrate-and-fire, Clopath plasticity, current-based, soft threshold
62
63Short description
64+++++++++++++++++
65
66Adaptive exponential integrate-and-fire neuron
67
68Description
69+++++++++++
70
71``aeif_psc_delta_clopath`` is an implementation of the neuron model as it is used
72in :footcite:p:`Clopath2010a`. It is an extension of the ``aeif_psc_delta`` model and capable of
73connecting to a Clopath synapse.
74
75Note that there are two points that are not mentioned in the paper but
76present in a MATLAB implementation by Claudia Clopath :footcite:p:`Torben-Nielsen2010`. The first one is the
77clamping of the membrane potential to a fixed value after a spike occurred to
78mimic a real spike and not just the upswing. This is important since the finite
79duration of the spike influences the evolution of the convolved versions
80(``u_bar_[plus/minus]``) of the membrane potential and thus the change of the
81synaptic weight. Secondly, there is a delay with which ``u_bar_[plus/minus]`` are
82used to compute the change of the synaptic weight.
83
84Note:
85Neither the clamping nor the delayed processing of u_bar_[plus/minus] are
86mentioned in :footcite:p:`Clopath2010a`. However, they are part of an reference implementation
87by Claudia Clopath et al. that can be found on ModelDB :footcite:p:`Torben-Nielsen2010`. The clamping is
88important to mimic a spike which is otherwise not described by the aeif neuron
89model.
90
91For implementation details see the
92`aeif_models_implementation <../model_details/aeif_models_implementation.ipynb>`_ notebook.
93
94See also :footcite:p:`Clopath2010b`.
95
96.. note::
97
98 The default refractory period for ``aeif`` models is zero, consistent with the model definition in
99 Brette & Gerstner :footcite:p:`Brette2005`. Thus, an ``aeif`` neuron with default parameters can fire multiple
100 spikes in a single time step, which can lead to exploding spike numbers and extreme slow-down of simulations.
101
102 To avoid such unphysiological behavior, you should set a refractory time ``t_ref > 0``.
103
104Parameters
105++++++++++
106
107The following parameters can be set in the status Dictionary.
108
109=========== ====== ===================================================
110**Dynamic state variables**
111-----------------------------------------------------------------------
112V_m mV Membrane potential
113w pA Spike-adaptation current
114z pA Spike-adaptation current
115V_th mV Adaptive spike initiation threshold
116u_bar_plus mV Low-pass filtered Membrane potential
117u_bar_minus mV Low-pass filtered Membrane potential
118u_bar_bar mV Low-pass filtered u_bar_minus
119=========== ====== ===================================================
120
121================== ======= =================================================
122**Membrane Parameters**
123----------------------------------------------------------------------------
124 C_m pF Capacity of the membrane
125 t_ref ms Duration of refractory period
126 V_reset mV Reset value for V_m after a spike
127 E_L mV Leak reversal potential
128 g_L nS Leak conductance
129 I_e pA Constant external input current
130 tau_u_bar_plus ms Time constant of u_bar_plus
131 tau_u_bar_minus ms Time constant of u_bar_minus
132 tau_u_bar_bar ms Time constant of u_bar_bar
133================== ======= =================================================
134
135========== ====== ===================================================
136**Spike adaptation parameters**
137----------------------------------------------------------------------
138a nS Subthreshold adaptation
139b pA Spike-triggered adaptation
140Delta_T mV Slope factor
141tau_w ms Adaptation time constant
142tau_z ms Spike afterpotential current time constant
143I_sp pA Depolarizing spike afterpotential current magnitude
144V_peak mV Spike detection threshold
145V_th_max mV Value of V_th after a spike
146V_th_rest mV Resting value of V_th
147========== ====== ===================================================
148
149============= ======= =======================================================
150**Clopath rule parameters**
151-----------------------------------------------------------------------------
152A_LTD 1/mV Amplitude of depression
153A_LTP 1/mV^2 Amplitude of facilitation
154theta_plus mV Threshold for u
155theta_minus mV Threshold for u_bar_[plus/minus]
156A_LTD_const boolean Flag that indicates whether `A_LTD_` should
157 be constant (true, default) or multiplied by
158 u_bar_bar^2 / u_ref_squared (false).
159delay_u_bars real Delay with which u_bar_[plus/minus] are processed
160 to compute the synaptic weights.
161U_ref_squared real Reference value for u_bar_bar_^2.
162============= ======= =======================================================
163
164======= ====== =============================================================
165**Other parameters**
166-----------------------------------------------------------------------------
167t_clamp ms Duration of clamping of Membrane potential after a spike
168V_clamp mV Value to which the Membrane potential is clamped
169======= ====== =============================================================
170
171============= ======= =========================================================
172**Integration parameters**
173-------------------------------------------------------------------------------
174gsl_error_tol real This parameter controls the admissible error of the
175 GSL integrator. Reduce it if NEST complains about
176 numerical instabilities.
177============= ======= =========================================================
178
179Sends
180+++++
181
182SpikeEvent
183
184Receives
185++++++++
186
187SpikeEvent, CurrentEvent, DataLoggingRequest
188
189References
190++++++++++
191
192.. footbibliography::
193
194See also
195++++++++
196
197aeif_psc_delta, clopath_synapse, hh_psc_alpha_clopath
198
199Examples using this model
200+++++++++++++++++++++++++
201
202.. listexamples:: aeif_psc_delta_clopath
203
204EndUserDocs */
205
206void register_aeif_psc_delta_clopath( const std::string& name );
207
208class aeif_psc_delta_clopath : public ClopathArchivingNode
209{
210
211public:
212 aeif_psc_delta_clopath();
213 aeif_psc_delta_clopath( const aeif_psc_delta_clopath& );
214 ~aeif_psc_delta_clopath() override;
215
221 using Node::handle;
222 using Node::handles_test_event;
223
224 size_t send_test_event( Node&, size_t, synindex, bool ) override;
225
226 void handle( SpikeEvent& ) override;
227 void handle( CurrentEvent& ) override;
228 void handle( DataLoggingRequest& ) override;
229
230 size_t handles_test_event( SpikeEvent&, size_t ) override;
231 size_t handles_test_event( CurrentEvent&, size_t ) override;
232 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
233
234 void get_status( Dictionary& ) const override;
235 void set_status( const Dictionary& ) override;
236
237private:
238 void init_buffers_() override;
239 void pre_run_hook() override;
240 void update( const Time&, const long, const long ) override;
241
242 // END Boilerplate function declarations ----------------------------
243
244 // Friends --------------------------------------------------------
245
246 // make dynamics function quasi-member
247 friend int aeif_psc_delta_clopath_dynamics( double, const double*, double*, void* );
248
249 // The next two classes need to be friends to access the State_ class/member
250 friend class RecordablesMap< aeif_psc_delta_clopath >;
251 friend class UniversalDataLogger< aeif_psc_delta_clopath >;
252
253private:
254 // ----------------------------------------------------------------
255
257 struct Parameters_
258 {
259 double V_peak_;
260 double V_reset_;
261 double t_ref_;
262
263 double g_L;
264 double C_m;
265 double E_L;
266 double Delta_T;
267 double tau_w;
268 double tau_z;
269 double tau_V_th;
270 double V_th_max;
271 double V_th_rest;
272 double tau_u_bar_plus;
273 double tau_u_bar_minus;
274 double tau_u_bar_bar;
275 double a;
276 double b;
277 double I_sp;
278 double I_e;
279
280 double gsl_error_tol;
281
282 double t_clamp_;
283 double V_clamp_;
284
285
286 Parameters_();
287
288 void get( Dictionary& ) const;
289 void set( const Dictionary&, Node* node );
290 };
291
292public:
293 // ----------------------------------------------------------------
294
299 struct State_
300 {
307 enum StateVecElems
308 {
309 V_M = 0,
310 W, // 1
311 Z, // 2
312 V_TH, // 3
313 U_BAR_PLUS, // 4
314 U_BAR_MINUS, // 5
315 U_BAR_BAR, // 6
316 STATE_VEC_SIZE
317 };
318
320 double y_[ STATE_VEC_SIZE ];
321 unsigned int r_;
322 unsigned int clamp_r_;
323
324 State_( const Parameters_& );
325 State_( const State_& );
326
327 State_& operator=( const State_& );
328
329 void get( Dictionary& ) const;
330 void set( const Dictionary&, const Parameters_&, Node* );
331 };
332
333 // ----------------------------------------------------------------
334
338 struct Buffers_
339 {
340 Buffers_( aeif_psc_delta_clopath& );
341 Buffers_( const Buffers_&, aeif_psc_delta_clopath& );
342
344 UniversalDataLogger< aeif_psc_delta_clopath > logger_;
345
347 RingBuffer spikes_;
348 RingBuffer currents_;
349
351 gsl_odeiv_step* s_;
352 gsl_odeiv_control* c_;
353 gsl_odeiv_evolve* e_;
354 gsl_odeiv_system sys_;
355
356 // Since IntegrationStep_ is initialized with step_, and the resolution
357 // cannot change after nodes have been created, it is safe to place both
358 // here.
359 double step_;
360 double IntegrationStep_;
361
369 double I_stim_;
370 };
371
372 // ----------------------------------------------------------------
373
377 struct Variables_
378 {
383 double V_peak_;
384
385 unsigned int refractory_counts_;
386 unsigned int clamp_counts_;
387 };
388
389 // Access functions for UniversalDataLogger -------------------------------
390
392 template < State_::StateVecElems elem >
393 double
394 get_y_elem_() const
395 {
396 return S_.y_[ elem ];
397 }
398
399 // ----------------------------------------------------------------
400
401 Parameters_ P_;
402 State_ S_;
403 Variables_ V_;
404 Buffers_ B_;
405
407 static RecordablesMap< aeif_psc_delta_clopath > recordablesMap_;
408};
409
410inline size_t
411aeif_psc_delta_clopath::send_test_event( Node& target, size_t receptor_type, synindex, bool )
412{
413 SpikeEvent e;
414 e.set_sender( *this );
415
416 return target.handles_test_event( e, receptor_type );
417}
418
419inline size_t
420aeif_psc_delta_clopath::handles_test_event( SpikeEvent&, size_t receptor_type )
421{
422 if ( receptor_type != 0 )
423 {
424 throw UnknownReceptorType( receptor_type, get_name() );
425 }
426 return 0;
427}
428
429inline size_t
430aeif_psc_delta_clopath::handles_test_event( CurrentEvent&, size_t receptor_type )
431{
432 if ( receptor_type != 0 )
433 {
434 throw UnknownReceptorType( receptor_type, get_name() );
435 }
436 return 0;
437}
438
439inline size_t
440aeif_psc_delta_clopath::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
441{
442 if ( receptor_type != 0 )
443 {
444 throw UnknownReceptorType( receptor_type, get_name() );
445 }
446 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
447}
448
449inline void
450aeif_psc_delta_clopath::get_status( Dictionary& d ) const
451{
452 P_.get( d );
453 S_.get( d );
455
456 d[ names::recordables ] = recordablesMap_.get_list();
457}
458
459inline void
460aeif_psc_delta_clopath::set_status( const Dictionary& d )
461{
462 Parameters_ ptmp = P_; // temporary copy in case of errors
463 ptmp.set( d, this ); // throws if BadProperty
464 State_ stmp = S_; // temporary copy in case of errors
465 stmp.set( d, ptmp, this ); // throws if BadProperty
466
467 // We now know that (ptmp, stmp) are consistent. We do not
468 // write them back to (P_, S_) before we are also sure that
469 // the properties to be set in the parent class are internally
470 // consistent.
472
473 // if we get here, temporaries contain consistent set of properties
474 P_ = ptmp;
475 S_ = stmp;
476}
477
478} // namespace
479
480#endif // HAVE_GSL
481
482#endif // AEIF_PSC_DELTA_CLOPATH_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 clopath_archiving_node.cpp:77
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition clopath_archiving_node.cpp:91
const std::string tau_u_bar_plus("tau_u_bar_plus")
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 V_th_max("V_th_max")
const std::string d("d")
const std::string gsl_error_tol("gsl_error_tol")
const std::string a("a")
const std::string tau_z("tau_z")
const std::string V_th_rest("V_th_rest")
const std::string target("target")
const std::string I_sp("I_sp")
const std::string b("b")
const std::string tau_w("tau_w")
const std::string tau_u_bar_minus("tau_u_bar_minus")
const std::string Delta_T("Delta_T")
const std::string tau_V_th("tau_V_th")
const std::string tau_u_bar_bar("tau_u_bar_bar")
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