NEST main@caf0ae8
 
Loading...
Searching...
No Matches
gif_psc_exp.h
Go to the documentation of this file.
1/*
2 * gif_psc_exp.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 GIF_PSC_EXP_H
24#define GIF_PSC_EXP_H
25
26// Includes from nestkernel:
27#include "archiving_node.h"
28#include "connection.h"
29#include "event.h"
30#include "ring_buffer.h"
32
33#include "nest.h"
34
35namespace nest
36{
37
38/* BeginUserDocs: neuron, integrate-and-fire, current-based, adaptation, stochastic
39
40Short description
41+++++++++++++++++
42
43Current-based generalized integrate-and-fire neuron (GIF) model (from the Gerstner lab)
44
45Description
46+++++++++++
47
48``gif_psc_exp`` is the generalized integrate-and-fire neuron according to
49Mensi et al. (2012) :footcite:p:`Mensi2012` and Pozzorini et al. (2015) :footcite:p:`Pozzorini2015`, with exponential
50shaped postsynaptic currents.
51
52This model features both an adaptation current and a dynamic threshold for
53spike-frequency adaptation. The membrane potential (V) is described by the
54differential equation:
55
56.. math::
57
58 C \cdot dV(t)/dt = -g_L \cdot (V(t)-E_L) - \eta_1(t) - \eta_2(t) - \ldots
59 - \eta_n(t) + I(t)
60
61where each :math:`\eta_i` is a spike-triggered current (stc), and the neuron
62model can have arbitrary number of them.
63Dynamic of each :math:`\eta_i` is described by:
64
65.. math::
66
67 \tau_\eta{_i} \cdot d{\eta_i}/dt = -\eta_i
68
69and in case of spike emission, its value increased by a constant (which can be
70positive or negative):
71
72.. math::
73
74 \eta_i = \eta_i + q_{\eta_i} \text{ (in case of spike emission).}
75
76Neuron produces spikes stochastically according to a point process with the
77firing intensity:
78
79.. math::
80
81 \lambda(t) = \lambda_0 \cdot \exp (V(t)-V_T(t)) / \Delta_V
82
83where :math:`V_T(t)` is a time-dependent firing threshold:
84
85.. math::
86
87 V_T(t) = V_{T_{star}} + \gamma_1(t) + \gamma_2(t) + \ldots + \gamma_m(t)
88
89where :math:`\gamma_i` is a kernel of spike-frequency adaptation (sfa), and the
90neuron model can have arbitrary number of them.
91Dynamic of each :math:`\gamma_i` is described by:
92
93.. math::
94
95 \tau_{\gamma_i} \cdot d\gamma_i/dt = -\gamma_i
96
97and in case of spike emission, its value increased by a constant (which can be
98positive or negative):
99
100.. math::
101
102 \gamma_i = \gamma_i + q_{\gamma_i} \text{ (in case of spike emission).}
103
104
105Note:
106
107In the current implementation of the model, the values of
108:math:`\eta_i` and :math:`\gamma_i` are affected immediately after spike
109emission. However, `GIF toolbox <http://wiki.epfl.ch/giftoolbox>`_, which
110fits the model using experimental data, requires a different set of
111:math:`\eta_i` and :math:`\gamma_i`. It applies the jump of
112:math:`\eta_i` and :math:`\gamma_i` after the refractory period. One can
113easily convert between :math:`q_\eta/\gamma` of these two approaches:
114
115.. math::
116
117 q{_\eta}_{giftoolbox} = q_{\eta_{NEST}} \cdot (1 - \exp( -\tau_{ref} /
118 \tau_\eta ))
119
120The same formula applies for :math:`q_{\gamma}`.
121
122
123The shape of postsynaptic current is exponential.
124
125.. note::
126
127 If ``tau_m`` is very close to ``tau_syn_ex`` or ``tau_syn_in``, the model
128 will numerically behave as if ``tau_m`` is equal to `tau_syn_ex` or
129 ``tau_syn_in``, respectively, to avoid numerical instabilities.
130
131 For implementation details see the
132 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
133
134Parameters
135++++++++++
136
137The following parameters can be set in the status dictionary.
138
139======== ======= ================================================
140**Membrane Parameters**
141-----------------------------------------------------------------
142 C_m pF Capacitance of the membrane
143 t_ref ms Duration of refractory period
144 V_reset mV Membrane potential is reset to this value after
145 a spike
146 E_L mV Resting potential
147 g_L nS Leak conductance
148 I_e pA Constant input current
149======== ======= ================================================
150
151========= ========== ====================================================
152**Spike adaptation and firing intensity parameters**
153--------------------------------------------------------------------------
154q_stc list of nA Values added to spike-triggered currents (stc)
155 after each spike emission
156tau_stc list of ms Time constants of stc variables
157q_sfa list of mV Values added to spike-frequency adaptation
158 (sfa) after each spike emission
159tau_sfa list of ms Time constants of sfa variables
160Delta_V mV Stochasticity level
161lambda_0 1/s Stochastic intensity at firing threshold V_T
162V_T_star mV Base threshold
163========= ========== ====================================================
164
165=========== ======= ===========================================================
166**Synaptic parameters**
167-------------------------------------------------------------------------------
168 tau_syn_ex ms Time constant of excitatory synaptic conductance
169 tau_syn_in ms Time constant of the inhibitory synaptic conductance
170=========== ======= ===========================================================
171
172References
173++++++++++
174
175.. footbibliography::
176
177Sends
178+++++
179
180SpikeEvent
181
182Receives
183++++++++
184
185SpikeEvent, CurrentEvent, DataLoggingRequest
186
187See also
188++++++++
189
190pp_psc_delta, gif_psc_exp_multisynapse, gif_cond_exp, gif_cond_exp_multisynapse, gif_pop_psc_exp
191
192Examples using this model
193+++++++++++++++++++++++++
194
195.. listexamples:: gif_psc_exp
196
197EndUserDocs */
198
199void register_gif_psc_exp( const std::string& name );
200
202{
203
204public:
205 gif_psc_exp();
206 gif_psc_exp( const gif_psc_exp& );
207
213 using Node::handle;
215
216 size_t send_test_event( Node&, size_t, synindex, bool ) override;
217
218 void handle( SpikeEvent& ) override;
219 void handle( CurrentEvent& ) override;
220 void handle( DataLoggingRequest& ) override;
221
222 size_t handles_test_event( SpikeEvent&, size_t ) override;
223 size_t handles_test_event( CurrentEvent&, size_t ) override;
224 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
225
226 void get_status( Dictionary& ) const override;
227 void set_status( const Dictionary& ) override;
228
229private:
230 void init_buffers_() override;
231 void pre_run_hook() override;
232
233 void update( Time const&, const long, const long ) override;
234
235 // The next two classes need to be friends to access the State_ class/member
236 friend class RecordablesMap< gif_psc_exp >;
237 friend class UniversalDataLogger< gif_psc_exp >;
238
239 // ----------------------------------------------------------------
240
245 {
246 double g_L_;
247 double E_L_;
248 double V_reset_;
249 double Delta_V_;
250 double V_T_star_;
251 double lambda_0_;
254 double t_ref_;
255
257 double c_m_;
258
263 std::vector< double > tau_stc_;
264
266 std::vector< double > q_stc_;
267
269 std::vector< double > tau_sfa_;
270
272 std::vector< double > q_sfa_;
273
275 double tau_ex_;
276
278 double tau_in_;
279
281 double I_e_;
282
283 Parameters_();
284
285 void get( Dictionary& ) const;
286 void set( const Dictionary&, Node* node );
287 };
288
289 // ----------------------------------------------------------------
290
294 struct State_
295 {
296 double I_stim_;
297 double V_;
298 double sfa_;
299 double stc_;
300
301 std::vector< double > sfa_elems_;
302 std::vector< double > stc_elems_;
303
304 double I_syn_ex_;
305 double I_syn_in_;
306
307 unsigned int r_ref_;
308
309 State_();
310
311 void get( Dictionary&, const Parameters_& ) const;
312 void set( const Dictionary&, const Parameters_&, Node* );
313 };
314
315 // ----------------------------------------------------------------
316
333
334 // ----------------------------------------------------------------
335
340 {
341 double P30_; // coefficient for solving membrane potential equation
342 double P33_; // decay term of membrane potential
343 double P31_; // coefficient for solving membrane potential equation
344 double P11ex_; // decay terms of excitatory synaptic currents
345 double P11in_; // decay terms of inhibitory synaptic currents
346 double P21ex_; // coefficient for solving membrane potential equation
347 double P21in_; // coefficient for solving membrane potential equation
348
349 std::vector< double > P_sfa_; // decay terms of spike-triggered current elements
350 std::vector< double > P_stc_; // decay terms of adaptive threshold elements
351
352 RngPtr rng_; // random number generator of my own thread
353
354 unsigned int RefractoryCounts_;
355 };
356
357 // Access functions for UniversalDataLogger -----------------------
358
360 double
361 get_V_m_() const
362 {
363 return S_.V_;
364 }
365
367 double
369 {
370 return S_.sfa_;
371 }
372
374 double
376 {
377 return S_.stc_;
378 }
379
380 double
382 {
383 return S_.I_syn_ex_;
384 }
385
386 double
388 {
389 return S_.I_syn_in_;
390 }
391
392 // ----------------------------------------------------------------
393
408};
409
410inline size_t
411gif_psc_exp::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
419
420inline size_t
422{
423 if ( receptor_type != 0 )
424 {
425 throw UnknownReceptorType( receptor_type, get_name() );
426 }
427 return 0;
428}
429
430inline size_t
432{
433 if ( receptor_type != 0 )
434 {
435 throw UnknownReceptorType( receptor_type, get_name() );
436 }
437 return 0;
438}
439
440inline size_t
442{
443 if ( receptor_type != 0 )
444 {
445 throw UnknownReceptorType( receptor_type, get_name() );
446 }
447 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
448}
449
450inline void
452{
453 P_.get( d );
454 S_.get( d, P_ );
456 d[ names::recordables ] = recordablesMap_.get_list();
457}
458
459inline void
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 /* #ifndef GIF_PSC_EXP_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
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
Base class for RNG engine wrappers.
Definition random_generators.h:67
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
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 gif_psc_exp.h:202
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition gif_psc_exp.h:421
gif_psc_exp()
Definition gif_psc_exp.cpp:239
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition gif_psc_exp.h:460
double get_I_syn_ex_() const
Definition gif_psc_exp.h:381
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition gif_psc_exp.cpp:392
Variables_ V_
Definition gif_psc_exp.h:402
Buffers_ B_
Definition gif_psc_exp.h:403
double get_E_sfa_() const
Read out the adaptive threshold potential.
Definition gif_psc_exp.h:368
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition gif_psc_exp.h:411
double get_I_syn_in_() const
Definition gif_psc_exp.h:387
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition gif_psc_exp.h:400
friend class UniversalDataLogger< gif_psc_exp >
Definition gif_psc_exp.h:237
double get_I_stc_() const
Read out the spike triggered current.
Definition gif_psc_exp.h:375
State_ S_
Definition gif_psc_exp.h:401
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition gif_psc_exp.cpp:315
static RecordablesMap< gif_psc_exp > recordablesMap_
Mapping of recordables names to access functions.
Definition gif_psc_exp.h:407
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition gif_psc_exp.cpp:271
double get_V_m_() const
Read out the real membrane potential.
Definition gif_psc_exp.h:361
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition gif_psc_exp.h:451
void init_buffers_() override
Configure persistent internal data structures.
Definition gif_psc_exp.cpp:261
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_gif_psc_exp(const std::string &name)
Definition gif_psc_exp.cpp:41
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition gif_psc_exp.h:321
RingBuffer spikes_ex_
buffers and sums up incoming spikes/currents
Definition gif_psc_exp.h:326
RingBuffer currents_
Definition gif_psc_exp.h:328
RingBuffer spikes_in_
Definition gif_psc_exp.h:327
UniversalDataLogger< gif_psc_exp > logger_
Logger for all analog data.
Definition gif_psc_exp.h:331
Independent parameters of the model.
Definition gif_psc_exp.h:245
double E_L_
Definition gif_psc_exp.h:247
double V_T_star_
Definition gif_psc_exp.h:250
double c_m_
Membrane capacitance in pF.
Definition gif_psc_exp.h:257
double t_ref_
1/ms
Definition gif_psc_exp.h:254
void set(const Dictionary &, Node *node)
Set values from dictionary.
Definition gif_psc_exp.cpp:128
std::vector< double > q_sfa_
List of adaptive threshold jumps in mV.
Definition gif_psc_exp.h:272
double g_L_
Definition gif_psc_exp.h:246
std::vector< double > tau_sfa_
List of adaptive threshold time constant in ms.
Definition gif_psc_exp.h:269
std::vector< double > q_stc_
List of spike triggered current jumps in nA.
Definition gif_psc_exp.h:266
std::vector< double > tau_stc_
We use stc and sfa, respectively instead of eta and gamma (mentioned in the references).
Definition gif_psc_exp.h:263
double I_e_
External DC current.
Definition gif_psc_exp.h:281
double tau_in_
Time constant of inhibitory synaptic current in ms.
Definition gif_psc_exp.h:278
double lambda_0_
Definition gif_psc_exp.h:251
double Delta_V_
Definition gif_psc_exp.h:249
double tau_ex_
Time constant of excitatory synaptic current in ms.
Definition gif_psc_exp.h:275
Parameters_()
Sets default parameter values.
Definition gif_psc_exp.cpp:70
void get(Dictionary &) const
Store current values in dictionary.
Definition gif_psc_exp.cpp:108
double V_reset_
Definition gif_psc_exp.h:248
State variables of the model.
Definition gif_psc_exp.h:295
void set(const Dictionary &, const Parameters_ &, Node *)
Definition gif_psc_exp.cpp:220
double I_syn_ex_
Postsynaptic current for exc.
Definition gif_psc_exp.h:304
void get(Dictionary &, const Parameters_ &) const
Definition gif_psc_exp.cpp:212
double sfa_
Change of the 'threshold' due to adaptation.
Definition gif_psc_exp.h:298
double V_
Membrane potential.
Definition gif_psc_exp.h:297
double I_stim_
Piecewise constant external current.
Definition gif_psc_exp.h:296
double stc_
Spike triggered current.
Definition gif_psc_exp.h:299
unsigned int r_ref_
Absolute refractory counter (no membrane potential propagation)
Definition gif_psc_exp.h:307
std::vector< double > sfa_elems_
Vector of adaptation parameters.
Definition gif_psc_exp.h:301
double I_syn_in_
Postsynaptic current for inh.
Definition gif_psc_exp.h:305
State_()
Default initialization.
Definition gif_psc_exp.cpp:90
std::vector< double > stc_elems_
Vector of spike triggered parameters.
Definition gif_psc_exp.h:302
Internal variables of the model.
Definition gif_psc_exp.h:340
double P31_
Definition gif_psc_exp.h:343
std::vector< double > P_sfa_
Definition gif_psc_exp.h:349
double P33_
Definition gif_psc_exp.h:342
double P21in_
Definition gif_psc_exp.h:347
std::vector< double > P_stc_
Definition gif_psc_exp.h:350
RngPtr rng_
Definition gif_psc_exp.h:352
double P11in_
Definition gif_psc_exp.h:345
double P11ex_
Definition gif_psc_exp.h:344
unsigned int RefractoryCounts_
Definition gif_psc_exp.h:354
double P21ex_
Definition gif_psc_exp.h:346
double P30_
Definition gif_psc_exp.h:341