NEST  2.6.0,not_revisioned_source_dir@0
iaf_psc_delta_canon.h
Go to the documentation of this file.
1 /*
2  * iaf_psc_delta_canon.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_DELTA_CANON_H
24 #define IAF_PSC_DELTA_CANON_H
25 
26 #include "config.h"
27 
28 #include "nest.h"
29 #include "event.h"
30 #include "node.h"
31 #include "slice_ring_buffer.h"
32 #include "ring_buffer.h"
33 #include "connection.h"
34 
35 #include "universal_data_logger.h"
36 
37 namespace nest{
38 
39  class Network;
40 
41  /* BeginDocumentation
42  Name: iaf_psc_delta_canon - Leaky integrate-and-fire neuron model.
43 
44  Description:
45  iaf_psc_delta_canon is an implementation of a leaky integrate-and-fire model
46  where the potential jumps on each spike arrival.
47 
48  The threshold crossing is followed by an absolute refractory period
49  during which the membrane potential is clamped to the resting
50  potential.
51 
52  Spikes arriving while the neuron is refractory, are discarded by
53  default. If the property "refractory_input" is set to true, such
54  spikes are added to the membrane potential at the end of the
55  refractory period, dampened according to the interval between
56  arrival and end of refractoriness.
57 
58  The linear subthresold dynamics is integrated by the Exact
59  Integration scheme [1]. The neuron dynamics are solved exactly in
60  time. Incoming and outgoing spike times are handled precisely [3].
61 
62  An additional state variable and the corresponding differential
63  equation represents a piecewise constant external current.
64 
65  Spikes can occur either on receipt of an excitatory input spike, or
66  be caused by a depolarizing input current. Spikes evoked by
67  incoming spikes, will occur precisely at the time of spike arrival,
68  since incoming spikes are modeled as instantaneous potential
69  jumps. Times of spikes caused by current input are determined
70  exactly by solving the membrane potential equation. Note that, in
71  contrast to the neuron models discussed in [3,4], this model has so
72  simple dynamics that no interpolation or iterative spike location
73  technique is required at all.
74 
75  The general framework for the consistent formulation of systems with
76  neuron like dynamics interacting by point events is described in
77  [1]. A flow chart can be found in [2].
78 
79  Critical tests for the formulation of the neuron model are the
80  comparisons of simulation results for different computation step
81  sizes. sli/testsuite/nest contains a number of such tests.
82 
83  The iaf_psc_delta_canon is the standard model used to check the consistency
84  of the nest simulation kernel because it is at the same time complex
85  enough to exhibit non-trivial dynamics and simple enough compute
86  relevant measures analytically.
87 
88  Remarks:
89 
90  The iaf_psc_delta_canon neuron accepts CurrentEvent connections.
91  However, the present method for transmitting CurrentEvents in
92  NEST (sending the current to be applied) is not compatible with off-grid
93  currents, if more than one CurrentEvent-connection exists. Once CurrentEvents
94  are changed to transmit change-of-current-strength, this problem will
95  disappear and the canonical neuron will also be able to handle CurrentEvents.
96 
97  The present implementation uses individual variables for the
98  components of the state vector and the non-zero matrix elements of
99  the propagator. Because the propagator is a lower triangular matrix
100  no full matrix multiplication needs to be carried out and the
101  computation can be done "in place" i.e. no temporary state vector
102  object is required.
103 
104  The template support of recent C++ compilers enables a more succinct
105  formulation without loss of runtime performance already at minimal
106  optimization levels. A future version of iaf_psc_delta_canon will probably
107  address the problem of efficient usage of appropriate vector and
108  matrix objects.
109 
110  Please note that this node is capable of sending precise spike times
111  to target nodes (on-grid spike time plus offset). If this node is
112  connected to a spike_detector, the property "precise_times" of the
113  spike_detector has to be set to true in order to record the offsets
114  in addition to the on-grid spike times.
115 
116  Parameters:
117  The following parameters can be set in the status dictionary.
118 
119  V_m double - Membrane potential in mV
120  E_L double - Resting membrane potential in mV.
121  C_m double - Specific capacitance of the membrane in pF/mum^2
122  tau_m double - Membrane time constant in ms.
123  t_ref double - Duration of refractory period in ms.
124  V_th double - Spike threshold in mV.
125  V_reset double - Reset potential of the membrane in mV.
126  I_e double - Constant input current in pA.
127  V_min double - Absolute lower value for the membrane potential.
128 
129  refractory_input bool - If true, do not discard input during
130  refractory period. Default: false.
131 
132  References:
133  [1] Rotter S & Diesmann M (1999) Exact simulation of time-invariant linear
134  systems with applications to neuronal modeling. Biologial Cybernetics
135  81:381-402.
136  [2] Diesmann M, Gewaltig M-O, Rotter S, & Aertsen A (2001) State space
137  analysis of synchronous spiking in cortical neural networks.
138  Neurocomputing 38-40:565-571.
139  [3] Morrison A, Straube S, Plesser H E, & Diesmann M (2006) Exact Subthreshold
140  Integration with Continuous Spike Times in Discrete Time Neural Network
141  Simulations. To appear in Neural Computation.
142  [4] Hanuschkin A, Kunkel S, Helias M, Morrison A & Diesmann M (2010)
143  A general and efficient method for incorporating exact spike times in
144  globally time-driven simulations Front Neuroinformatics, 4:113
145 
146  Sends: SpikeEvent
147 
148  Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
149 
150  Author: May 2006, Plesser; based on work by Diesmann, Gewaltig, Morrison, Straube, Eppler
151  SeeAlso: iaf_psc_delta, iaf_psc_exp_ps
152  */
153 
155  public Node
156  {
157 
158  public:
159 
165 
174 
179  using Node::handle;
181 
183 
187 
188  void handle(SpikeEvent &);
189  void handle(CurrentEvent &);
190  void handle(DataLoggingRequest &);
191 
192  bool is_off_grid() const {return true;} // uses off_grid events
193 
194  void get_status(DictionaryDatum &) const;
195  void set_status(const DictionaryDatum &) ;
196 
197  private:
198 
204  void init_state_(const Node& proto);
205  void init_buffers_();
206 
207  void calibrate();
208  void update(Time const &, const long_t, const long_t);
209 
210  void set_spiketime(Time const &);
211  Time get_spiketime() const;
212 
224  void emit_spike_(Time const& origin, const long_t lag,
225  const double_t offset_U);
226 
234  void emit_instant_spike_(Time const& origin, const long_t lag,
235  const double_t spike_offset);
236 
242  void propagate_(const double_t dt);
243 
244  // ----------------------------------------------------------------
245 
249  struct Parameters_ {
250 
253 
256 
259 
262 
265 
269 
273 
279 
280  Parameters_();
281 
282  void get(DictionaryDatum&) const;
283 
287  double set(const DictionaryDatum&);
288  };
289 
290 
291  // The next two classes need to be friends to access the State_ class/member
293  friend class UniversalDataLogger<iaf_psc_delta_canon>;
294 
295  // ----------------------------------------------------------------
296 
300  struct State_ {
303 
306 
309 
310  State_();
311 
312  void get(DictionaryDatum&, const Parameters_&) const;
313 
319  void set(const DictionaryDatum&, const Parameters_&, double);
320  };
321 
322  // ----------------------------------------------------------------
323 
327  struct Buffers_ {
330 
337 
342 
345  };
346 
347  // ----------------------------------------------------------------
348 
352  struct Variables_ {
357 
359 
361 
366  };
367 
368  // Access functions for UniversalDataLogger -------------------------------
369 
371  double_t get_V_m_() const { return S_.U_ + P_.E_L_; }
372 
373  // ----------------------------------------------------------------
374 
390 
391  };
392 
393 
394 inline
396 {
397  SpikeEvent e;
398  e.set_sender(*this);
399  return target.handles_test_event(e, receptor_type);
400 }
401 
402 inline
404 {
405  if (receptor_type != 0)
406  throw UnknownReceptorType(receptor_type, get_name());
407  return 0;
408 }
409 
410 inline
412 {
413  if (receptor_type != 0)
414  throw UnknownReceptorType(receptor_type, get_name());
415  return 0;
416 }
417 
418 inline
421 {
422  if (receptor_type != 0)
423  throw UnknownReceptorType(receptor_type, get_name());
424  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
425 }
426 
427  inline
429  {
431  }
432 
433  inline
435  {
436  P_.get(d);
437  S_.get(d, P_);
438  (*d)[names::recordables] = recordablesMap_.get_list();
439  }
440 
441  inline
443  {
444  Parameters_ ptmp = P_; // temporary copy in case of errors
445  const double delta_EL = ptmp.set(d); // throws if BadProperty
446  State_ stmp = S_; // temporary copy in case of errors
447  stmp.set(d, ptmp, delta_EL); // throws if BadProperty
448 
449  // if we get here, temporaries contain consistent set of properties
450  P_ = ptmp;
451  S_ = stmp;
452  }
453 
454 } // namespace
455 
456 #endif //IAF_PSC_DELTA_CANON_H
bool is_off_grid() const
Returns true if the node if it sends/receives -grid events This is used to discriminate between diffe...
Definition: iaf_psc_delta_canon.h:192
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
double_t U_reset_
Reset potential.
Definition: iaf_psc_delta_canon.h:278
Parameters_ P_
Definition: iaf_psc_delta_canon.h:382
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
void get_status(DictionaryDatum &) const
Definition: iaf_psc_delta_canon.h:434
iaf_psc_delta_canon()
Basic constructor.
Definition: iaf_psc_delta_canon.cpp:173
double_t U_th_
Threshold, RELATIVE TO RESTING POTENTAIL(!).
Definition: iaf_psc_delta_canon.h:268
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
Declarations for base class Node.
double set(const DictionaryDatum &)
Set values from dictionary.
Definition: iaf_psc_delta_canon.cpp:98
static RecordablesMap< iaf_psc_delta_canon > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_psc_delta_canon.h:389
State variables of the model.
Definition: iaf_psc_delta_canon.h:300
double_t U_min_
Lower bound, RELATIVE TO RESTING POTENTAIL(!).
Definition: iaf_psc_delta_canon.h:272
Definition: iaf_psc_delta_canon.h:154
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
double_t get_V_m_() const
Read out the real membrane potential.
Definition: iaf_psc_delta_canon.h:371
bool is_refractory_
flag for refractoriness
Definition: iaf_psc_delta_canon.h:307
double_t tau_m_
Membrane time constant in ms.
Definition: iaf_psc_delta_canon.h:252
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_psc_delta_canon.cpp:207
double_t h_ms_
duration of time step [ms]
Definition: iaf_psc_delta_canon.h:358
double_t v_inf_
$ {I_e}{c_m} $
Definition: iaf_psc_delta_canon.h:355
void emit_instant_spike_(Time const &origin, const long_t lag, const double_t spike_offset)
Emit a single spike caused instantly by an input spike.
Definition: iaf_psc_delta_canon.cpp:444
Event for electrical currents.
Definition: event.h:420
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
Variables_ V_
Definition: iaf_psc_delta_canon.h:384
Queue for all spikes arriving into a neuron.
Definition: slice_ring_buffer.h:56
long_t last_spike_step_
step of last spike, for reporting in status dict
Definition: iaf_psc_delta_canon.h:304
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_psc_delta_canon.cpp:193
Buffers_ B_
Definition: iaf_psc_delta_canon.h:385
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_psc_delta_canon.cpp:465
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_psc_delta_canon.cpp:86
State_()
Default initialization.
Definition: iaf_psc_delta_canon.cpp:73
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: iaf_psc_delta_canon.cpp:225
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_psc_delta_canon.h:403
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_psc_delta_canon.cpp:199
void set_spiketime(Time const &)
Definition: iaf_psc_delta_canon.cpp:496
Map names of recordables to data access functions.
Definition: recordables_map.h:58
double_t expm1_t_
$ e^{-t/} - 1 $
Definition: iaf_psc_delta_canon.h:354
void get(DictionaryDatum &, const Parameters_ &) const
Definition: iaf_psc_delta_canon.cpp:143
double_t E_L_
Resting potential in mV.
Definition: iaf_psc_delta_canon.h:261
Definition: nest_time.h:130
SliceRingBuffer events_
Queue for incoming events.
Definition: iaf_psc_delta_canon.h:336
std::string get_name() const
Return class name.
Definition: node.cpp:83
void propagate_(const double_t dt)
Propagate neuron state.
Definition: iaf_psc_delta_canon.cpp:406
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
Buffers_(iaf_psc_delta_canon &)
Definition: iaf_psc_delta_canon.cpp:161
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
double_t I_contrib_
$ {I_e}{c_m} (1-e^{-t/})$
Definition: iaf_psc_delta_canon.h:356
const Name origin("origin")
Device parameters.
Definition: nest_names.h:215
double_t I_
This is the current to be applied during this time step.
Definition: iaf_psc_delta_canon.h:302
RingBuffer currents_
Queue for incoming current events.
Definition: iaf_psc_delta_canon.h:341
void set(const DictionaryDatum &, const Parameters_ &, double)
Set values from dictionary.
Definition: iaf_psc_delta_canon.cpp:153
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
friend struct step
Definition: nest_time.h:171
State_ S_
Definition: iaf_psc_delta_canon.h:383
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
double double_t
Double precision floating point numbers.
Definition: nest.h:93
const Name dt("dt")
Miscellaneous parameters.
Definition: nest_names.h:105
long_t refractory_steps_
refractory time in steps
Definition: iaf_psc_delta_canon.h:360
Independent parameters of the model.
Definition: iaf_psc_delta_canon.h:249
virtual port handles_test_event(SpikeEvent &, rport receptor_type)
Check if the node can handle a particular event and receptor type.
Definition: node.cpp:203
double_t c_m_
Membrane capacitance in pF.
Definition: iaf_psc_delta_canon.h:255
Request data to be logged/logged data to be sent.
Definition: event.h:486
double_t last_spike_offset_
offset of last spike, for reporting in status dict
Definition: iaf_psc_delta_canon.h:305
double_t t_ref_
Refractory period in ms.
Definition: iaf_psc_delta_canon.h:258
void set_status(const DictionaryDatum &)
Definition: iaf_psc_delta_canon.h:442
Parameters_()
Sets default parameter values.
Definition: iaf_psc_delta_canon.cpp:62
double_t I_e_
External DC current [pA].
Definition: iaf_psc_delta_canon.h:264
UniversalDataLogger< iaf_psc_delta_canon > logger_
Logger for all analog data.
Definition: iaf_psc_delta_canon.h:344
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
Default types used by the NEST kernel.
Event for spike information.
Definition: event.h:320
Base class for all NEST network objects.
Definition: node.h:96
bool with_refr_input_
spikes arriving during refractory period are counted
Definition: iaf_psc_delta_canon.h:308
double_t exp_t_
$ e^{-t/} $
Definition: iaf_psc_delta_canon.h:353
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_psc_delta_canon.h:395
double_t U_
This is the membrane potential RELATIVE TO RESTING POTENTIAL.
Definition: iaf_psc_delta_canon.h:301
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
Time get_spiketime() const
Definition: iaf_psc_delta_canon.h:428
void emit_spike_(Time const &origin, const long_t lag, const double_t offset_U)
Emit a single spike caused by DC current in absence of spike input.
Definition: iaf_psc_delta_canon.cpp:419
const double e
Definition: numerics.cpp:62
Buffers of the model.
Definition: iaf_psc_delta_canon.h:327
friend class UniversalDataLogger< iaf_psc_delta_canon >
Definition: iaf_psc_delta_canon.h:293
Internal variables of the model.
Definition: iaf_psc_delta_canon.h:352
Buffer Layout.
Definition: ring_buffer.h:77
double_t refr_spikes_buffer_
Accumulate spikes arriving during refractory period, discounted for decay until end of refractory per...
Definition: iaf_psc_delta_canon.h:365