NEST main@caf0ae8
 
Loading...
Searching...
No Matches
gif_psc_exp_multisynapse.h
Go to the documentation of this file.
1/*
2 * gif_psc_exp_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 GIF_PSC_EXP_MULTISYNAPSE_H
24#define GIF_PSC_EXP_MULTISYNAPSE_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 with multiple synaptic time constants (from the Gerstner
44lab)
45
46Description
47+++++++++++
48
49``gif_psc_exp_multisynapse`` is the generalized integrate-and-fire neuron
50according to Mensi et al. (2012) :footcite:p:`Mensi2012` and Pozzorini et al. (2015) :footcite:p:`Pozzorini2015`, with
51exponential shaped postsynaptic currents.
52
53This model features both an adaptation current and a dynamic threshold for
54spike-frequency adaptation. The membrane potential (V) is described by the
55differential equation:
56
57.. math::
58
59 C \cdot dV(t)/dt = -g_L \cdot (V(t)-E_L) - \eta_1(t) - \eta_2(t) - \ldots
60 - \eta_n(t) + I(t)
61
62where each :math:`\eta_i` is a spike-triggered current (stc), and the neuron
63model can have arbitrary number of them.
64Dynamic of each :math:`\eta_i` is described by:
65
66.. math::
67
68 \tau_\eta{_i} \cdot d{\eta_i}/dt = -\eta_i
69
70and in case of spike emission, its value increased by a constant (which can be
71positive or negative):
72
73.. math::
74
75 \eta_i = \eta_i + q_{\eta_i} \text{ (in case of spike emission).}
76
77Neuron produces spikes stochastically according to a point process with the
78firing intensity:
79
80.. math::
81
82 \lambda(t) = \lambda_0 \cdot \exp (V(t)-V_T(t)) / \Delta_V
83
84where :math:`V_T(t)` is a time-dependent firing threshold:
85
86.. math::
87
88 V_T(t) = V_{T_{star}} + \gamma_1(t) + \gamma_2(t) + \ldots + \gamma_m(t)
89
90where :math:`\gamma_i` is a kernel of spike-frequency adaptation (sfa), and the
91neuron model can have arbitrary number of them.
92Dynamic of each :math:`\gamma_i` is described by:
93
94.. math::
95
96 \tau_{\gamma_i} \cdot d\gamma_i/dt = -\gamma_i
97
98and in case of spike emission, its value increased by a constant (which can be
99positive or negative):
100
101.. math::
102
103 \gamma_i = \gamma_i + q_{\gamma_i} \text{ (in case of spike emission).}
104
105
106Note:
107
108In the current implementation of the model, the values of
109:math:`\eta_i` and :math:`\gamma_i` are affected immediately after spike
110emission. However, `GIF toolbox <http://wiki.epfl.ch/giftoolbox>`_, which
111fits the model using experimental data, requires a different set of
112:math:`\eta_i` and :math:`\gamma_i`. It applies the jump of
113:math:`\eta_i` and :math:`\gamma_i` after the refractory period. One can
114easily convert between :math:`q_\eta/\gamma` of these two approaches:
115
116.. math::
117
118 q{_\eta}_{giftoolbox} = q_{\eta_{NEST}} \cdot (1 - \exp( -\tau_{ref} /
119 \tau_\eta ))
120
121The same formula applies for :math:`q_{\gamma}`.
122
123On the postsynaptic side, there can be arbitrarily many synaptic time constants
124(``gif_psc_exp`` has exactly two: ``tau_syn_ex`` and ``tau_syn_in``). This can be reached
125by specifying separate receptor ports, each for a different time constant. The
126port number has to match the respective ``receptor_type`` in the connectors.
127
128The shape of postsynaptic current is exponential.
129
130.. note::
131
132 If ``tau_m`` is very close to a synaptic time constant, the model
133 will numerically behave as if ``tau_m`` is equal to the synaptic
134 time constant, to avoid numerical instabilities.
135
136 For implementation details see the
137 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
138
139Parameters
140++++++++++
141
142The following parameters can be set in the status dictionary.
143
144======== ====== =======================================================
145**Membrane Parameters**
146--------------------------------------------------------------------------
147 Delta_V mV Noise level of escape rate
148 tau_m ms Membrane time constant
149 C_m pF Capacitance of the membrane
150 t_ref ms Duration of refractory period
151 V_reset mV Membrane potential is reset to this value after
152 a spike
153 E_L mV Resting potential
154 g_L nS Leak conductance
155 I_e pA Constant input current
156======== ====== =======================================================
157
158========= ================ ===================================================
159**Spike adaptation and firing intensity parameters**
160-------------------------------------------------------------------------------
161q_stc list of nA Values added to spike-triggered currents (stc)
162 after each spike emission
163tau_stc list of ms Time constants of stc variables
164q_sfa list of mV Values added to spike-frequency adaptation
165 (sfa) after each spike emission
166tau_sfa list of ms Time constants of sfa variables
167Delta_V mV Stochasticity level
168lambda_0 1/s Stochastic intensity at firing threshold V_T
169V_T_star mV Base threshold
170========= ================ ===================================================
171
172======= ================ ==================================================
173**Synaptic parameters**
174-----------------------------------------------------------------------------
175tau_syn list of ms Time constants of the synaptic currents
176======= ================ ==================================================
177
178References
179++++++++++
180
181.. footbibliography::
182
183Sends
184+++++
185
186SpikeEvent
187
188Receives
189++++++++
190
191SpikeEvent, CurrentEvent, DataLoggingRequest
192
193See also
194++++++++
195
196pp_psc_delta, gif_psc_exp, gif_cond_exp, gif_cond_exp_multisynapse
197
198Examples using this model
199+++++++++++++++++++++++++
200
201.. listexamples:: gif_psc_exp_multisynapse
202
203EndUserDocs */
204
205void register_gif_psc_exp_multisynapse( const std::string& name );
206
208{
209
210public:
213
219 using Node::handle;
221
222 size_t send_test_event( Node&, size_t, synindex, bool ) override;
223
224 void handle( SpikeEvent& ) override;
225 void handle( CurrentEvent& ) override;
226 void handle( DataLoggingRequest& ) override;
227
228 size_t handles_test_event( SpikeEvent&, size_t ) override;
229 size_t handles_test_event( CurrentEvent&, size_t ) override;
230 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
231
232 void get_status( Dictionary& ) const override;
233 void set_status( const Dictionary& ) override;
234
235private:
236 void init_buffers_() override;
237 void pre_run_hook() override;
238
239 void update( Time const&, const long, const long ) override;
240
241 // The next two classes need to be friends to access the State_ class/member
243 friend class UniversalDataLogger< gif_psc_exp_multisynapse >;
244
245 // ----------------------------------------------------------------
246
251 {
252 double g_L_;
253 double E_L_;
254 double V_reset_;
255 double Delta_V_;
256 double V_T_star_;
257 double lambda_0_;
261 double t_ref_;
262
264 double c_m_;
265
270 std::vector< double > tau_stc_;
271
273 std::vector< double > q_stc_;
274
276 std::vector< double > tau_sfa_;
277
279 std::vector< double > q_sfa_;
280
282 std::vector< double > tau_syn_;
283
286
288 double I_e_;
289
290 Parameters_();
291
292 void get( Dictionary& ) const;
293 void set( const Dictionary&, Node* node );
294
296 inline size_t
298 {
299 return tau_syn_.size();
300 }
301 };
302
303 // ----------------------------------------------------------------
304
308 struct State_
309 {
310 double I_stim_;
311 double V_;
312 double sfa_;
313 double stc_;
314
315 std::vector< double > sfa_elems_;
316 std::vector< double > stc_elems_;
317
318 std::vector< double > i_syn_;
319
320 unsigned int r_ref_;
321
322 State_();
323
324 void get( Dictionary&, const Parameters_& ) const;
325 void set( const Dictionary&, const Parameters_&, Node* );
326 };
327
328 // ----------------------------------------------------------------
329
345
346 // ----------------------------------------------------------------
347
352 {
353 double P30_; // coefficient for solving membrane potential equation
354 double P33_; // decay term of membrane potential
355 double P31_; // coefficient for solving membrane potential equation
356
357 std::vector< double > P_sfa_; // decay terms of spike-triggered current elements
358 std::vector< double > P_stc_; // decay terms of adaptive threshold elements
359
360 std::vector< double > P11_syn_; // decay terms of synaptic currents
361 std::vector< double > P21_syn_; // coefficients for solving membrane potential equation
362
363 RngPtr rng_; // random number generator of my own thread
364
365 unsigned int RefractoryCounts_;
366 };
367
368 // Access functions for UniversalDataLogger -----------------------
369
371 double
372 get_V_m_() const
373 {
374 return S_.V_;
375 }
376
378 double
380 {
381 return S_.sfa_;
382 }
383
385 double
387 {
388 return S_.stc_;
389 }
390
391 // ----------------------------------------------------------------
392
407};
408
409inline size_t
410gif_psc_exp_multisynapse::send_test_event( Node& target, size_t receptor_type, synindex, bool )
411{
412 SpikeEvent e;
413 e.set_sender( *this );
414
415 return target.handles_test_event( e, receptor_type );
416}
417
418inline size_t
420{
421 if ( receptor_type <= 0 or receptor_type > P_.n_receptors_() )
422 {
423 throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" );
424 }
425
426 P_.has_connections_ = true;
427 return receptor_type;
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_MULTISYNAPSE_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
Exception to be thrown if the specified receptor type does not accept the event type.
Definition exceptions.h:438
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_multisynapse.h:208
double get_I_stc_() const
Read out the spike triggered current.
Definition gif_psc_exp_multisynapse.h:386
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition gif_psc_exp_multisynapse.cpp:417
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_multisynapse.cpp:338
Variables_ V_
Definition gif_psc_exp_multisynapse.h:401
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_multisynapse.h:419
Buffers_ B_
Definition gif_psc_exp_multisynapse.h:402
gif_psc_exp_multisynapse()
Definition gif_psc_exp_multisynapse.cpp:254
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition gif_psc_exp_multisynapse.h:451
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition gif_psc_exp_multisynapse.h:399
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_multisynapse.h:410
friend class UniversalDataLogger< gif_psc_exp_multisynapse >
Definition gif_psc_exp_multisynapse.h:243
State_ S_
Definition gif_psc_exp_multisynapse.h:400
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition gif_psc_exp_multisynapse.cpp:285
static RecordablesMap< gif_psc_exp_multisynapse > recordablesMap_
Mapping of recordables names to access functions.
Definition gif_psc_exp_multisynapse.h:406
void init_buffers_() override
Configure persistent internal data structures.
Definition gif_psc_exp_multisynapse.cpp:276
double get_E_sfa_() const
Read out the adaptive threshold potential.
Definition gif_psc_exp_multisynapse.h:379
double get_V_m_() const
Read out the real membrane potential.
Definition gif_psc_exp_multisynapse.h:372
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition gif_psc_exp_multisynapse.h:460
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_multisynapse(const std::string &name)
Definition gif_psc_exp_multisynapse.cpp:41
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition gif_psc_exp_multisynapse.h:334
std::vector< RingBuffer > spikes_
buffers and sums up incoming spikes/currents
Definition gif_psc_exp_multisynapse.h:339
UniversalDataLogger< gif_psc_exp_multisynapse > logger_
Logger for all analog data.
Definition gif_psc_exp_multisynapse.h:343
RingBuffer currents_
Definition gif_psc_exp_multisynapse.h:340
Independent parameters of the model.
Definition gif_psc_exp_multisynapse.h:251
double E_L_
Definition gif_psc_exp_multisynapse.h:253
Parameters_()
Sets default parameter values.
Definition gif_psc_exp_multisynapse.cpp:68
double I_e_
External DC current.
Definition gif_psc_exp_multisynapse.h:288
bool has_connections_
boolean flag which indicates whether the neuron has connections
Definition gif_psc_exp_multisynapse.h:285
std::vector< double > tau_stc_
We use stc and sfa, respectively instead of eta and gamma (mentioned in the references).
Definition gif_psc_exp_multisynapse.h:270
void get(Dictionary &) const
Store current values in dictionary.
Definition gif_psc_exp_multisynapse.cpp:105
std::vector< double > q_sfa_
List of adaptive threshold jumps in mV.
Definition gif_psc_exp_multisynapse.h:279
std::vector< double > q_stc_
List of spike triggered current jumps in nA.
Definition gif_psc_exp_multisynapse.h:273
double V_reset_
Definition gif_psc_exp_multisynapse.h:254
void set(const Dictionary &, Node *node)
Set values from dictionary.
Definition gif_psc_exp_multisynapse.cpp:128
std::vector< double > tau_syn_
Time constants of synaptic currents in ms.
Definition gif_psc_exp_multisynapse.h:282
size_t n_receptors_() const
Return the number of receptor ports.
Definition gif_psc_exp_multisynapse.h:297
double lambda_0_
Definition gif_psc_exp_multisynapse.h:257
double g_L_
Definition gif_psc_exp_multisynapse.h:252
double V_T_star_
Definition gif_psc_exp_multisynapse.h:256
std::vector< double > tau_sfa_
List of adaptive threshold time constant in ms.
Definition gif_psc_exp_multisynapse.h:276
double c_m_
Membrane capacitance in pF.
Definition gif_psc_exp_multisynapse.h:264
double t_ref_
1/ms
Definition gif_psc_exp_multisynapse.h:261
double Delta_V_
Definition gif_psc_exp_multisynapse.h:255
State variables of the model.
Definition gif_psc_exp_multisynapse.h:309
void set(const Dictionary &, const Parameters_ &, Node *)
Definition gif_psc_exp_multisynapse.cpp:235
unsigned int r_ref_
Absolute refractory counter (no membrane potential propagation)
Definition gif_psc_exp_multisynapse.h:320
double I_stim_
Piecewise constant external current.
Definition gif_psc_exp_multisynapse.h:310
void get(Dictionary &, const Parameters_ &) const
Definition gif_psc_exp_multisynapse.cpp:227
double stc_
Spike triggered current.
Definition gif_psc_exp_multisynapse.h:313
std::vector< double > stc_elems_
Vector of spike triggered parameters.
Definition gif_psc_exp_multisynapse.h:316
std::vector< double > sfa_elems_
Vector of adaptation parameters.
Definition gif_psc_exp_multisynapse.h:315
double V_
Membrane potential.
Definition gif_psc_exp_multisynapse.h:311
std::vector< double > i_syn_
Instantaneous currents of different synapses.
Definition gif_psc_exp_multisynapse.h:318
double sfa_
Change of the 'threshold' due to adaptation.
Definition gif_psc_exp_multisynapse.h:312
State_()
Default initialization.
Definition gif_psc_exp_multisynapse.cpp:88
Internal variables of the model.
Definition gif_psc_exp_multisynapse.h:352
double P30_
Definition gif_psc_exp_multisynapse.h:353
std::vector< double > P21_syn_
Definition gif_psc_exp_multisynapse.h:361
std::vector< double > P_stc_
Definition gif_psc_exp_multisynapse.h:358
double P31_
Definition gif_psc_exp_multisynapse.h:355
double P33_
Definition gif_psc_exp_multisynapse.h:354
RngPtr rng_
Definition gif_psc_exp_multisynapse.h:363
unsigned int RefractoryCounts_
Definition gif_psc_exp_multisynapse.h:365
std::vector< double > P_sfa_
Definition gif_psc_exp_multisynapse.h:357
std::vector< double > P11_syn_
Definition gif_psc_exp_multisynapse.h:360