NEST main@f146f75
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 <https://github.com/pozzorin/GIFFittingToolbox>`_, 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
134.. note::
135
136 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
137 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
138 the inhibitory one, and also sets the direction of the post-synaptic current.
139 Spike connections must use the default ``receptor_type`` of 0.
140
141 See :ref:`synapse_selection` for the conventions used by other models.
142
143Parameters
144++++++++++
145
146The following parameters can be set in the status dictionary.
147
148======== ======= ================================================
149**Membrane Parameters**
150-----------------------------------------------------------------
151 C_m pF Capacitance of the membrane
152 t_ref ms Duration of refractory period
153 V_reset mV Membrane potential is reset to this value after
154 a spike
155 E_L mV Resting potential
156 g_L nS Leak conductance
157 I_e pA Constant input current
158======== ======= ================================================
159
160========= ========== ====================================================
161**Spike adaptation and firing intensity parameters**
162--------------------------------------------------------------------------
163q_stc list of nA Values added to spike-triggered currents (stc)
164 after each spike emission
165tau_stc list of ms Time constants of stc variables
166q_sfa list of mV Values added to spike-frequency adaptation
167 (sfa) after each spike emission
168tau_sfa list of ms Time constants of sfa variables
169Delta_V mV Stochasticity level
170lambda_0 1/s Stochastic intensity at firing threshold V_T
171V_T_star mV Base threshold
172========= ========== ====================================================
173
174=========== ======= ===========================================================
175**Synaptic parameters**
176-------------------------------------------------------------------------------
177 tau_syn_ex ms Time constant of excitatory synaptic conductance
178 tau_syn_in ms Time constant of the inhibitory synaptic conductance
179=========== ======= ===========================================================
180
181References
182++++++++++
183
184.. footbibliography::
185
186Sends
187+++++
188
189SpikeEvent
190
191Receives
192++++++++
193
194SpikeEvent, CurrentEvent, DataLoggingRequest
195
196See also
197++++++++
198
199pp_psc_delta, gif_psc_exp_multisynapse, gif_cond_exp, gif_cond_exp_multisynapse, gif_pop_psc_exp
200
201Examples using this model
202+++++++++++++++++++++++++
203
204.. listexamples:: gif_psc_exp
205
206EndUserDocs */
207
208void register_gif_psc_exp( const std::string& name );
209
211{
212
213public:
214 gif_psc_exp();
215 gif_psc_exp( const gif_psc_exp& );
216
222 using Node::handle;
224
225 size_t send_test_event( Node&, size_t, synindex, bool ) override;
226
227 void handle( SpikeEvent& ) override;
228 void handle( CurrentEvent& ) override;
229 void handle( DataLoggingRequest& ) override;
230
231 size_t handles_test_event( SpikeEvent&, size_t ) override;
232 size_t handles_test_event( CurrentEvent&, size_t ) override;
233 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
234
235 void get_status( Dictionary& ) const override;
236 void set_status( const Dictionary& ) override;
237
238private:
239 void init_buffers_() override;
240 void pre_run_hook() override;
241
242 void update( Time const&, const long, const long ) override;
243
244 // The next two classes need to be friends to access the State_ class/member
245 friend class RecordablesMap< gif_psc_exp >;
246 friend class UniversalDataLogger< gif_psc_exp >;
247
248 // ----------------------------------------------------------------
249
254 {
255 double g_L_;
256 double E_L_;
257 double V_reset_;
258 double Delta_V_;
259 double V_T_star_;
260 double lambda_0_;
261
263 double t_ref_;
264
266 double c_m_;
267
270
272 std::vector< double > tau_stc_;
273
275 std::vector< double > q_stc_;
276
278 std::vector< double > tau_sfa_;
279
281 std::vector< double > q_sfa_;
282
284 double tau_ex_;
285
287 double tau_in_;
288
290 double I_e_;
291
292 Parameters_();
293
294 void get( Dictionary& ) const;
295 void set( const Dictionary&, Node* node );
296 };
297
298 // ----------------------------------------------------------------
299
303 struct State_
304 {
305 double I_stim_;
306 double V_;
307 double sfa_;
308 double stc_;
309
310 std::vector< double > sfa_elems_;
311 std::vector< double > stc_elems_;
312
313 double I_syn_ex_;
314 double I_syn_in_;
315
316 unsigned int r_ref_;
317
318 State_();
319
320 void get( Dictionary&, const Parameters_& ) const;
321 void set( const Dictionary&, const Parameters_&, Node* );
322 };
323
324 // ----------------------------------------------------------------
325
342
343 // ----------------------------------------------------------------
344
349 {
350 double P30_; // coefficient for solving membrane potential equation
351 double P33_; // decay term of membrane potential
352 double P31_; // coefficient for solving membrane potential equation
353 double P11ex_; // decay terms of excitatory synaptic currents
354 double P11in_; // decay terms of inhibitory synaptic currents
355 double P21ex_; // coefficient for solving membrane potential equation
356 double P21in_; // coefficient for solving membrane potential equation
357
358 std::vector< double > P_sfa_; // decay terms of spike-triggered current elements
359 std::vector< double > P_stc_; // decay terms of adaptive threshold elements
360
361 RngPtr rng_; // random number generator of my own thread
362
363 unsigned int RefractoryCounts_;
364 };
365
366 // Access functions for UniversalDataLogger -----------------------
367
369 double
370 get_V_m_() const
371 {
372 return S_.V_;
373 }
374
376 double
378 {
379 return S_.sfa_;
380 }
381
383 double
385 {
386 return S_.stc_;
387 }
388
389 double
391 {
392 return S_.I_syn_ex_;
393 }
394
395 double
397 {
398 return S_.I_syn_in_;
399 }
400
401 // ----------------------------------------------------------------
402
414
417};
418
419inline size_t
420gif_psc_exp::send_test_event( Node& target, size_t receptor_type, synindex, bool )
421{
422 SpikeEvent e;
423 e.set_sender( *this );
424
425 return target.handles_test_event( e, receptor_type );
426}
427
428
429inline size_t
431{
432 if ( receptor_type != 0 )
433 {
434 throw UnknownReceptorType( receptor_type, get_name() );
435 }
436 return 0;
437}
438
439inline size_t
441{
442 if ( receptor_type != 0 )
443 {
444 throw UnknownReceptorType( receptor_type, get_name() );
445 }
446 return 0;
447}
448
449inline size_t
451{
452 if ( receptor_type != 0 )
453 {
454 throw UnknownReceptorType( receptor_type, get_name() );
455 }
456 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
457}
458
459inline void
461{
462 P_.get( d );
463 S_.get( d, P_ );
465 d[ names::recordables ] = recordablesMap_.get_list();
466}
467
468inline void
470{
471 Parameters_ ptmp = P_; // temporary copy in case of errors
472 ptmp.set( d, this ); // throws if BadProperty
473 State_ stmp = S_; // temporary copy in case of errors
474 stmp.set( d, ptmp, this ); // throws if BadProperty
475
476 // We now know that (ptmp, stmp) are consistent. We do not
477 // write them back to (P_, S_) before we are also sure that
478 // the properties to be set in the parent class are internally
479 // consistent.
481
482 // if we get here, temporaries contain consistent set of properties
483 P_ = ptmp;
484 S_ = stmp;
485}
486
487} // namespace
488
489#endif /* #ifndef GIF_PSC_EXP_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
ArchivingNode()
Definition archiving_node.cpp:37
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
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:420
Definition nest_time.h:135
Exception to be thrown if the specified receptor type does not exist in the node.
Definition exceptions.h:417
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:430
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:469
double get_I_syn_ex_() const
Definition gif_psc_exp.h:390
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition gif_psc_exp.cpp:392
Variables_ V_
Definition gif_psc_exp.h:411
friend class RecordablesMap< gif_psc_exp >
Definition gif_psc_exp.h:245
Buffers_ B_
Definition gif_psc_exp.h:412
double get_E_sfa_() const
Read out the adaptive threshold potential.
Definition gif_psc_exp.h:377
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:420
double get_I_syn_in_() const
Definition gif_psc_exp.h:396
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition gif_psc_exp.h:409
friend class UniversalDataLogger< gif_psc_exp >
Definition gif_psc_exp.h:246
double get_I_stc_() const
Read out the spike triggered current.
Definition gif_psc_exp.h:384
State_ S_
Definition gif_psc_exp.h:410
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:416
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:370
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition gif_psc_exp.h:460
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:282
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition node.cpp:271
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
BaseRandomGenerator * RngPtr
Definition random_generators.h:50
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:121
Buffers of the model.
Definition gif_psc_exp.h:330
Buffers_(gif_psc_exp &)
Definition gif_psc_exp.cpp:225
RingBuffer spikes_ex_
buffers and sums up incoming spikes/currents
Definition gif_psc_exp.h:335
RingBuffer currents_
Definition gif_psc_exp.h:337
RingBuffer spikes_in_
Definition gif_psc_exp.h:336
UniversalDataLogger< gif_psc_exp > logger_
Logger for all analog data.
Definition gif_psc_exp.h:340
Independent parameters of the model.
Definition gif_psc_exp.h:254
double E_L_
Definition gif_psc_exp.h:256
double V_T_star_
Definition gif_psc_exp.h:259
double c_m_
Membrane capacitance in pF.
Definition gif_psc_exp.h:266
double t_ref_
1/ms
Definition gif_psc_exp.h:263
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:281
double g_L_
Definition gif_psc_exp.h:255
std::vector< double > tau_sfa_
List of adaptive threshold time constant in ms.
Definition gif_psc_exp.h:278
std::vector< double > q_stc_
List of spike triggered current jumps in nA.
Definition gif_psc_exp.h:275
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:272
double I_e_
External DC current.
Definition gif_psc_exp.h:290
double tau_in_
Time constant of inhibitory synaptic current in ms.
Definition gif_psc_exp.h:287
double lambda_0_
Definition gif_psc_exp.h:260
double Delta_V_
Definition gif_psc_exp.h:258
double tau_ex_
Time constant of excitatory synaptic current in ms.
Definition gif_psc_exp.h:284
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:257
State variables of the model.
Definition gif_psc_exp.h:304
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:313
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:307
double V_
Membrane potential.
Definition gif_psc_exp.h:306
double I_stim_
Piecewise constant external current.
Definition gif_psc_exp.h:305
double stc_
Spike triggered current.
Definition gif_psc_exp.h:308
unsigned int r_ref_
Absolute refractory counter (no membrane potential propagation).
Definition gif_psc_exp.h:316
std::vector< double > sfa_elems_
Vector of adaptation parameters.
Definition gif_psc_exp.h:310
double I_syn_in_
Postsynaptic current for inh.
Definition gif_psc_exp.h:314
State_()
Default initialization.
Definition gif_psc_exp.cpp:90
std::vector< double > stc_elems_
Vector of spike triggered parameters.
Definition gif_psc_exp.h:311
Internal variables of the model.
Definition gif_psc_exp.h:349
double P31_
Definition gif_psc_exp.h:352
std::vector< double > P_sfa_
Definition gif_psc_exp.h:358
double P33_
Definition gif_psc_exp.h:351
double P21in_
Definition gif_psc_exp.h:356
std::vector< double > P_stc_
Definition gif_psc_exp.h:359
RngPtr rng_
Definition gif_psc_exp.h:361
double P11in_
Definition gif_psc_exp.h:354
double P11ex_
Definition gif_psc_exp.h:353
unsigned int RefractoryCounts_
Definition gif_psc_exp.h:363
double P21ex_
Definition gif_psc_exp.h:355
double P30_
Definition gif_psc_exp.h:350