NEST main@caf0ae8
 
Loading...
Searching...
No Matches
iaf_psc_alpha_ps.h
Go to the documentation of this file.
1/*
2 * iaf_psc_alpha_ps.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 IAF_PSC_ALPHA_PS_H
24#define IAF_PSC_ALPHA_PS_H
25
26// C++ includes:
27#include <vector>
28
29// Generated includes:
30#include "config.h"
31
32// Includes from libnestutil:
33#include "archiving_node.h"
34#include "connection.h"
35#include "event.h"
36#include "iaf_propagator.h"
37#include "nest_types.h"
38#include "ring_buffer.h"
39#include "slice_ring_buffer.h"
41
42namespace nest
43{
44
45/* BeginUserDocs: neuron, integrate-and-fire, current-based, precise, hard threshold
46
47Short description
48+++++++++++++++++
49
50Current-based leaky integrate-and-fire neuron with alpha-shaped
51postsynaptic currents using regula falsi method for approximation of
52threshold crossing
53
54Description
55+++++++++++
56
57.. versionadded:: 2.18
58
59``iaf_psc_alpha_ps`` is the "canonical" implementation of the leaky
60integrate-and-fire model neuron with alpha-shaped postsynaptic
61currents in the sense of :footcite:p:`Morrison2007a`. This is the most exact implementation
62available.
63
64PSCs are normalized to an amplitude of 1pA.
65
66The precise implementation handles neuronal dynamics in a locally
67event-based manner with in coarse time grid defined by the minimum
68delay in the network, see :footcite:p:`Morrison2007a`. Incoming spikes are applied at the
69precise moment of their arrival, while the precise time of outgoing
70spikes is determined by a Regula Falsi method to approximate the timing
71of a threshold crossing :footcite:p:`Morrison2007a` :footcite:p:`Hanuschkin2010`. Return from refractoriness occurs
72precisely at spike time plus refractory period.
73
74This implementation is more complex than the plain iaf_psc_alpha
75neuron, but achieves much higher precision. In particular, it does not
76suffer any binning of spike times to grid points. Depending on your
77application, the canonical application may provide superior overall
78performance given an accuracy goal; see :footcite:p:`Morrison2007a` for details. Subthreshold
79dynamics are integrated using exact integration between events :footcite:p:`Rotter1999`.
80
81This model transmits precise spike times to target nodes (on-grid spike
82time and offset). If this node is connected to a spike_recorder, the
83property "precise_times" of the spike_recorder has to be set to true in
84order to record the offsets in addition to the on-grid spike times.
85
86The iaf_psc_alpha_ps neuron accepts connections transmitting
87CurrentEvents. These events transmit stepwise-constant currents which
88can only change at on-grid times.
89
90.. note::
91
92 If `tau_m` is very close to `tau_syn_ex` or `tau_syn_in`, the model
93 will numerically behave as if `tau_m` is equal to `tau_syn_ex` or
94 `tau_syn_in`, respectively, to avoid numerical instabilities.
95
96 For implementation details see the
97 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
98
99For details about exact subthreshold integration, please see
100:doc:`../neurons/exact-integration`.
101
102Parameters
103++++++++++
104
105The following parameters can be set in the status dictionary.
106
107=========== ====== ==========================================================
108 V_m mV Membrane potential
109 E_L mV Resting membrane potential
110 V_min mV Absolute lower value for the membrane potential
111 C_m pF Capacity of the membrane
112 tau_m ms Membrane time constant
113 t_ref ms Duration of refractory period
114 V_th mV Spike threshold
115 V_reset mV Reset potential of the membrane
116 tau_syn_ex ms Rise time of the excitatory synaptic function
117 tau_syn_in ms Rise time of the inhibitory synaptic function
118 I_e pA Constant external input current
119=========== ====== ==========================================================
120
121References
122++++++++++
123
124.. footbibliography::
125
126Sends
127+++++
128
129SpikeEvent
130
131Receives
132++++++++
133
134SpikeEvent, CurrentEvent, DataLoggingRequest
135
136See also
137++++++++
138
139iaf_psc_alpha, iaf_psc_exp_ps
140
141Examples using this model
142+++++++++++++++++++++++++
143
144.. listexamples:: iaf_psc_alpha_ps
145
146EndUserDocs */
147
148void register_iaf_psc_alpha_ps( const std::string& name );
149
151{
152public:
158
167
173 using Node::handle;
175
176 size_t send_test_event( Node&, size_t, synindex, bool ) override;
177
178 size_t handles_test_event( SpikeEvent&, size_t ) override;
179 size_t handles_test_event( CurrentEvent&, size_t ) override;
180 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
181
182 void handle( SpikeEvent& ) override;
183 void handle( CurrentEvent& ) override;
184 void handle( DataLoggingRequest& ) override;
185
186 bool
187 is_off_grid() const override
188 {
189 return true;
190 } // uses off_grid events
191
192 void get_status( Dictionary& ) const override;
193 void set_status( const Dictionary& ) override;
194
204 double threshold_distance( double t_step ) const;
205
206private:
212 void init_buffers_() override;
213 void pre_run_hook() override;
214
215 bool get_next_event_( const long T, double& ev_offset, double& ev_weight, bool& end_of_refract );
216
234 void update( Time const& origin, const long from, const long to ) override;
235
237
243 void propagate_( const double dt );
244
256 void emit_spike_( Time const& origin, const long lag, const double t0, const double dt );
257
266 void emit_instant_spike_( Time const& origin, const long lag, const double spike_offset );
267
271
272 // The next two classes need to be friends to access the State_ class/member
273 friend class RecordablesMap< iaf_psc_alpha_ps >;
274 friend class UniversalDataLogger< iaf_psc_alpha_ps >;
275
276 // ----------------------------------------------------------------
277
282 {
283
285 double tau_m_;
286
290
292 double c_m_;
293
295 double t_ref_;
296
298 double E_L_;
299
301 double I_e_;
302
305 double U_th_;
306
309 double U_min_;
310
315 double U_reset_;
316
317 Parameters_();
318
319 void get( Dictionary& ) const;
320
324 double set( const Dictionary&, Node* );
325 };
326
327 // ----------------------------------------------------------------
328
332 struct State_
333 {
334 double y_input_;
335 double I_ex_;
336 double dI_ex_;
337 double I_in_;
338 double dI_in_;
339 double V_m_;
343
344 State_();
345
346 void get( Dictionary&, const Parameters_& ) const;
347
353 void set( const Dictionary&, const Parameters_&, double, Node* );
354 };
355
356 // ----------------------------------------------------------------
357
376
377 // ----------------------------------------------------------------
378
407
408 // Access functions for UniversalDataLogger -------------------------------
409
411 double
412 get_V_m_() const
413 {
414 return S_.V_m_ + P_.E_L_;
415 }
416
418 double
419 get_I_ex_() const
420 {
421 return S_.I_ex_;
422 }
423
425 double
427 {
428 return S_.dI_ex_;
429 }
430
432 double
433 get_I_in_() const
434 {
435 return S_.I_in_;
436 }
437
439 double
441 {
442 return S_.dI_in_;
443 }
444
445 // ----------------------------------------------------------------
446
461};
462
463inline size_t
464iaf_psc_alpha_ps::send_test_event( Node& target, size_t receptor_type, synindex, bool )
465{
466 SpikeEvent e;
467 e.set_sender( *this );
468 return target.handles_test_event( e, receptor_type );
469}
470
471inline size_t
473{
474 if ( receptor_type != 0 )
475 {
476 throw UnknownReceptorType( receptor_type, get_name() );
477 }
478 return 0;
479}
480
481inline size_t
483{
484 if ( receptor_type != 0 )
485 {
486 throw UnknownReceptorType( receptor_type, get_name() );
487 }
488 return 0;
489}
490
491inline size_t
493{
494 if ( receptor_type != 0 )
495 {
496 throw UnknownReceptorType( receptor_type, get_name() );
497 }
498 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
499}
500
501inline void
503{
504 P_.get( d );
505 S_.get( d, P_ );
507
508 d[ names::recordables ] = recordablesMap_.get_list();
509}
510
511inline void
513{
514 Parameters_ ptmp = P_; // temporary copy in case of errors
515 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
516 State_ stmp = S_; // temporary copy in case of errors
517 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
518
519 // We now know that (ptmp, stmp) are consistent. We do not
520 // write them back to (P_, S_) before we are also sure that
521 // the properties to be set in the parent class are internally
522 // consistent.
524
525 // if we get here, temporaries contain consistent set of properties
526 P_ = ptmp;
527 S_ = stmp;
528}
529
530} // namespace
531
532#endif // IAF_PSC_ALPHA_PS_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Exact integration voltage propagator for models with alpha psc.
Definition iaf_propagator.h:128
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
Queue for all spikes arriving into a neuron.
Definition slice_ring_buffer.h:63
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 iaf_psc_alpha_ps.h:151
IAFPropagatorAlpha propagator_in_
Definition iaf_psc_alpha_ps.h:270
void init_buffers_() override
Configure persistent internal data structures.
Definition iaf_psc_alpha_ps.cpp:251
void emit_instant_spike_(Time const &origin, const long lag, const double spike_offset)
Instantaneously emit a spike at the precise time defined by origin, lag and spike_offset and reset th...
Definition iaf_psc_alpha_ps.cpp:560
static RecordablesMap< iaf_psc_alpha_ps > recordablesMap_
Mapping of recordables names to access functions.
Definition iaf_psc_alpha_ps.h:460
Buffers_ B_
Definition iaf_psc_alpha_ps.h:456
bool get_next_event_(const long T, double &ev_offset, double &ev_weight, bool &end_of_refract)
Definition iaf_psc_alpha_ps.cpp:303
double get_I_in_() const
Read out state variable I_in.
Definition iaf_psc_alpha_ps.h:433
double get_dI_in_() const
Read out state variable derivative of I_ex.
Definition iaf_psc_alpha_ps.h:440
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition iaf_psc_alpha_ps.h:453
void update(Time const &origin, const long from, const long to) override
Time Evolution Operator.
Definition iaf_psc_alpha_ps.cpp:309
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition iaf_psc_alpha_ps.cpp:262
void propagate_(const double dt)
Propagate neuron state.
Definition iaf_psc_alpha_ps.cpp:501
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_alpha_ps.h:502
iaf_psc_alpha_ps()
Basic constructor.
Definition iaf_psc_alpha_ps.cpp:229
double get_I_ex_() const
Read out state variable I_ex.
Definition iaf_psc_alpha_ps.h:419
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition iaf_psc_alpha_ps.h:512
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition iaf_psc_alpha_ps.cpp:464
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition iaf_psc_alpha_ps.h:464
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition iaf_psc_alpha_ps.h:472
double threshold_distance(double t_step) const
Based on the current state, compute the value of the membrane potential after taking a timestep of le...
Definition iaf_psc_alpha_ps.cpp:582
double get_dI_ex_() const
Read out state variable derivative of I_ex.
Definition iaf_psc_alpha_ps.h:426
double get_V_m_() const
Read out the real membrane potential.
Definition iaf_psc_alpha_ps.h:412
State_ S_
Definition iaf_psc_alpha_ps.h:454
bool is_off_grid() const override
Returns true if the node sends/receives off-grid events.
Definition iaf_psc_alpha_ps.h:187
Variables_ V_
Definition iaf_psc_alpha_ps.h:455
void emit_spike_(Time const &origin, const long lag, const double t0, const double dt)
Trigger regula falsi method to find the precise spike time within the mini-timestep (t0,...
Definition iaf_psc_alpha_ps.cpp:536
friend class UniversalDataLogger< iaf_psc_alpha_ps >
Definition iaf_psc_alpha_ps.h:274
IAFPropagatorAlpha propagator_ex_
Propagator object for updating synaptic components.
Definition iaf_psc_alpha_ps.h:269
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_iaf_psc_alpha_ps(const std::string &name)
Definition iaf_psc_alpha_ps.cpp:50
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition iaf_psc_alpha_ps.h:362
UniversalDataLogger< iaf_psc_alpha_ps > logger_
Logger for all analog data.
Definition iaf_psc_alpha_ps.h:374
RingBuffer currents_
Definition iaf_psc_alpha_ps.h:371
SliceRingBuffer events_
Queue for incoming events.
Definition iaf_psc_alpha_ps.h:370
Independent parameters of the model.
Definition iaf_psc_alpha_ps.h:282
double c_m_
Membrane capacitance in pF.
Definition iaf_psc_alpha_ps.h:292
double tau_m_
Membrane time constant in ms.
Definition iaf_psc_alpha_ps.h:285
Parameters_()
Sets default parameter values.
Definition iaf_psc_alpha_ps.cpp:73
double U_reset_
Reset potential.
Definition iaf_psc_alpha_ps.h:315
double tau_syn_in_
Definition iaf_psc_alpha_ps.h:289
double U_th_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha_ps.h:305
double E_L_
Resting potential in mV.
Definition iaf_psc_alpha_ps.h:298
void get(Dictionary &) const
Store current values in dictionary.
Definition iaf_psc_alpha_ps.cpp:105
double U_min_
Lower bound, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha_ps.h:309
double set(const Dictionary &, Node *)
Set values from dictionary.
Definition iaf_psc_alpha_ps.cpp:120
double tau_syn_ex_
Time constant of synaptic current in ms.
Definition iaf_psc_alpha_ps.h:288
double I_e_
External DC current [pA].
Definition iaf_psc_alpha_ps.h:301
double t_ref_
Refractory period in ms.
Definition iaf_psc_alpha_ps.h:295
State variables of the model.
Definition iaf_psc_alpha_ps.h:333
State_()
Default initialization.
Definition iaf_psc_alpha_ps.cpp:87
bool is_refractory_
true while refractory
Definition iaf_psc_alpha_ps.h:340
double V_m_
Membrane pot. rel. to resting pot. E_L_.
Definition iaf_psc_alpha_ps.h:339
double dI_in_
alpha current, second component
Definition iaf_psc_alpha_ps.h:338
void set(const Dictionary &, const Parameters_ &, double, Node *)
Set values from dictionary.
Definition iaf_psc_alpha_ps.cpp:202
double I_ex_
alpha current, first component
Definition iaf_psc_alpha_ps.h:335
void get(Dictionary &, const Parameters_ &) const
Definition iaf_psc_alpha_ps.cpp:191
double y_input_
external input current
Definition iaf_psc_alpha_ps.h:334
double dI_ex_
alpha current, second component
Definition iaf_psc_alpha_ps.h:336
long last_spike_step_
time stamp of most recent spike
Definition iaf_psc_alpha_ps.h:341
double last_spike_offset_
offset of most recent spike
Definition iaf_psc_alpha_ps.h:342
double I_in_
alpha current, first component
Definition iaf_psc_alpha_ps.h:337
Internal variables of the model.
Definition iaf_psc_alpha_ps.h:383
double P30_
progagator matrix elem, 3rd row
Definition iaf_psc_alpha_ps.h:391
long refractory_steps_
refractory time in steps
Definition iaf_psc_alpha_ps.h:387
double exp_tau_syn_in_
exp(-h/tau_syn_in)
Definition iaf_psc_alpha_ps.h:390
double inv_tau_syn_in_
1 / tau_syn_in
Definition iaf_psc_alpha_ps.h:404
double inv_tau_syn_ex_
1 / tau_syn_ex
Definition iaf_psc_alpha_ps.h:403
double P32_ex_
progagator matrix elem, 3rd row (ex)
Definition iaf_psc_alpha_ps.h:393
double exp_tau_syn_ex_
exp(-h/tau_syn_ex)
Definition iaf_psc_alpha_ps.h:389
double inv_c_m_
1 / c_m
Definition iaf_psc_alpha_ps.h:405
double y_input_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:396
double I_in_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:398
double P31_in_
progagator matrix elem, 3rd row (in)
Definition iaf_psc_alpha_ps.h:394
double dI_in_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:400
double inv_tau_m_
1 / tau_m
Definition iaf_psc_alpha_ps.h:402
double h_ms_
time resolution in ms
Definition iaf_psc_alpha_ps.h:384
double dI_ex_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:399
double psc_norm_in_
e / tau_syn_in
Definition iaf_psc_alpha_ps.h:386
double P31_ex_
progagator matrix elem, 3rd row (ex)
Definition iaf_psc_alpha_ps.h:392
double expm1_tau_m_
exp(-h/tau_m) - 1
Definition iaf_psc_alpha_ps.h:388
double psc_norm_ex_
e / tau_syn_ex
Definition iaf_psc_alpha_ps.h:385
double V_m_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:401
double I_ex_before_
at beginning of mini-step
Definition iaf_psc_alpha_ps.h:397
double P32_in_
progagator matrix elem, 3rd row (in)
Definition iaf_psc_alpha_ps.h:395