NEST main@caf0ae8
 
Loading...
Searching...
No Matches
iaf_psc_exp_ps.h
Go to the documentation of this file.
1/*
2 * iaf_psc_exp_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_EXP_PS_H
24#define IAF_PSC_EXP_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 "recordables_map.h"
39#include "ring_buffer.h"
40#include "slice_ring_buffer.h"
42
43namespace nest
44{
45
46/* BeginUserDocs: neuron, integrate-and-fire, current-based, precise, hard threshold
47
48Short description
49+++++++++++++++++
50
51Current-based leaky integrate-and-fire neuron with exponential-shaped
52postsynaptic currents using regula falsi method for approximation of
53threshold crossing
54
55Description
56+++++++++++
57
58``iaf_psc_exp_ps`` is the "canonical" implementation of the leaky
59integrate-and-fire model neuron with exponential postsynaptic currents
60that uses the regula falsi method to approximate the timing of a threshold
61crossing. This is the most exact implementation available.
62
63The canonical implementation handles neuronal dynamics in a locally
64event-based manner with in coarse time grid defined by the minimum
65delay in the network, see :footcite:p:`Morrison2007a` :footcite:p:`Hanuschkin2010`. Incoming spikes are applied at the
66precise moment of their arrival, while the precise time of outgoing
67spikes is determined by regula falsi once a threshold crossing has
68been detected. Return from refractoriness occurs precisely at spike
69time plus refractory period.
70
71This implementation is more complex than the plain iaf_psc_exp
72neuron, but achieves much higher precision. In particular, it does not
73suffer any binning of spike times to grid points. Depending on your
74application, the canonical application with regula falsi may provide
75superior overall performance given an accuracy goal; see :footcite:p:`Morrison2007a` :footcite:p:`Hanuschkin2010` for
76details. Subthreshold dynamics are integrated using exact integration
77between events :footcite:p:`Rotter1999`.
78
79Please note that this node is capable of sending precise spike times
80to target nodes (on-grid spike time and offset).
81
82The iaf_psc_delta_ps neuron accepts connections transmitting
83CurrentEvents. These events transmit stepwise-constant currents which
84can only change at on-grid times.
85
86.. note::
87
88 If `tau_m` is very close to `tau_syn_ex` or `tau_syn_in`, the model
89 will numerically behave as if `tau_m` is equal to `tau_syn_ex` or
90 `tau_syn_in`, respectively, to avoid numerical instabilities.
91
92 For implementation details see the
93 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
94
95For details about exact subthreshold integration, please see
96:doc:`../neurons/exact-integration`.
97
98Parameters
99++++++++++
100
101The following parameters can be set in the status dictionary.
102
103========== ===== ==========================================================
104E_L mV Resting membrane potential
105C_m pF Capacitance of the membrane
106tau_m ms Membrane time constant
107tau_syn_ex ms Excitatory synaptic time constant
108tau_syn_in ms Inhibitory synaptic time constant
109t_ref ms Duration of refractory period
110V_th mV Spike threshold
111I_e pA Constant input current
112V_min mV Absolute lower value for the membrane potential
113V_reset mV Reset value for the membrane potential
114========== ===== ==========================================================
115
116References
117++++++++++
118
119.. footbibliography::
120
121Sends
122+++++
123
124SpikeEvent
125
126Receives
127++++++++
128
129SpikeEvent, CurrentEvent, DataLoggingRequest
130
131See also
132++++++++
133
134iaf_psc_exp, iaf_psc_alpha_ps
135
136Examples using this model
137+++++++++++++++++++++++++
138
139.. listexamples:: iaf_psc_exp_ps
140
141EndUserDocs */
142
143void register_iaf_psc_exp_ps( const std::string& name );
144
146{
147public:
153
162
168 using Node::handle;
170
171 size_t send_test_event( Node&, size_t, synindex, bool ) override;
172
173 size_t handles_test_event( SpikeEvent&, size_t ) override;
174 size_t handles_test_event( CurrentEvent&, size_t ) override;
175 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
176
177 void handle( SpikeEvent& ) override;
178 void handle( CurrentEvent& ) override;
179 void handle( DataLoggingRequest& ) override;
180
181 bool
182 is_off_grid() const override
183 {
184 return true;
185 }
186
187 void get_status( Dictionary& ) const override;
188 void set_status( const Dictionary& ) override;
189
199 double threshold_distance( double t_step ) const;
200
201private:
207 void init_buffers_() override;
208 void pre_run_hook() override;
209
227 void update( Time const& origin, const long from, const long to ) override;
229
230 // The next two classes need to be friends to access the State_ class/member
231 friend class RecordablesMap< iaf_psc_exp_ps >;
232 friend class UniversalDataLogger< iaf_psc_exp_ps >;
233
239 void propagate_( const double dt );
240
252 void emit_spike_( const Time& origin, const long lag, const double t0, const double dt );
253
262 void emit_instant_spike_( const Time& origin, const long lag, const double spike_offset );
263
267
268 // ----------------------------------------------------------------
269
274 {
276 double tau_m_;
277
279 double tau_ex_;
280
282 double tau_in_;
283
285 double c_m_;
286
288 double t_ref_;
289
291 double E_L_;
292
294 double I_e_;
295
298 double U_th_;
299
302 double U_min_;
303
307 double U_reset_;
308
309 Parameters_();
310
311 void get( Dictionary& ) const;
312
316 double set( const Dictionary&, Node* node );
317 };
318
319 // ----------------------------------------------------------------
320
324 struct State_
325 {
326 double y0_;
327 double y1_ex_;
328 double y1_in_;
329 double y2_;
330
334
335 State_();
336
337 void get( Dictionary&, const Parameters_& ) const;
338
344 void set( const Dictionary&, const Parameters_&, double, Node* );
345 };
346
347 // ----------------------------------------------------------------
348
367
368 // ----------------------------------------------------------------
369
374 {
375 double h_ms_;
378 double exp_tau_ex_;
379 double exp_tau_in_;
380 double P20_;
381 double P21_in_;
382 double P21_ex_;
383 double y0_before_;
386 double y2_before_;
387 };
388
389 // Access functions for UniversalDataLogger -------------------------------
390
392 double
393 get_V_m_() const
394 {
395 return S_.y2_ + P_.E_L_;
396 }
397
398 // ----------------------------------------------------------------
399
414};
415
416inline size_t
417iaf_psc_exp_ps::send_test_event( Node& target, size_t receptor_type, synindex, bool )
418{
419 SpikeEvent e;
420 e.set_sender( *this );
421 return target.handles_test_event( e, receptor_type );
422}
423
424inline size_t
426{
427 if ( receptor_type != 0 )
428 {
429 throw UnknownReceptorType( receptor_type, get_name() );
430 }
431 return 0;
432}
433
434inline size_t
436{
437 if ( receptor_type != 0 )
438 {
439 throw UnknownReceptorType( receptor_type, get_name() );
440 }
441 return 0;
442}
443
444inline size_t
446{
447 if ( receptor_type != 0 )
448 {
449 throw UnknownReceptorType( receptor_type, get_name() );
450 }
451 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
452}
453
454inline void
456{
457 P_.get( d );
458 S_.get( d, P_ );
460
461 d[ names::recordables ] = recordablesMap_.get_list();
462}
463
464inline void
466{
467 Parameters_ ptmp = P_; // temporary copy in case of errors
468 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
469 State_ stmp = S_; // temporary copy in case of errors
470 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
471
472 // We now know that (ptmp, stmp) are consistent. We do not
473 // write them back to (P_, S_) before we are also sure that
474 // the properties to be set in the parent class are internally
475 // consistent.
477
478 // if we get here, temporaries contain consistent set of properties
479 P_ = ptmp;
480 S_ = stmp;
481}
482
483} // namespace
484
485#endif // IAF_PSC_EXP_PS_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Exact integration voltage propagator for models with exponential psc.
Definition iaf_propagator.h:101
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_exp_ps.h:146
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition iaf_psc_exp_ps.h:406
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_exp_ps.h:417
IAFPropagatorExp propagator_ex_
Propagator object for updating synaptic components.
Definition iaf_psc_exp_ps.h:265
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition iaf_psc_exp_ps.cpp:433
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition iaf_psc_exp_ps.cpp:251
Variables_ V_
Definition iaf_psc_exp_ps.h:408
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition iaf_psc_exp_ps.h:425
double get_V_m_() const
Read out the real membrane potential.
Definition iaf_psc_exp_ps.h:393
State_ S_
Definition iaf_psc_exp_ps.h:407
iaf_psc_exp_ps()
Basic constructor.
Definition iaf_psc_exp_ps.cpp:218
void propagate_(const double dt)
Propagate neuron state.
Definition iaf_psc_exp_ps.cpp:470
void emit_spike_(const Time &origin, const long lag, const double t0, const double dt)
Trigger iterative method to find the precise spike time within the mini-timestep (t0,...
Definition iaf_psc_exp_ps.cpp:495
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition iaf_psc_exp_ps.h:465
IAFPropagatorExp propagator_in_
Definition iaf_psc_exp_ps.h:266
Buffers_ B_
Definition iaf_psc_exp_ps.h:409
friend class UniversalDataLogger< iaf_psc_exp_ps >
Definition iaf_psc_exp_ps.h:232
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_exp_ps.cpp:542
bool is_off_grid() const override
Returns true if the node sends/receives off-grid events.
Definition iaf_psc_exp_ps.h:182
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_exp_ps.h:455
void update(Time const &origin, const long from, const long to) override
Time Evolution Operator.
Definition iaf_psc_exp_ps.cpp:279
void init_buffers_() override
Configure persistent internal data structures.
Definition iaf_psc_exp_ps.cpp:240
void emit_instant_spike_(const Time &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_exp_ps.cpp:521
static RecordablesMap< iaf_psc_exp_ps > recordablesMap_
Mapping of recordables names to access functions.
Definition iaf_psc_exp_ps.h:413
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_exp_ps(const std::string &name)
Definition iaf_psc_exp_ps.cpp:50
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition iaf_psc_exp_ps.h:353
UniversalDataLogger< iaf_psc_exp_ps > logger_
Logger for all analog data.
Definition iaf_psc_exp_ps.h:365
SliceRingBuffer events_
Queue for incoming events.
Definition iaf_psc_exp_ps.h:361
RingBuffer currents_
Definition iaf_psc_exp_ps.h:362
Independent parameters of the model.
Definition iaf_psc_exp_ps.h:274
double tau_in_
Time constant of inh.
Definition iaf_psc_exp_ps.h:282
double U_reset_
Reset potential.
Definition iaf_psc_exp_ps.h:307
double I_e_
External DC current [pA].
Definition iaf_psc_exp_ps.h:294
double set(const Dictionary &, Node *node)
Set values from dictionary.
Definition iaf_psc_exp_ps.cpp:124
void get(Dictionary &) const
Store current values in dictionary.
Definition iaf_psc_exp_ps.cpp:109
double tau_m_
Membrane time constant in ms.
Definition iaf_psc_exp_ps.h:276
double tau_ex_
Time constant of exc.
Definition iaf_psc_exp_ps.h:279
double t_ref_
Refractory period in ms.
Definition iaf_psc_exp_ps.h:288
double c_m_
Membrane capacitance in pF.
Definition iaf_psc_exp_ps.h:285
Parameters_()
Sets default parameter values.
Definition iaf_psc_exp_ps.cpp:69
double E_L_
Resting potential in mV.
Definition iaf_psc_exp_ps.h:291
double U_th_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_exp_ps.h:298
double U_min_
Lower bound, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_exp_ps.h:302
State variables of the model.
Definition iaf_psc_exp_ps.h:325
double y1_ex_
Excitatory synaptic current.
Definition iaf_psc_exp_ps.h:327
double y0_
External input current.
Definition iaf_psc_exp_ps.h:326
long last_spike_step_
Time stamp of most recent spike.
Definition iaf_psc_exp_ps.h:332
void get(Dictionary &, const Parameters_ &) const
Definition iaf_psc_exp_ps.cpp:191
State_()
Default initialization.
Definition iaf_psc_exp_ps.cpp:83
bool is_refractory_
True while refractory.
Definition iaf_psc_exp_ps.h:331
double last_spike_offset_
Offset of most recent spike.
Definition iaf_psc_exp_ps.h:333
void set(const Dictionary &, const Parameters_ &, double, Node *)
Set values from dictionary.
Definition iaf_psc_exp_ps.cpp:200
double y2_
Membrane potential (relative to resting potential)
Definition iaf_psc_exp_ps.h:329
double y1_in_
Inhibitory synaptic current.
Definition iaf_psc_exp_ps.h:328
Internal variables of the model.
Definition iaf_psc_exp_ps.h:374
double exp_tau_in_
exp(-h/tau_in)
Definition iaf_psc_exp_ps.h:379
double P21_ex_
Progagator matrix element, 2nd row.
Definition iaf_psc_exp_ps.h:382
double y2_before_
y2_ at beginning of ministep
Definition iaf_psc_exp_ps.h:386
double exp_tau_ex_
exp(-h/tau_ex)
Definition iaf_psc_exp_ps.h:378
long refractory_steps_
Refractory time in steps.
Definition iaf_psc_exp_ps.h:376
double P21_in_
Progagator matrix element, 2nd row.
Definition iaf_psc_exp_ps.h:381
double expm1_tau_m_
expm1(-h/tau_m)
Definition iaf_psc_exp_ps.h:377
double h_ms_
Time resolution [ms].
Definition iaf_psc_exp_ps.h:375
double P20_
Progagator matrix element, 2nd row.
Definition iaf_psc_exp_ps.h:380
double y1_ex_before_
y1_ at beginning of ministep
Definition iaf_psc_exp_ps.h:384
double y0_before_
y0_ at beginning of ministep
Definition iaf_psc_exp_ps.h:383
double y1_in_before_
y1_ at beginning of ministep
Definition iaf_psc_exp_ps.h:385