NEST main@caf0ae8
 
Loading...
Searching...
No Matches
mat2_psc_exp.h
Go to the documentation of this file.
1/*
2 * mat2_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
24#ifndef MAT2_PSC_EXP_H
25#define MAT2_PSC_EXP_H
26
27// Includes from nestkernel:
28#include "archiving_node.h"
29#include "connection.h"
30#include "event.h"
31#include "nest_types.h"
32#include "recordables_map.h"
33#include "ring_buffer.h"
35
36namespace nest
37{
38
39/* BeginUserDocs: neuron, integrate-and-fire, current-based, adaptation, hard threshold
40
41Short description
42+++++++++++++++++
43
44Non-resetting leaky integrate-and-fire neuron model with exponential PSCs and adaptive threshold
45
46Description
47+++++++++++
48
49``mat2_psc_exp`` is an implementation of a leaky integrate-and-fire model
50with exponential shaped postsynaptic currents (PSCs). Thus, postsynaptic
51currents have an infinitely short rise time.
52
53The threshold is lifted when the neuron is fired and then decreases in a
54fixed time scale toward a fixed level :footcite:p:`Kobayashi2009`.
55
56The threshold crossing is followed by a total refractory period
57during which the neuron is not allowed to fire, even if the membrane
58potential exceeds the threshold. The membrane potential is NOT reset,
59but continuously integrated.
60
61The linear subthreshold dynamics is integrated by the Exact
62Integration scheme :footcite:p:`Rotter1999`. The neuron dynamics is solved on the time
63grid given by the computation step size. Incoming as well as emitted
64spikes are forced to that grid.
65
66An additional state variable and the corresponding differential
67equation represents a piecewise constant external current.
68
69The general framework for the consistent formulation of systems with
70neuron like dynamics interacting by point events is described in
71:footcite:p:`Rotter1999`. A flow chart can be found in :footcite:p:`Diesmann2001`.
72
73The current implementation requires tau_m != tau_syn_{ex,in} to avoid
74a degenerate case of the ODE describing the model :footcite:p:`Rotter1999`. For very
75similar values, numerics will be unstable.
76
77The following state variables can be read out with the multimeter device:
78
79====== ==== =================================
80 V_m mV Non-resetting membrane potential
81 V_th mV Two-timescale adaptive threshold
82====== ==== =================================
83
84Parameters
85++++++++++
86
87The following parameters can be set in the status dictionary:
88
89============ ======= ========================================================
90 C_m pF Capacity of the membrane
91 E_L mV Resting potential
92 tau_m ms Membrane time constant
93 tau_syn_ex ms Time constant of postsynaptic excitatory currents
94 tau_syn_in ms Time constant of postsynaptic inhibitory currents
95 t_ref ms Duration of absolute refractory period (no spiking)
96 V_m mV Membrane potential
97 I_e pA Constant input current
98 t_spike ms Point in time of last spike
99 tau_1 ms Short time constant of adaptive threshold
100 tau_2 ms Long time constant of adaptive threshold
101 alpha_1 mV Amplitude of short time threshold adaption :footcite:p:`Kobayashi2009`
102 alpha_2 mV Amplitude of long time threshold adaption :footcite:p:`Kobayashi2009`
103 omega mV Resting spike threshold (absolute value, not
104 relative to E_L as in :footcite:p:`Kobayashi2009`)
105============ ======= ========================================================
106
107The following state variables can be read out with the multimeter device:
108
109====== ==== =================================
110 V_m mV Non-resetting membrane potential
111 V_th mV Two-timescale adaptive threshold
112====== ==== =================================
113
114Remarks:
115
116tau_m != tau_syn_{ex,in} is required by the current implementation to avoid a
117degenerate case of the ODE describing the model :footcite:p:`Rotter1999`. For very similar values,
118numerics will be unstable.
119
120References
121++++++++++
122
123.. footbibliography::
124
125Sends
126+++++
127
128SpikeEvent
129
130Receives
131++++++++
132
133SpikeEvent, CurrentEvent, DataLoggingRequest
134
135Examples using this model
136+++++++++++++++++++++++++
137
138.. listexamples:: mat2_psc_exp
139
140EndUserDocs */
141
151void register_mat2_psc_exp( const std::string& name );
152
154{
155
156public:
157 mat2_psc_exp();
158 mat2_psc_exp( const mat2_psc_exp& );
159
165 using Node::handle;
167
168 size_t send_test_event( Node&, size_t, synindex, bool ) override;
169
170 size_t handles_test_event( SpikeEvent&, size_t ) override;
171 size_t handles_test_event( CurrentEvent&, size_t ) override;
172 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
173
174 void handle( SpikeEvent& ) override;
175 void handle( CurrentEvent& ) override;
176 void handle( DataLoggingRequest& ) override;
177
178 void get_status( Dictionary& ) const override;
179 void set_status( const Dictionary& ) override;
180
181private:
182 void init_buffers_() override;
183 void pre_run_hook() override;
184 void update( Time const&, const long, const long ) override;
185
186 // The next two classes need to be friends to access private members
187 friend class RecordablesMap< mat2_psc_exp >;
188 friend class UniversalDataLogger< mat2_psc_exp >;
189
190 // ----------------------------------------------------------------
191
196 {
198 double Tau_;
199
201 double C_;
202
204 double tau_ref_;
205
207 double E_L_;
208
210 double I_e_;
211
213 double tau_ex_;
214
216 double tau_in_;
217
219 double tau_1_;
220 double tau_2_;
221
223 double alpha_1_;
224 double alpha_2_;
225
230 double omega_;
231
232 Parameters_();
233
234 void get( Dictionary& ) const;
235
239 double set( const Dictionary&, Node* node );
240 };
241
242 // ----------------------------------------------------------------
243
247 struct State_
248 {
249 // state variables
250 double i_0_;
251 double i_syn_ex_;
252 double i_syn_in_;
253 double V_m_;
255 double V_th_1_;
257 double V_th_2_;
258
259 int r_;
260
261 State_();
262
263 void get( Dictionary&, const Parameters_& ) const;
264
270 void set( const Dictionary&, const Parameters_&, double, Node* );
271 };
272
273 // ----------------------------------------------------------------
274
291
292 // ----------------------------------------------------------------
293
298 {
299
305 // double PSCInitialValue_;
306
307 // time evolution operator of membrane potential
308 double P20_; // constant currents
309 double P11ex_;
310 double P11in_;
311 double P21ex_;
312 double P21in_;
314
315 // time evolution operator of dynamic threshold
316 // P = ( exp(-h/tau_1) 0 )
317 // ( 0 exp(-h/tau_2) )
318 double P11th_;
319 double P22th_;
320
322 };
323 // ----------------------------------------------------------------
324
326 double
327 get_V_m_() const
328 {
329 return S_.V_m_ + P_.E_L_;
330 }
331 double
332 get_V_th_() const
333 {
334 return P_.E_L_ + P_.omega_ + S_.V_th_1_ + S_.V_th_2_;
335 }
336
337 // ----------------------------------------------------------------
338
353};
354
355
356inline size_t
357mat2_psc_exp::send_test_event( Node& target, size_t receptor_type, synindex, bool )
358{
359 SpikeEvent e;
360 e.set_sender( *this );
361
362 return target.handles_test_event( e, receptor_type );
363}
364
365
366inline size_t
368{
369 if ( receptor_type != 0 )
370 {
371 throw UnknownReceptorType( receptor_type, get_name() );
372 }
373 return 0;
374}
375
376inline size_t
378{
379 if ( receptor_type != 0 )
380 {
381 throw UnknownReceptorType( receptor_type, get_name() );
382 }
383 return 0;
384}
385
386inline size_t
388{
389 if ( receptor_type != 0 )
390 {
391 throw UnknownReceptorType( receptor_type, get_name() );
392 }
393 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
394}
395
396inline void
398{
399 P_.get( d );
400 S_.get( d, P_ );
402
403 d[ names::recordables ] = recordablesMap_.get_list();
404}
405
406inline void
408{
409 Parameters_ ptmp = P_; // temporary copy in case of errors
410 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
411 State_ stmp = S_; // temporary copy in case of errors
412 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
413
414 // We now know that (ptmp, stmp) are consistent. We do not
415 // write them back to (P_, S_) before we are also sure that
416 // the properties to be set in the parent class are internally
417 // consistent.
419
420 // if we get here, temporaries contain consistent set of properties
421 P_ = ptmp;
422 S_ = stmp;
423}
424
425} // namespace
426
427#endif // MAT2_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
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 mat2_psc_exp.h:154
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition mat2_psc_exp.h:345
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition mat2_psc_exp.cpp:241
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition mat2_psc_exp.cpp:360
friend class UniversalDataLogger< mat2_psc_exp >
Definition mat2_psc_exp.h:188
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition mat2_psc_exp.h:367
mat2_psc_exp()
Definition mat2_psc_exp.cpp:207
double get_V_m_() const
Read out state variables, used by UniversalDataLogger.
Definition mat2_psc_exp.h:327
Buffers_ B_
Definition mat2_psc_exp.h:348
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition mat2_psc_exp.h:407
Variables_ V_
Definition mat2_psc_exp.h:347
double get_V_th_() const
Definition mat2_psc_exp.h:332
void init_buffers_() override
Configure persistent internal data structures.
Definition mat2_psc_exp.cpp:229
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition mat2_psc_exp.h:357
static RecordablesMap< mat2_psc_exp > recordablesMap_
Mapping of recordables names to access functions.
Definition mat2_psc_exp.h:352
State_ S_
Definition mat2_psc_exp.h:346
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition mat2_psc_exp.cpp:307
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition mat2_psc_exp.h:397
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_mat2_psc_exp(const std::string &name)
The present implementation uses individual variables for the components of the state vector and the n...
Definition mat2_psc_exp.cpp:46
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition mat2_psc_exp.h:279
UniversalDataLogger< mat2_psc_exp > logger_
Logger for all analog data.
Definition mat2_psc_exp.h:289
RingBuffer spikes_in_
Definition mat2_psc_exp.h:285
RingBuffer spikes_ex_
buffers and sums up incoming spikes/currents
Definition mat2_psc_exp.h:284
RingBuffer currents_
Definition mat2_psc_exp.h:286
Independent parameters of the model.
Definition mat2_psc_exp.h:196
void get(Dictionary &) const
Store current values in dictionary.
Definition mat2_psc_exp.cpp:102
double tau_ex_
Time constant of excitatory synaptic current in ms.
Definition mat2_psc_exp.h:213
Parameters_()
Sets default parameter values.
Definition mat2_psc_exp.cpp:68
double tau_ref_
Refractory period in ms.
Definition mat2_psc_exp.h:204
double tau_1_
Short and long time constant of adaptive threshold.
Definition mat2_psc_exp.h:219
double E_L_
Resting potential in mV.
Definition mat2_psc_exp.h:207
double alpha_2_
Definition mat2_psc_exp.h:224
double tau_in_
Time constant of inhibitory synaptic current in ms.
Definition mat2_psc_exp.h:216
double omega_
Resting threshold in mV (relative to resting potential).
Definition mat2_psc_exp.h:230
double alpha_1_
Amplitudes of threshold adaption.
Definition mat2_psc_exp.h:223
double set(const Dictionary &, Node *node)
Set values from dictionary.
Definition mat2_psc_exp.cpp:119
double Tau_
Membrane time constant in ms.
Definition mat2_psc_exp.h:198
double I_e_
External current in pA.
Definition mat2_psc_exp.h:210
double tau_2_
Definition mat2_psc_exp.h:220
double C_
Membrane capacitance in pF.
Definition mat2_psc_exp.h:201
State variables of the model.
Definition mat2_psc_exp.h:248
double V_th_2_
long time adaptive threshold (related to tau_2_), variable 2
Definition mat2_psc_exp.h:257
double V_m_
membrane potential, variable 2
Definition mat2_psc_exp.h:253
void get(Dictionary &, const Parameters_ &) const
Definition mat2_psc_exp.cpp:165
double i_syn_in_
postsynaptic current for inh. inputs, variable 1
Definition mat2_psc_exp.h:252
double V_th_1_
short time adaptive threshold (related to tau_1_), variable 1
Definition mat2_psc_exp.h:255
int r_
total refractory counter (no spikes can be generated)
Definition mat2_psc_exp.h:259
State_()
Default initialization.
Definition mat2_psc_exp.cpp:86
void set(const Dictionary &, const Parameters_ &, double, Node *)
Set values from dictionary.
Definition mat2_psc_exp.cpp:174
double i_0_
synaptic dc input current, variable 0
Definition mat2_psc_exp.h:250
double i_syn_ex_
postsynaptic current for exc. inputs, variable 1
Definition mat2_psc_exp.h:251
Internal variables of the model.
Definition mat2_psc_exp.h:298
double P11th_
Definition mat2_psc_exp.h:318
double P22_expm1_
Definition mat2_psc_exp.h:313
double P21ex_
Definition mat2_psc_exp.h:311
double P11in_
Definition mat2_psc_exp.h:310
double P22th_
Definition mat2_psc_exp.h:319
int RefractoryCountsTot_
Definition mat2_psc_exp.h:321
double P20_
Amplitude of the synaptic current.
Definition mat2_psc_exp.h:308
double P21in_
Definition mat2_psc_exp.h:312
double P11ex_
Definition mat2_psc_exp.h:309