NEST main@f146f75
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
84.. note::
85
86 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
87 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
88 the inhibitory one, and also sets the direction of the post-synaptic current.
89 Spike connections must use the default ``receptor_type`` of 0.
90
91 See :ref:`synapse_selection` for the conventions used by other models.
92
93Parameters
94++++++++++
95
96The following parameters can be set in the status dictionary:
97
98============ ======= ========================================================
99 C_m pF Capacity of the membrane
100 E_L mV Resting potential
101 tau_m ms Membrane time constant
102 tau_syn_ex ms Time constant of postsynaptic excitatory currents
103 tau_syn_in ms Time constant of postsynaptic inhibitory currents
104 t_ref ms Duration of absolute refractory period (no spiking)
105 V_m mV Membrane potential
106 I_e pA Constant input current
107 t_spike ms Point in time of last spike
108 tau_1 ms Short time constant of adaptive threshold
109 tau_2 ms Long time constant of adaptive threshold
110 alpha_1 mV Amplitude of short time threshold adaption :footcite:p:`Kobayashi2009`
111 alpha_2 mV Amplitude of long time threshold adaption :footcite:p:`Kobayashi2009`
112 omega mV Resting spike threshold (absolute value, not
113 relative to E_L as in :footcite:p:`Kobayashi2009`)
114============ ======= ========================================================
115
116The following state variables can be read out with the multimeter device:
117
118====== ==== =================================
119 V_m mV Non-resetting membrane potential
120 V_th mV Two-timescale adaptive threshold
121====== ==== =================================
122
123Remarks:
124
125tau_m != tau_syn_{ex,in} is required by the current implementation to avoid a
126degenerate case of the ODE describing the model :footcite:p:`Rotter1999`. For very similar values,
127numerics will be unstable.
128
129References
130++++++++++
131
132.. footbibliography::
133
134Sends
135+++++
136
137SpikeEvent
138
139Receives
140++++++++
141
142SpikeEvent, CurrentEvent, DataLoggingRequest
143
144Examples using this model
145+++++++++++++++++++++++++
146
147.. listexamples:: mat2_psc_exp
148
149EndUserDocs */
150
159
160void register_mat2_psc_exp( const std::string& name );
161
163{
164
165public:
166 mat2_psc_exp();
167 mat2_psc_exp( const mat2_psc_exp& );
168
174 using Node::handle;
176
177 size_t send_test_event( Node&, size_t, synindex, bool ) override;
178
179 size_t handles_test_event( SpikeEvent&, size_t ) override;
180 size_t handles_test_event( CurrentEvent&, size_t ) override;
181 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
182
183 void handle( SpikeEvent& ) override;
184 void handle( CurrentEvent& ) override;
185 void handle( DataLoggingRequest& ) override;
186
187 void get_status( Dictionary& ) const override;
188 void set_status( const Dictionary& ) override;
189
190private:
191 void init_buffers_() override;
192 void pre_run_hook() override;
193 void update( Time const&, const long, const long ) override;
194
195 // The next two classes need to be friends to access private members
196 friend class RecordablesMap< mat2_psc_exp >;
197 friend class UniversalDataLogger< mat2_psc_exp >;
198
199 // ----------------------------------------------------------------
200
205 {
207 double Tau_;
208
210 double C_;
211
213 double tau_ref_;
214
216 double E_L_;
217
219 double I_e_;
220
222 double tau_ex_;
223
225 double tau_in_;
226
228 double tau_1_;
229 double tau_2_;
230
232 double alpha_1_;
233 double alpha_2_;
234
239 double omega_;
240
241 Parameters_();
242
243 void get( Dictionary& ) const;
244
248 double set( const Dictionary&, Node* node );
249 };
250
251 // ----------------------------------------------------------------
252
256 struct State_
257 {
258 // state variables
259 double i_0_;
260 double i_syn_ex_;
261 double i_syn_in_;
262 double V_m_;
264 double V_th_1_;
266 double V_th_2_;
267
268 int r_;
269
270 State_();
271
272 void get( Dictionary&, const Parameters_& ) const;
273
279 void set( const Dictionary&, const Parameters_&, double, Node* );
280 };
281
282 // ----------------------------------------------------------------
283
300
301 // ----------------------------------------------------------------
302
307 {
308
314 // double PSCInitialValue_;
315
316 // time evolution operator of membrane potential
317 double P20_; // constant currents
318 double P11ex_;
319 double P11in_;
320 double P21ex_;
321 double P21in_;
323
324 // time evolution operator of dynamic threshold
325 // P = ( exp(-h/tau_1) 0 )
326 // ( 0 exp(-h/tau_2) )
327 double P11th_;
328 double P22th_;
329
331 };
332 // ----------------------------------------------------------------
333
335 double
336 get_V_m_() const
337 {
338 return S_.V_m_ + P_.E_L_;
339 }
340 double
341 get_V_th_() const
342 {
343 return P_.E_L_ + P_.omega_ + S_.V_th_1_ + S_.V_th_2_;
344 }
345
346 // ----------------------------------------------------------------
347
359
362};
363
364
365inline size_t
366mat2_psc_exp::send_test_event( Node& target, size_t receptor_type, synindex, bool )
367{
368 SpikeEvent e;
369 e.set_sender( *this );
370
371 return target.handles_test_event( e, receptor_type );
372}
373
374
375inline size_t
377{
378 if ( receptor_type != 0 )
379 {
380 throw UnknownReceptorType( receptor_type, get_name() );
381 }
382 return 0;
383}
384
385inline size_t
387{
388 if ( receptor_type != 0 )
389 {
390 throw UnknownReceptorType( receptor_type, get_name() );
391 }
392 return 0;
393}
394
395inline size_t
397{
398 if ( receptor_type != 0 )
399 {
400 throw UnknownReceptorType( receptor_type, get_name() );
401 }
402 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
403}
404
405inline void
407{
408 P_.get( d );
409 S_.get( d, P_ );
411
412 d[ names::recordables ] = recordablesMap_.get_list();
413}
414
415inline void
417{
418 Parameters_ ptmp = P_; // temporary copy in case of errors
419 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
420 State_ stmp = S_; // temporary copy in case of errors
421 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
422
423 // We now know that (ptmp, stmp) are consistent. We do not
424 // write them back to (P_, S_) before we are also sure that
425 // the properties to be set in the parent class are internally
426 // consistent.
428
429 // if we get here, temporaries contain consistent set of properties
430 P_ = ptmp;
431 S_ = stmp;
432}
433
434} // namespace
435
436#endif // MAT2_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
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition mat2_psc_exp.h:354
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:197
friend class RecordablesMap< mat2_psc_exp >
Definition mat2_psc_exp.h:196
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:376
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:336
Buffers_ B_
Definition mat2_psc_exp.h:357
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition mat2_psc_exp.h:416
Variables_ V_
Definition mat2_psc_exp.h:356
double get_V_th_() const
Definition mat2_psc_exp.h:341
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:366
static RecordablesMap< mat2_psc_exp > recordablesMap_
Mapping of recordables names to access functions.
Definition mat2_psc_exp.h:361
State_ S_
Definition mat2_psc_exp.h:355
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:406
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_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:121
Buffers of the model.
Definition mat2_psc_exp.h:288
UniversalDataLogger< mat2_psc_exp > logger_
Logger for all analog data.
Definition mat2_psc_exp.h:298
RingBuffer spikes_in_
Definition mat2_psc_exp.h:294
RingBuffer spikes_ex_
buffers and sums up incoming spikes/currents
Definition mat2_psc_exp.h:293
RingBuffer currents_
Definition mat2_psc_exp.h:295
Buffers_(mat2_psc_exp &)
Sets buffer pointers to 0.
Definition mat2_psc_exp.cpp:189
Independent parameters of the model.
Definition mat2_psc_exp.h:205
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:222
Parameters_()
Sets default parameter values.
Definition mat2_psc_exp.cpp:68
double tau_ref_
Refractory period in ms.
Definition mat2_psc_exp.h:213
double tau_1_
Short and long time constant of adaptive threshold.
Definition mat2_psc_exp.h:228
double E_L_
Resting potential in mV.
Definition mat2_psc_exp.h:216
double alpha_2_
Definition mat2_psc_exp.h:233
double tau_in_
Time constant of inhibitory synaptic current in ms.
Definition mat2_psc_exp.h:225
double omega_
Resting threshold in mV (relative to resting potential).
Definition mat2_psc_exp.h:239
double alpha_1_
Amplitudes of threshold adaption.
Definition mat2_psc_exp.h:232
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:207
double I_e_
External current in pA.
Definition mat2_psc_exp.h:219
double tau_2_
Definition mat2_psc_exp.h:229
double C_
Membrane capacitance in pF.
Definition mat2_psc_exp.h:210
State variables of the model.
Definition mat2_psc_exp.h:257
double V_th_2_
long time adaptive threshold (related to tau_2_), variable 2
Definition mat2_psc_exp.h:266
double V_m_
Definition mat2_psc_exp.h:262
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:261
double V_th_1_
short time adaptive threshold (related to tau_1_), variable 1
Definition mat2_psc_exp.h:264
int r_
total refractory counter (no spikes can be generated)
Definition mat2_psc_exp.h:268
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:259
double i_syn_ex_
postsynaptic current for exc. inputs, variable 1
Definition mat2_psc_exp.h:260
Internal variables of the model.
Definition mat2_psc_exp.h:307
double P11th_
Definition mat2_psc_exp.h:327
double P22_expm1_
Definition mat2_psc_exp.h:322
double P21ex_
Definition mat2_psc_exp.h:320
double P11in_
Definition mat2_psc_exp.h:319
double P22th_
Definition mat2_psc_exp.h:328
int RefractoryCountsTot_
Definition mat2_psc_exp.h:330
double P20_
Amplitude of the synaptic current.
Definition mat2_psc_exp.h:317
double P21in_
Definition mat2_psc_exp.h:321
double P11ex_
Definition mat2_psc_exp.h:318