NEST main@caf0ae8
 
Loading...
Searching...
No Matches
iaf_psc_exp_ps_lossless.h
Go to the documentation of this file.
1/*
2 * iaf_psc_exp_ps_lossless.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_LOSSLESS_H
24#define IAF_PSC_EXP_PS_LOSSLESS_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
43
44namespace nest
45{
46
47/* BeginUserDocs: neuron, integrate-and-fire, current-based, precise, hard threshold
48
49Short description
50+++++++++++++++++
51
52Current-based leaky integrate-and-fire neuron with exponential-shaped
53postsynaptic currents predicting the exact number of spikes using a
54state space analysis
55
56Description
57+++++++++++
58
59``iaf_psc_exp_ps_lossless`` is the precise state space implementation of the leaky
60integrate-and-fire model neuron with exponential postsynaptic currents
61that uses time reversal to detect spikes :footcite:p:`Krishnan2018`. This is the most exact
62implementation available.
63
64Time-reversed state space analysis provides a general method to solve the
65threshold-detection problem for an integrable, affine or linear time
66evolution. This method is based on the idea of propagating the threshold
67backwards in time, and see whether it meets the initial state, rather
68than propagating the initial state forward in time and see whether it
69meets the threshold.
70
71.. note::
72
73 If `tau_m` is very close to `tau_syn_ex` or `tau_syn_in`, the model
74 will numerically behave as if `tau_m` is equal to `tau_syn_ex` or
75 `tau_syn_in`, respectively, to avoid numerical instabilities.
76
77 For implementation details see the
78 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
79
80Parameters
81++++++++++
82
83The following parameters can be set in the status dictionary.
84
85=========== ======== ==========================================================
86 E_L mV Resting membrane potential
87 C_m pF/mum^2 Specific capacitance of the membrane
88 tau_m ms Membrane time constant
89 tau_syn_ex ms Excitatory synaptic time constant
90 tau_syn_in ms Inhibitory synaptic time constant
91 t_ref ms Duration of refractory period
92 V_th mV Spike threshold
93 I_e pA Constant input current
94 V_min mV Absolute lower value for the membrane potential.
95 V_reset mV Reset value for the membrane potential.
96=========== ======== ==========================================================
97
98References
99++++++++++
100
101.. footbibliography::
102
103Sends
104+++++
105
106SpikeEvent
107
108Receives
109++++++++
110
111SpikeEvent, CurrentEvent, DataLoggingRequest
112
113See also
114++++++++
115
116iaf_psc_exp_ps
117
118Examples using this model
119+++++++++++++++++++++++++
120
121.. listexamples:: iaf_psc_exp_ps_lossless
122
123EndUserDocs */
124
125void register_iaf_psc_exp_ps_lossless( const std::string& name );
126
128{
129public:
135
144
150 using Node::handle;
152
153 size_t send_test_event( Node&, size_t, synindex, bool ) override;
154
155 size_t handles_test_event( SpikeEvent&, size_t ) override;
156 size_t handles_test_event( CurrentEvent&, size_t ) override;
157 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
158
159 void handle( SpikeEvent& ) override;
160 void handle( CurrentEvent& ) override;
161 void handle( DataLoggingRequest& ) override;
162
163 bool
164 is_off_grid() const override // uses off_grid events
165 {
166 return true;
167 }
168
169 void get_status( Dictionary& ) const override;
170 void set_status( const Dictionary& ) override;
171
181 double threshold_distance( double t_step ) const;
182
183private:
189 void init_buffers_() override;
190 void pre_run_hook() override;
191
209 void update( Time const& origin, const long from, const long to ) override;
211
212 // The next two classes need to be friends to access the State_ class/member
214 friend class UniversalDataLogger< iaf_psc_exp_ps_lossless >;
215
220 void propagate_( const double dt );
221
233 void emit_spike_( const Time& origin, const long lag, const double t0, const double dt );
234
242 void emit_instant_spike_( const Time& origin, const long lag, const double spike_offset );
243
259 double is_spike_( const double );
260
264
265 // ----------------------------------------------------------------
266
271 {
273 double tau_m_;
274
276 double tau_ex_;
277
279 double tau_in_;
280
282 double c_m_;
283
285 double t_ref_;
286
288 double E_L_;
289
291 double I_e_;
292
295 double U_th_;
296
299 double U_min_;
300
304 double U_reset_;
305
306 Parameters_();
307
308 void get( Dictionary& ) const;
309 double set( const Dictionary&, Node* node );
310 };
311
312 // ----------------------------------------------------------------
313
317 struct State_
318 {
319 double y0_;
320 double I_syn_ex_;
321 double I_syn_in_;
322 double y2_;
323
327
328 State_();
329
330 void get( Dictionary&, const Parameters_& ) const;
331 void set( const Dictionary&, const Parameters_&, double delta_EL, Node* );
332 };
333
334 // ----------------------------------------------------------------
335
354
355 // ----------------------------------------------------------------
356
361 {
362 double h_ms_;
365 double exp_tau_ex_;
366 double exp_tau_in_;
367 double P20_;
368 double P21_in_;
369 double P21_ex_;
370 double y0_before_;
373 double y2_before_;
374
379 double a1_;
380 double a2_;
381 double a3_;
382 double a4_;
384
389 double b1_;
390 double b2_;
391 double b3_;
392 double b4_;
394
399 double c1_;
400 double c2_;
401 double c3_;
402 double c4_;
403 double c5_;
404 double c6_;
406 };
407
408 // Access functions for UniversalDataLogger -------------------------------
409
411 double
412 get_V_m_() const
413 {
414 return S_.y2_ + P_.E_L_;
415 }
416 double
418 {
419 return S_.I_syn_ex_ + S_.I_syn_in_;
420 }
421 double
423 {
424 return S_.I_syn_ex_;
425 }
426 double
428 {
429 return S_.I_syn_in_;
430 }
431 // ----------------------------------------------------------------
432
447};
448
449inline size_t
450iaf_psc_exp_ps_lossless::send_test_event( Node& target, size_t receptor_type, synindex, bool )
451{
452 SpikeEvent e;
453 e.set_sender( *this );
454 return target.handles_test_event( e, receptor_type );
455}
456
457inline size_t
459{
460 if ( receptor_type != 0 )
461 {
462 throw UnknownReceptorType( receptor_type, get_name() );
463 }
464 return 0;
465}
466
467inline size_t
469{
470 if ( receptor_type != 0 )
471 {
472 throw UnknownReceptorType( receptor_type, get_name() );
473 }
474 return 0;
475}
476
477inline size_t
479{
480 if ( receptor_type != 0 )
481 {
482 throw UnknownReceptorType( receptor_type, get_name() );
483 }
484 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
485}
486
487inline void
489{
490 P_.get( d );
491 S_.get( d, P_ );
493
494 d[ names::recordables ] = recordablesMap_.get_list();
495}
496
497inline void
499{
500 Parameters_ ptmp = P_; // temporary copy in case of errors
501 double delta_EL = ptmp.set( d, this ); // throws if BadProperty
502 State_ stmp = S_; // temporary copy in case of errors
503 stmp.set( d, ptmp, delta_EL, this ); // throws if BadProperty
504
505 // We now know that (ptmp, stmp) are consistent. We do not
506 // write them back to (P_, S_) before we are also sure that
507 // the properties to be set in the parent class are internally
508 // consistent.
510
511 // if we get here, temporaries contain consistent set of properties
512 P_ = ptmp;
513 S_ = stmp;
514}
515} // namespace
516#endif // IAF_PSC_EXP_PS_LOSSLESS_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_lossless.h:128
void init_buffers_() override
Configure persistent internal data structures.
Definition iaf_psc_exp_ps_lossless.cpp:263
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_exp_ps_lossless.h:488
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition iaf_psc_exp_ps_lossless.h:498
iaf_psc_exp_ps_lossless()
Basic constructor.
Definition iaf_psc_exp_ps_lossless.cpp:241
double is_spike_(const double)
Retrospective spike detection by state space analysis.
Definition iaf_psc_exp_ps_lossless.cpp:595
void emit_instant_spike_(const Time &origin, const long lag, const double spike_offset)
Emit a single spike at a precisely given time.
Definition iaf_psc_exp_ps_lossless.cpp:560
void update(Time const &origin, const long from, const long to) override
Time Evolution Operator.
Definition iaf_psc_exp_ps_lossless.cpp:316
Buffers_ B_
Definition iaf_psc_exp_ps_lossless.h:442
Variables_ V_
Definition iaf_psc_exp_ps_lossless.h:441
double get_V_m_() const
Read out the real membrane potential.
Definition iaf_psc_exp_ps_lossless.h:412
void emit_spike_(const Time &origin, const long lag, const double t0, const double dt)
Emit a single spike caused by DC current in absence of spike input.
Definition iaf_psc_exp_ps_lossless.cpp:535
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition iaf_psc_exp_ps_lossless.cpp:473
double get_I_syn_in_() const
Definition iaf_psc_exp_ps_lossless.h:427
double get_I_syn_ex_() const
Definition iaf_psc_exp_ps_lossless.h:422
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition iaf_psc_exp_ps_lossless.h:439
State_ S_
Definition iaf_psc_exp_ps_lossless.h:440
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_lossless.h:450
bool is_off_grid() const override
Returns true if the node sends/receives off-grid events.
Definition iaf_psc_exp_ps_lossless.h:164
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_lossless.h:458
double get_I_syn_() const
Definition iaf_psc_exp_ps_lossless.h:417
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_lossless.cpp:581
void propagate_(const double dt)
Propagate neuron state.
Definition iaf_psc_exp_ps_lossless.cpp:510
IAFPropagatorExp propagator_ex_
Propagator object for updating synaptic components.
Definition iaf_psc_exp_ps_lossless.h:262
static RecordablesMap< iaf_psc_exp_ps_lossless > recordablesMap_
Mapping of recordables names to access functions.
Definition iaf_psc_exp_ps_lossless.h:446
IAFPropagatorExp propagator_in_
Definition iaf_psc_exp_ps_lossless.h:263
friend class UniversalDataLogger< iaf_psc_exp_ps_lossless >
Definition iaf_psc_exp_ps_lossless.h:214
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition iaf_psc_exp_ps_lossless.cpp:272
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_lossless(const std::string &name)
Definition iaf_psc_exp_ps_lossless.cpp:48
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition iaf_psc_exp_ps_lossless.h:340
SliceRingBuffer events_
Queue for incoming events.
Definition iaf_psc_exp_ps_lossless.h:348
RingBuffer currents_
Definition iaf_psc_exp_ps_lossless.h:349
UniversalDataLogger< iaf_psc_exp_ps_lossless > logger_
Logger for all analog data.
Definition iaf_psc_exp_ps_lossless.h:352
Independent parameters of the model.
Definition iaf_psc_exp_ps_lossless.h:271
double U_min_
Lower bound, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_exp_ps_lossless.h:299
double t_ref_
Refractory period in ms.
Definition iaf_psc_exp_ps_lossless.h:285
double tau_in_
Time constant of inh.
Definition iaf_psc_exp_ps_lossless.h:279
double U_reset_
Reset potential.
Definition iaf_psc_exp_ps_lossless.h:304
void get(Dictionary &) const
Store current values in dictionary.
Definition iaf_psc_exp_ps_lossless.cpp:109
Parameters_()
Sets default parameter values.
Definition iaf_psc_exp_ps_lossless.cpp:70
double set(const Dictionary &, Node *node)
Set values from dictionary.
Definition iaf_psc_exp_ps_lossless.cpp:124
double c_m_
Membrane capacitance in pF.
Definition iaf_psc_exp_ps_lossless.h:282
double U_th_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_exp_ps_lossless.h:295
double tau_ex_
Time constant of exc.
Definition iaf_psc_exp_ps_lossless.h:276
double tau_m_
Membrane time constant in ms.
Definition iaf_psc_exp_ps_lossless.h:273
double E_L_
Resting potential in mV.
Definition iaf_psc_exp_ps_lossless.h:288
double I_e_
External DC current [pA].
Definition iaf_psc_exp_ps_lossless.h:291
State variables of the model.
Definition iaf_psc_exp_ps_lossless.h:318
void set(const Dictionary &, const Parameters_ &, double delta_EL, Node *)
Definition iaf_psc_exp_ps_lossless.cpp:222
double last_spike_offset_
Offset of most recent spike.
Definition iaf_psc_exp_ps_lossless.h:326
void get(Dictionary &, const Parameters_ &) const
Definition iaf_psc_exp_ps_lossless.cpp:210
bool is_refractory_
True while refractory.
Definition iaf_psc_exp_ps_lossless.h:324
double y2_
Membrane potential (relative to resting potential)
Definition iaf_psc_exp_ps_lossless.h:322
double y0_
External input current.
Definition iaf_psc_exp_ps_lossless.h:319
double I_syn_in_
Inh. exponential current.
Definition iaf_psc_exp_ps_lossless.h:321
long last_spike_step_
Time stamp of most recent spike.
Definition iaf_psc_exp_ps_lossless.h:325
State_()
Default initialization.
Definition iaf_psc_exp_ps_lossless.cpp:84
double I_syn_ex_
Exc. exponential current.
Definition iaf_psc_exp_ps_lossless.h:320
Internal variables of the model.
Definition iaf_psc_exp_ps_lossless.h:361
double y2_before_
y2_ at beginning of ministep
Definition iaf_psc_exp_ps_lossless.h:373
double exp_tau_in_
exp(-h/tau_in)
Definition iaf_psc_exp_ps_lossless.h:366
double y0_before_
y0_ at beginning of ministep
Definition iaf_psc_exp_ps_lossless.h:370
double b3_
Definition iaf_psc_exp_ps_lossless.h:391
double c4_
Definition iaf_psc_exp_ps_lossless.h:402
double I_syn_in_before_
I_syn_in_ at beginning of ministep.
Definition iaf_psc_exp_ps_lossless.h:372
double a1_
Pre-computed constants for inequality V < g(h, I_e)
Definition iaf_psc_exp_ps_lossless.h:379
double b4_
Definition iaf_psc_exp_ps_lossless.h:392
double c1_
Pre-computed constants for inequality V < b(I_e)
Definition iaf_psc_exp_ps_lossless.h:399
double P21_in_
Progagator matrix element, 2nd row.
Definition iaf_psc_exp_ps_lossless.h:368
double exp_tau_ex_
exp(-h/tau_ex)
Definition iaf_psc_exp_ps_lossless.h:365
double a3_
Definition iaf_psc_exp_ps_lossless.h:381
double b2_
Definition iaf_psc_exp_ps_lossless.h:390
double P21_ex_
Progagator matrix element, 2nd row.
Definition iaf_psc_exp_ps_lossless.h:369
double c5_
Definition iaf_psc_exp_ps_lossless.h:403
long refractory_steps_
Refractory time in steps.
Definition iaf_psc_exp_ps_lossless.h:363
double P20_
Progagator matrix element, 2nd row.
Definition iaf_psc_exp_ps_lossless.h:367
double h_ms_
Time resolution [ms].
Definition iaf_psc_exp_ps_lossless.h:362
double a2_
Definition iaf_psc_exp_ps_lossless.h:380
double a4_
Definition iaf_psc_exp_ps_lossless.h:382
double b1_
Pre-computed constants for inequality V < f(h, I)
Definition iaf_psc_exp_ps_lossless.h:389
double c3_
Definition iaf_psc_exp_ps_lossless.h:401
double expm1_tau_m_
expm1(-h/tau_m)
Definition iaf_psc_exp_ps_lossless.h:364
double c2_
Definition iaf_psc_exp_ps_lossless.h:400
double I_syn_ex_before_
I_syn_ex_ at beginning of ministep.
Definition iaf_psc_exp_ps_lossless.h:371
double c6_
Definition iaf_psc_exp_ps_lossless.h:404