NEST main@caf0ae8
 
Loading...
Searching...
No Matches
glif_psc.h
Go to the documentation of this file.
1/*
2 * glif_psc.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 GLIF_PSC_H
24#define GLIF_PSC_H
25
26#include "archiving_node.h"
27#include "connection.h"
28#include "event.h"
29#include "nest_types.h"
30#include "ring_buffer.h"
32
33/* BeginUserDocs: neuron, integrate-and-fire, current-based, adaptation, hard threshold
34
35Short description
36+++++++++++++++++
37
38Current-based generalized leaky integrate-and-fire (GLIF) models (from the Allen Institute)
39
40Description
41+++++++++++
42
43``glif_psc`` provides five generalized leaky integrate-and-fire
44(GLIF) models :footcite:p:`Teeter2018` with alpha-function shaped synaptic currents.
45Incoming spike events induce a postsynaptic change of current modeled
46by an alpha function :footcite:p:`Meffin2004`. The alpha function is normalized such that an event
47of weight 1.0 results in a peak current of 1 pA at :math:`t = \tau_\mathrm{syn}`.
48By default, ``glif_psc`` has a single synapse that is accessible through
49``receptor_port`` 1. An arbitrary number of synapses with different time constants
50can be configured by setting the desired time constants as ``tau_syn`` array.
51The resulting synapses are addressed through ``receptor_port`` 1, 2, 3, ....
52
53The five GLIF models are:
54
55* **GLIF Model 1** - Traditional leaky integrate and fire (LIF)
56* **GLIF Model 2** - Leaky integrate and fire with biologically defined reset rules
57 (LIF_R)
58* **GLIF Model 3** - Leaky integrate and fire with after-spike currents (LIF_ASC)
59* **GLIF Model 4** - Leaky integrate and fire with biologically defined reset rules
60 and after-spike currents (LIF_R_ASC)
61* **GLIF Model 5** - Leaky integrate and fire with biologically defined reset rules,
62 after-spike currents and a voltage dependent threshold (LIF_R_ASC_A)
63
64Remarks:
65
66GLIF model mechanism setting is based on three parameters
67(``spike_dependent_threshold``, ``after_spike_currents``, ``adapting_threshold``).
68The settings of these three parameters for the five GLIF models are listed
69below. Other combinations of these parameters will not be supported.
70
71+--------+---------------------------+----------------------+--------------------+
72| Model | spike_dependent_threshold | after_spike_currents | adapting_threshold |
73+========+===========================+======================+====================+
74| GLIF1 | False | False | False |
75+--------+---------------------------+----------------------+--------------------+
76| GLIF2 | True | False | False |
77+--------+---------------------------+----------------------+--------------------+
78| GLIF3 | False | True | False |
79+--------+---------------------------+----------------------+--------------------+
80| GLIF4 | True | True | False |
81+--------+---------------------------+----------------------+--------------------+
82| GLIF5 | True | True | True |
83+--------+---------------------------+----------------------+--------------------+
84
85Typical parameter setting of different levels of GLIF models for different cells
86can be found and downloaded in the `Allen Cell Type Database
87<https://celltypes.brain-map.org>`_. For example, the default parameter setting of
88this ``glif_psc`` neuron model was from the parameter values of GLIF Model 5 of Cell
89490626718, which can be retrieved from the `Allen Brain Atlas
90<https://celltypes.brain-map.org/mouse/experiment/electrophysiology/
91490626718>`_, with units being converted from SI units (i.e., V, S (1/Ohm),
92F, s, A) to NEST used units (i.e., mV, nS (1/GOhm), pF, ms, pA) and values
93being rounded to appropriate digits for simplification.
94
95For models with spike dependent threshold (i.e., GLIF2, GLIF4 and GLIF5),
96parameter setting of ``voltage_reset_fraction`` and ``voltage_reset_add`` may lead
97to the situation that voltage is bigger than threshold after reset. In this case,
98the neuron will continue to spike until the end of the simulation regardless the
99stimulated inputs. We recommend the setting of the parameters of these three models
100to follow the condition of
101
102.. math::
103
104 E_L + \mathrm{voltage\_reset\_fraction} \cdot \left( V_\mathrm{th} - E_L \right)
105 + \mathrm{voltage\_reset\_add} < V_\mathrm{th} + \mathrm{th\_spike\_add}
106
107.. note::
108
109 If ``tau_m`` is very close to ``tau_syn_ex`` or ``tau_syn_in``, the model
110 will numerically behave as if ``tau_m`` is equal to ``tau_syn_ex`` or
111 ``tau_syn_in``, respectively, to avoid numerical instabilities.
112
113 For implementation details see the
114 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
115
116Parameters
117++++++++++
118
119The following parameters can be set in the status dictionary.
120
121========= ======== ============================================================
122**Membrane parameters**
123-------------------------------------------------------------------------------
124V_m double Membrane potential in mV (absolute value)
125V_th double Instantaneous threshold in mV
126g double Membrane conductance in nS
127E_L double Resting membrane potential in mV
128C_m double Capacitance of the membrane in pF
129t_ref double Duration of refractory time in ms
130V_reset double Reset potential of the membrane in mV (GLIF 1 or GLIF 3)
131========= ======== ============================================================
132
133========================= =============== =====================================
134**Spike adaptation and firing intensity parameters**
135-------------------------------------------------------------------------------
136th_spike_add double Threshold addition following spike
137 in mV (delta_theta_s in Equation (6)
138 in :footcite:p:`Teeter2018`)
139th_spike_decay double Spike-induced threshold time
140 constant in 1/ms (bs in Equation (2)
141 in :footcite:p:`Teeter2018`)
142voltage_reset_fraction double Voltage fraction coefficient
143 following spike (fv in Equation (5)
144 in :footcite:p:`Teeter2018`)
145voltage_reset_add double Voltage addition following spike in
146 mV (-delta_V (sign flipped) in
147 Equation (5) in :footcite:p:`Teeter2018`)
148asc_init double vector Initial values of after-spike
149 currents in pA
150asc_decay double vector After-spike current time constants
151 in 1/ms (kj in Equation (3) in :footcite:p:`Teeter2018`)
152asc_amps double vector After-spike current amplitudes in
153 pA (deltaIj in Equation (7) in :footcite:p:`Teeter2018`)
154asc_r double vector Current fraction following spike
155 coefficients for fj in Equation (7)
156 in :footcite:p:`Teeter2018`
157th_voltage_index double Adaptation index of threshold - A
158 'leak-conductance' for the
159 voltage-dependent component of the
160 threshold in 1/ms (av in Equation
161 (4) in :footcite:p:`Teeter2018`)
162th_voltage_decay double Voltage-induced threshold time
163 constant - Inverse of which is the
164 time constant of the
165 voltage-dependent component of the
166 threshold in 1/ms (bv in Equation
167 (4) in :footcite:p:`Teeter2018`)
168tau_syn double vector Time constants of the synaptic
169 alpha function in ms
170E_rev double vector Reversal potential in mV
171spike_dependent_threshold bool flag whether the neuron has
172 biologically defined reset rules
173 with a spike dependent threshold
174 component
175after_spike_currents bool flag whether the neuron has after
176 spike currents
177adapting_threshold bool flag whether the neuron has a
178 voltage dependent threshold component
179========================= =============== =====================================
180
181References
182++++++++++
183
184.. footbibliography::
185
186See also
187++++++++
188
189gif_psc_exp_multisynapse, gif_cond_exp, gif_cond_exp_multisynapse, gif_pop_psc_exp,
190glif_psc_double_alpha
191
192Examples using this model
193+++++++++++++++++++++++++
194
195.. listexamples:: glif_psc
196
197EndUserDocs */
198
199namespace nest
200{
201
202void register_glif_psc( const std::string& name );
203
205{
206public:
207 glif_psc();
208
209 glif_psc( const glif_psc& );
210
211 using Node::handle;
213
214 size_t send_test_event( Node&, size_t, synindex, bool ) override;
215
216 void handle( SpikeEvent& ) override;
217 void handle( CurrentEvent& ) override;
218 void handle( DataLoggingRequest& ) override;
219
220 size_t handles_test_event( SpikeEvent&, size_t ) override;
221 size_t handles_test_event( CurrentEvent&, size_t ) override;
222 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
223
224 void get_status( Dictionary& ) const override;
225 void set_status( const Dictionary& ) override;
226
227private:
229 void init_buffers_() override;
230
232 void pre_run_hook() override;
233
235 void update( Time const&, const long, const long ) override;
236
237 // The next two classes need to be friends to access the State_ class/member
238 friend class RecordablesMap< glif_psc >;
239 friend class UniversalDataLogger< glif_psc >;
240
242 {
243 double G_;
244 double E_L_;
245 double th_inf_;
246 double C_m_;
247 double t_ref_;
248 double V_reset_;
257 std::vector< double > asc_init_;
258 std::vector< double > asc_decay_;
259 std::vector< double > asc_amps_;
260 std::vector< double > asc_r_;
261 std::vector< double > tau_syn_;
262
265
268
271
274
275 size_t n_receptors_() const;
276
277 Parameters_();
278
279 void get( Dictionary& ) const;
280 double set( const Dictionary&, Node* );
281 };
282
283 struct State_
284 {
285 double U_;
286 double threshold_;
289 double I_;
290 double I_syn_;
291 std::vector< double > ASCurrents_;
294 std::vector< double > y1_;
295 std::vector< double > y2_;
296
297 State_( const Parameters_& );
298
299 void get( Dictionary&, const Parameters_& ) const;
300 void set( const Dictionary&, const Parameters_&, double, Node* );
301 };
302
303
304 struct Buffers_
305 {
306 Buffers_( glif_psc& );
307 Buffers_( const Buffers_&, glif_psc& );
308
309 std::vector< RingBuffer > spikes_;
311
314 };
315
317 {
324 std::vector< double > asc_decay_rates_;
325 std::vector< double > asc_stable_coeff_;
326 std::vector< double > asc_refractory_decay_rates_;
327 double phi;
328
329 std::vector< double > P11_;
330 std::vector< double > P21_;
331 std::vector< double > P22_;
332 double P30_;
333 double P33_;
334 std::vector< double > P31_;
335 std::vector< double > P32_;
336
341 std::vector< double > PSCInitialValues_;
342 };
343
344 double
345 get_V_m_() const
346 {
347 return S_.U_ + P_.E_L_;
348 }
349
350 double
352 {
353 return S_.ASCurrents_sum_;
354 }
355
356 double
357 get_I_() const
358 {
359 return S_.I_;
360 }
361
362 double
364 {
365 return S_.I_syn_;
366 }
367
368 double
370 {
371 return S_.threshold_ + P_.E_L_;
372 }
373
374 double
376 {
377 return S_.threshold_spike_;
378 }
379
380 double
382 {
383 return S_.threshold_voltage_;
384 }
385
390
393};
394
395
396inline size_t
398{
399 return tau_syn_.size();
400}
401
402inline size_t
403glif_psc::send_test_event( Node& target, size_t receptor_type, synindex, bool )
404{
405 SpikeEvent e;
406 e.set_sender( *this );
407 return target.handles_test_event( e, receptor_type );
408}
409
410inline size_t
412{
413 if ( receptor_type != 0 )
414 {
415 throw UnknownReceptorType( receptor_type, get_name() );
416 }
417 return 0;
418}
419
420inline size_t
422{
423 if ( receptor_type != 0 )
424 {
425 throw UnknownReceptorType( receptor_type, get_name() );
426 }
427 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
428}
429
430inline void
432{
433 // get our own parameter and state data
434 P_.get( d );
435 S_.get( d, P_ );
436
437 // get information managed by parent class
439
440 d[ names::recordables ] = recordablesMap_.get_list();
441}
442
443inline void
445{
446 Parameters_ ptmp = P_; // temporary copy in case of errors
447 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
448 State_ stmp = S_; // temporary copy in case of errors
449 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
450
452
453 // if we get here, temporaries contain consistent set of properties
454 P_ = ptmp;
455 S_ = stmp;
456}
457
458} // namespace nest
459
460#endif
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
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 glif_psc.h:205
double get_I_() const
Definition glif_psc.h:357
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition glif_psc.h:444
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition glif_psc.h:403
Buffers_ B_
Definition glif_psc.h:389
void pre_run_hook() override
Initialize auxiliary quantities, leave parameters and state untouched.
Definition glif_psc.cpp:390
double get_V_m_() const
Definition glif_psc.h:345
glif_psc()
Definition glif_psc.cpp:360
Parameters_ P_
Definition glif_psc.h:386
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition glif_psc.h:431
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition glif_psc.cpp:606
double get_I_syn_() const
Definition glif_psc.h:363
double get_ASCurrents_sum_() const
Definition glif_psc.h:351
double get_threshold_voltage_() const
Definition glif_psc.h:381
static RecordablesMap< glif_psc > recordablesMap_
Mapping of recordables names to access functions.
Definition glif_psc.h:392
State_ S_
Definition glif_psc.h:387
void update(Time const &, const long, const long) override
Take neuron through given time interval.
Definition glif_psc.cpp:464
Variables_ V_
Definition glif_psc.h:388
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition glif_psc.cpp:594
double get_threshold_() const
Definition glif_psc.h:369
double get_threshold_spike_() const
Definition glif_psc.h:375
void init_buffers_() override
Reset internal buffers of neuron.
Definition glif_psc.cpp:382
friend class UniversalDataLogger< glif_psc >
Definition glif_psc.h:239
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_glif_psc(const std::string &name)
Definition glif_psc.cpp:43
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Definition glif_psc.h:305
std::vector< RingBuffer > spikes_
Buffer incoming spikes through delay, as sum.
Definition glif_psc.h:309
RingBuffer currents_
Buffer incoming currents through delay,.
Definition glif_psc.h:310
UniversalDataLogger< glif_psc > logger_
Logger for all analog data.
Definition glif_psc.h:313
Definition glif_psc.h:242
std::vector< double > asc_decay_
predefined time scale in 1/ms
Definition glif_psc.h:258
std::vector< double > asc_amps_
in pA
Definition glif_psc.h:259
Parameters_()
Definition glif_psc.cpp:67
std::vector< double > asc_r_
coefficient
Definition glif_psc.h:260
double voltage_reset_fraction_
voltage fraction following reset coefficient
Definition glif_psc.h:251
bool has_asc_
boolean flag which indicates whether the neuron has after spike currents
Definition glif_psc.h:270
double th_spike_add_
threshold additive constant following reset in mV
Definition glif_psc.h:249
double G_
membrane conductance in nS
Definition glif_psc.h:243
std::vector< double > tau_syn_
synaptic port time constants in ms
Definition glif_psc.h:261
double th_voltage_index_
a 'leak-conductance' for the voltage-dependent component of the threshold in 1/ms
Definition glif_psc.h:253
double th_inf_
infinity threshold in mV
Definition glif_psc.h:245
size_t n_receptors_() const
Returns the size of tau_syn_.
Definition glif_psc.h:397
double C_m_
capacitance in pF
Definition glif_psc.h:246
double V_reset_
Membrane voltage following spike in mV.
Definition glif_psc.h:248
bool has_theta_voltage_
boolean flag which indicates whether the neuron has voltage dependent threshold component
Definition glif_psc.h:273
bool has_connections_
boolean flag which indicates whether the neuron has connections
Definition glif_psc.h:264
double th_spike_decay_
spike induced threshold in 1/ms
Definition glif_psc.h:250
double set(const Dictionary &, Node *)
Definition glif_psc.cpp:145
std::vector< double > asc_init_
initial values of ASCurrents_ in pA
Definition glif_psc.h:257
double voltage_reset_add_
voltage additive constant following reset in mV
Definition glif_psc.h:252
void get(Dictionary &) const
Definition glif_psc.cpp:116
double th_voltage_decay_
inverse of which is the time constant of the voltage-dependent component of the threshold in 1/ms
Definition glif_psc.h:255
bool has_theta_spike_
boolean flag which indicates whether the neuron has spike dependent threshold component
Definition glif_psc.h:267
double t_ref_
refractory time in ms
Definition glif_psc.h:247
double E_L_
resting potential in mV
Definition glif_psc.h:244
Definition glif_psc.h:284
std::vector< double > y1_
synapse current evolution state 1 in pA
Definition glif_psc.h:294
double threshold_voltage_
voltage component of threshold in mV
Definition glif_psc.h:288
void get(Dictionary &, const Parameters_ &) const
Definition glif_psc.cpp:299
double U_
relative membrane potential in mV
Definition glif_psc.h:285
std::vector< double > ASCurrents_
after-spike currents in pA
Definition glif_psc.h:291
double I_syn_
postsynaptic current in pA
Definition glif_psc.h:290
std::vector< double > y2_
synapse current evolution state 2 in pA
Definition glif_psc.h:295
double I_
external current in pA
Definition glif_psc.h:289
void set(const Dictionary &, const Parameters_ &, double, Node *)
Definition glif_psc.cpp:308
double threshold_spike_
spike component of threshold in mV
Definition glif_psc.h:287
double ASCurrents_sum_
in pA
Definition glif_psc.h:292
double threshold_
total threshold in mV
Definition glif_psc.h:286
int refractory_steps_
Number of refractory steps remaining.
Definition glif_psc.h:293
Definition glif_psc.h:317
double theta_spike_refractory_decay_rate_
threshold spike component decay rate during refractory
Definition glif_psc.h:320
std::vector< double > asc_refractory_decay_rates_
after spike current decay rates during refractory
Definition glif_psc.h:326
std::vector< double > P32_
synaptic/membrane current evolution parameter
Definition glif_psc.h:335
double theta_voltage_decay_rate_inverse_
inverse of threshold voltage component decay rate
Definition glif_psc.h:321
int RefractoryCounts_
counter during refractory period
Definition glif_psc.h:318
std::vector< double > asc_stable_coeff_
after spike current stable coefficient
Definition glif_psc.h:325
double P33_
membrane voltage evolution parameter
Definition glif_psc.h:333
std::vector< double > P22_
synaptic current evolution parameter
Definition glif_psc.h:331
std::vector< double > P31_
synaptic/membrane current evolution parameter
Definition glif_psc.h:334
std::vector< double > asc_decay_rates_
after spike current decay rates
Definition glif_psc.h:324
std::vector< double > P21_
synaptic current evolution parameter
Definition glif_psc.h:330
double abpara_ratio_voltage_
ratio of parameters of voltage threshold component av/bv
Definition glif_psc.h:323
double potential_decay_rate_
membrane potential decay rate
Definition glif_psc.h:322
double phi
threshold voltage component coefficient
Definition glif_psc.h:327
double theta_spike_decay_rate_
threshold spike component decay rate
Definition glif_psc.h:319
std::vector< double > PSCInitialValues_
Amplitude of the synaptic current.
Definition glif_psc.h:341
std::vector< double > P11_
synaptic current evolution parameter
Definition glif_psc.h:329
double P30_
membrane current/voltage evolution parameter
Definition glif_psc.h:332