NEST main@f146f75
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
98.. note::
99
100 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
101 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
102 the inhibitory one, and also sets the direction of the post-synaptic current.
103 Spike connections must use the default ``receptor_type`` of 0.
104
105 See :ref:`synapse_selection` for the conventions used by other models.
106
107Parameters
108++++++++++
109
110The following parameters can be set in the status dictionary.
111
112========== ===== ==========================================================
113E_L mV Resting membrane potential
114C_m pF Capacitance of the membrane
115tau_m ms Membrane time constant
116tau_syn_ex ms Excitatory synaptic time constant
117tau_syn_in ms Inhibitory synaptic time constant
118t_ref ms Duration of refractory period
119V_th mV Spike threshold
120I_e pA Constant input current
121V_min mV Absolute lower value for the membrane potential
122V_reset mV Reset value for the membrane potential
123========== ===== ==========================================================
124
125References
126++++++++++
127
128.. footbibliography::
129
130Sends
131+++++
132
133SpikeEvent
134
135Receives
136++++++++
137
138SpikeEvent, CurrentEvent, DataLoggingRequest
139
140See also
141++++++++
142
143iaf_psc_exp, iaf_psc_alpha_ps
144
145Examples using this model
146+++++++++++++++++++++++++
147
148.. listexamples:: iaf_psc_exp_ps
149
150EndUserDocs */
151
152void register_iaf_psc_exp_ps( const std::string& name );
153
155{
156public:
162
171
177 using Node::handle;
179
180 size_t send_test_event( Node&, size_t, synindex, bool ) override;
181
182 size_t handles_test_event( SpikeEvent&, size_t ) override;
183 size_t handles_test_event( CurrentEvent&, size_t ) override;
184 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
185
186 void handle( SpikeEvent& ) override;
187 void handle( CurrentEvent& ) override;
188 void handle( DataLoggingRequest& ) override;
189
190 bool
191 is_off_grid() const override
192 {
193 return true;
194 }
195
196 void get_status( Dictionary& ) const override;
197 void set_status( const Dictionary& ) override;
198
208 double threshold_distance( double t_step ) const;
209
210private:
216 void init_buffers_() override;
217 void pre_run_hook() override;
218
236 void update( Time const& origin, const long from, const long to ) override;
238
239 // The next two classes need to be friends to access the State_ class/member
240 friend class RecordablesMap< iaf_psc_exp_ps >;
241 friend class UniversalDataLogger< iaf_psc_exp_ps >;
242
248 void propagate_( const double dt );
249
261 void emit_spike_( const Time& origin, const long lag, const double t0, const double dt );
262
271 void emit_instant_spike_( const Time& origin, const long lag, const double spike_offset );
272
276
277 // ----------------------------------------------------------------
278
283 {
285 double tau_m_;
286
288 double tau_ex_;
289
291 double tau_in_;
292
294 double c_m_;
295
297 double t_ref_;
298
300 double E_L_;
301
303 double I_e_;
304
307 double U_th_;
308
311 double U_min_;
312
316 double U_reset_;
317
318 Parameters_();
319
320 void get( Dictionary& ) const;
321
325 double set( const Dictionary&, Node* node );
326 };
327
328 // ----------------------------------------------------------------
329
333 struct State_
334 {
335 double y0_;
336 double y1_ex_;
337 double y1_in_;
338 double y2_;
339
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
383 {
384 double h_ms_;
387 double exp_tau_ex_;
388 double exp_tau_in_;
389 double P20_;
390 double P21_in_;
391 double P21_ex_;
392 double y0_before_;
395 double y2_before_;
396 };
397
398 // Access functions for UniversalDataLogger -------------------------------
399
401 double
402 get_V_m_() const
403 {
404 return S_.y2_ + P_.E_L_;
405 }
406
407 // ----------------------------------------------------------------
408
420
423};
424
425inline size_t
426iaf_psc_exp_ps::send_test_event( Node& target, size_t receptor_type, synindex, bool )
427{
428 SpikeEvent e;
429 e.set_sender( *this );
430 return target.handles_test_event( e, receptor_type );
431}
432
433inline size_t
435{
436 if ( receptor_type != 0 )
437 {
438 throw UnknownReceptorType( receptor_type, get_name() );
439 }
440 return 0;
441}
442
443inline size_t
445{
446 if ( receptor_type != 0 )
447 {
448 throw UnknownReceptorType( receptor_type, get_name() );
449 }
450 return 0;
451}
452
453inline size_t
455{
456 if ( receptor_type != 0 )
457 {
458 throw UnknownReceptorType( receptor_type, get_name() );
459 }
460 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
461}
462
463inline void
465{
466 P_.get( d );
467 S_.get( d, P_ );
469
470 d[ names::recordables ] = recordablesMap_.get_list();
471}
472
473inline void
475{
476 Parameters_ ptmp = P_; // temporary copy in case of errors
477 const double delta_EL = ptmp.set( d, this ); // throws if BadProperty
478 State_ stmp = S_; // temporary copy in case of errors
479 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
480
481 // We now know that (ptmp, stmp) are consistent. We do not
482 // write them back to (P_, S_) before we are also sure that
483 // the properties to be set in the parent class are internally
484 // consistent.
486
487 // if we get here, temporaries contain consistent set of properties
488 P_ = ptmp;
489 S_ = stmp;
490}
491
492} // namespace
493
494#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
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
Queue for all spikes arriving into a neuron.
Definition slice_ring_buffer.h:63
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 iaf_psc_exp_ps.h:415
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:426
IAFPropagatorExp propagator_ex_
Propagator object for updating synaptic components.
Definition iaf_psc_exp_ps.h:274
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:417
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:434
double get_V_m_() const
Read out the real membrane potential.
Definition iaf_psc_exp_ps.h:402
State_ S_
Definition iaf_psc_exp_ps.h:416
iaf_psc_exp_ps()
Basic constructor.
Definition iaf_psc_exp_ps.cpp:218
friend class RecordablesMap< iaf_psc_exp_ps >
Definition iaf_psc_exp_ps.h:240
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:474
IAFPropagatorExp propagator_in_
Definition iaf_psc_exp_ps.h:275
Buffers_ B_
Definition iaf_psc_exp_ps.h:418
friend class UniversalDataLogger< iaf_psc_exp_ps >
Definition iaf_psc_exp_ps.h:241
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:191
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_exp_ps.h:464
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:422
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_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:121
Buffers of the model.
Definition iaf_psc_exp_ps.h:362
Buffers_(iaf_psc_exp_ps &)
Definition iaf_psc_exp_ps.cpp:94
UniversalDataLogger< iaf_psc_exp_ps > logger_
Logger for all analog data.
Definition iaf_psc_exp_ps.h:374
SliceRingBuffer events_
Queue for incoming events.
Definition iaf_psc_exp_ps.h:370
RingBuffer currents_
Definition iaf_psc_exp_ps.h:371
Independent parameters of the model.
Definition iaf_psc_exp_ps.h:283
double tau_in_
Time constant of inh.
Definition iaf_psc_exp_ps.h:291
double U_reset_
Reset potential.
Definition iaf_psc_exp_ps.h:316
double I_e_
External DC current [pA].
Definition iaf_psc_exp_ps.h:303
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:285
double tau_ex_
Time constant of exc.
Definition iaf_psc_exp_ps.h:288
double t_ref_
Refractory period in ms.
Definition iaf_psc_exp_ps.h:297
double c_m_
Membrane capacitance in pF.
Definition iaf_psc_exp_ps.h:294
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:300
double U_th_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_exp_ps.h:307
double U_min_
Lower bound, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_exp_ps.h:311
State variables of the model.
Definition iaf_psc_exp_ps.h:334
double y1_ex_
Excitatory synaptic current.
Definition iaf_psc_exp_ps.h:336
double y0_
External input current.
Definition iaf_psc_exp_ps.h:335
long last_spike_step_
Time stamp of most recent spike.
Definition iaf_psc_exp_ps.h:341
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:340
double last_spike_offset_
Offset of most recent spike.
Definition iaf_psc_exp_ps.h:342
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:338
double y1_in_
Inhibitory synaptic current.
Definition iaf_psc_exp_ps.h:337
Internal variables of the model.
Definition iaf_psc_exp_ps.h:383
double exp_tau_in_
exp(-h/tau_in)
Definition iaf_psc_exp_ps.h:388
double P21_ex_
Progagator matrix element, 2nd row.
Definition iaf_psc_exp_ps.h:391
double y2_before_
y2_ at beginning of ministep
Definition iaf_psc_exp_ps.h:395
double exp_tau_ex_
exp(-h/tau_ex)
Definition iaf_psc_exp_ps.h:387
long refractory_steps_
Refractory time in steps.
Definition iaf_psc_exp_ps.h:385
double P21_in_
Progagator matrix element, 2nd row.
Definition iaf_psc_exp_ps.h:390
double expm1_tau_m_
expm1(-h/tau_m)
Definition iaf_psc_exp_ps.h:386
double h_ms_
Time resolution [ms].
Definition iaf_psc_exp_ps.h:384
double P20_
Progagator matrix element, 2nd row.
Definition iaf_psc_exp_ps.h:389
double y1_ex_before_
y1_ at beginning of ministep
Definition iaf_psc_exp_ps.h:393
double y0_before_
y0_ at beginning of ministep
Definition iaf_psc_exp_ps.h:392
double y1_in_before_
y1_ at beginning of ministep
Definition iaf_psc_exp_ps.h:394