NEST  2.6.0,not_revisioned_source_dir@0
iaf_psc_alpha_canon.h
Go to the documentation of this file.
1 /*
2  * iaf_psc_alpha_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_ALPHA_CANON_H
24 #define IAF_PSC_ALPHA_CANON_H
25 
26 #include "config.h"
27 
28 #include "nest.h"
29 #include "event.h"
30 #include "node.h"
31 #include "ring_buffer.h"
32 #include "slice_ring_buffer.h"
33 #include "connection.h"
34 
35 #include "universal_data_logger.h"
36 
37 #include <vector>
38 
39 /*BeginDocumentation
40 Name: iaf_psc_alpha_canon - Leaky integrate-and-fire neuron
41 with alpha-shape postsynaptic currents; canoncial implementation.
42 
43 Description:
44 iaf_psc_alpha_canon is the "canonical" implementatoin of the leaky
45 integrate-and-fire model neuron with alpha-shaped postsynaptic
46 currents in the sense of [1]. This is the most exact implementation
47 available.
48 
49 PSCs are normalized to an amplitude of 1pA.
50 
51 The canonical implementation handles neuronal dynamics in a locally
52 event-based manner with in coarse time grid defined by the minimum
53 delay in the network, see [1]. Incoming spikes are applied at the
54 precise moment of their arrival, while the precise time of outgoing
55 spikes is determined by interpolation once a threshold crossing has
56 been detected. Return from refractoriness occurs precisly at spike
57 time plus refractory period.
58 
59 This implementation is more complex than the plain iaf_psc_alpha
60 neuron, but achieves much higher precision. In particular, it does not
61 suffer any binning of spike times to grid points. Depending on your
62 application, the canonical application may provide superior overall
63 performance given an accuracy goal; see [1] for details. Subthreshold
64 dynamics are integrated using exact integration between events [2].
65 
66 Remarks:
67 The iaf_psc_delta_canon neuron does not accept CurrentEvent connections.
68 This is because the present method for transmitting CurrentEvents in
69 NEST (sending the current to be applied) is not compatible with off-grid
70 currents, if more than one CurrentEvent-connection exists. Once CurrentEvents
71 are changed to transmit change-of-current-strength, this problem will
72 disappear and the canonical neuron will also be able to handle CurrentEvents.
73 For now, the only way to inject a current is the built-in current I_e.
74 
75 Please note that this node is capable of sending precise spike times
76 to target nodes (on-grid spike time plus offset). If this node is
77 connected to a spike_detector, the property "precise_times" of the
78 spike_detector has to be set to true in order to record the offsets
79 in addition to the on-grid spike times.
80 
81 A further improvement of precise simulation is implemented in iaf_psc_exp_ps
82 based on [3].
83 
84 Parameters:
85 The following parameters can be set in the status dictionary.
86 
87  V_m double - Membrane potential in mV
88  E_L double - Resting membrane potential in mV.
89  V_min double - Absolute lower value for the membrane potential.
90  C_m double - Capacity of the membrane in pF
91  tau_m double - Membrane time constant in ms.
92  t_ref double - Duration of refractory period in ms.
93  V_th double - Spike threshold in mV.
94  V_reset double - Reset potential of the membrane in mV.
95  tau_syn double - Rise time of the synaptic alpha function in ms.
96  I_e double - Constant external input current in pA.
97  Interpol_Order int - Interpolation order for spike time:
98  0-none, 1-linear, 2-quadratic, 3-cubic
99 
100 Note:
101  tau_m != tau_syn is required by the current implementation to avoid a
102  degenerate case of the ODE describing the model [1]. For very similar values,
103  numerics will be unstable.
104 
105 References:
106 [1] Morrison A, Straube S, Plesser H E, & Diesmann M (2006) Exact Subthreshold
107  Integration with Continuous Spike Times in Discrete Time Neural Network
108  Simulations. To appear in Neural Computation.
109 [2] Rotter S & Diesmann M (1999) Exact simulation of time-invariant linear
110  systems with applications to neuronal modeling. Biologial Cybernetics
111  81:381-402.
112 [3] Hanuschkin A, Kunkel S, Helias M, Morrison A & Diesmann M (2010)
113  A general and efficient method for incorporating exact spike times in
114  globally time-driven simulations Front Neuroinformatics, 4:113
115 
116 Author: Diesmann, Eppler, Morrison, Plesser, Straube
117 
118 Sends: SpikeEvent
119 
120 Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
121 
122 SeeAlso: iaf_psc_alpha, iaf_psc_alpha_presc, iaf_psc_exp_ps
123 
124 */
125 
126 namespace nest{
127 
135  public Node
136  {
137 
138  class Network;
139 
140  public:
141 
147 
156 
161  using Node::handle;
163 
165 
169 
170  void handle(SpikeEvent &);
171  void handle(CurrentEvent&);
172  void handle(DataLoggingRequest &);
173 
174  bool is_off_grid() const {return true;} // uses off_grid events
175 
176  void get_status(DictionaryDatum &) const;
177  void set_status(const DictionaryDatum &);
178 
179  private:
180 
186  void init_state_(const Node& proto);
187  void init_buffers_();
188  void calibrate();
189 
207  void update(Time const & origin, const long_t from, const long_t to);
208 
210 
211  void set_spiketime(Time const &);
212 
218  void propagate_(const double_t dt);
219 
231  void emit_spike_(Time const& origin, const long_t lag,
232  const double_t t0, const double_t dt);
233 
241  void emit_instant_spike_(Time const& origin, const long_t lag,
242  const double_t spike_offset);
243 
251 
254 
262  double_t thresh_find_(double_t const) const;
263  double_t thresh_find1_(double_t const) const;
264  double_t thresh_find2_(double_t const) const;
265  double_t thresh_find3_(double_t const) const;
267 
268 
269  // The next two classes need to be friends to access the State_ class/member
271  friend class UniversalDataLogger<iaf_psc_alpha_canon>;
272 
273  // ----------------------------------------------------------------
274 
278  struct Parameters_ {
279 
282 
285 
288 
291 
294 
297 
301 
305 
311 
314 
315  Parameters_();
316 
317  void get(DictionaryDatum&) const;
318 
322  double set(const DictionaryDatum&);
323  };
324 
325  // ----------------------------------------------------------------
326 
330  struct State_ {
338 
339  State_();
340 
341  void get(DictionaryDatum&, const Parameters_&) const;
342 
348  void set(const DictionaryDatum&, const Parameters_&, double);
349  };
350 
351  // ----------------------------------------------------------------
352 
356  struct Buffers_ {
359 
366 
369  };
370 
371  // ----------------------------------------------------------------
372 
376  struct Variables_ {
390  };
391 
392  // Access functions for UniversalDataLogger -------------------------------
393 
395  double_t get_V_m_() const { return S_.y3_ + P_.E_L_; }
396 
398  double_t get_y1_() const { return S_.y1_; }
399 
401  double_t get_y2_() const { return S_.y2_; }
402 
403  // ----------------------------------------------------------------
404 
420  };
421 
422 inline
424 {
425  SpikeEvent e;
426  e.set_sender(*this);
427  return target.handles_test_event(e, receptor_type);
428 }
429 
430 inline
432 {
433  if (receptor_type != 0)
434  throw UnknownReceptorType(receptor_type, get_name());
435  return 0;
436 }
437 
438 inline
440 {
441  if (receptor_type != 0)
442  throw UnknownReceptorType(receptor_type, get_name());
443  return 0;
444 }
445 
446 inline
449 {
450  if (receptor_type != 0)
451  throw UnknownReceptorType(receptor_type, get_name());
452  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
453 }
454 
455 inline
457 {
458  P_.get(d);
459  S_.get(d, P_);
460  (*d)[names::recordables] = recordablesMap_.get_list();
461 }
462 
463 inline
465 {
466  Parameters_ ptmp = P_; // temporary copy in case of errors
467  const double delta_EL = ptmp.set(d); // throws if BadProperty
468  State_ stmp = S_; // temporary copy in case of errors
469  stmp.set(d, ptmp, delta_EL); // throws if BadProperty
470 
471  // if we get here, temporaries contain consistent set of properties
472  P_ = ptmp;
473  S_ = stmp;
474 }
475 
476 } // namespace
477 
478 #endif //IAF_PSC_ALPHA_CANON_H
double_t y2_before_
y2_ at beginning of mini-step, for interpolation
Definition: iaf_psc_alpha_canon.h:388
double_t I_e_
External DC current [pA].
Definition: iaf_psc_alpha_canon.h:296
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
double_t E_L_
Resting potential in mV.
Definition: iaf_psc_alpha_canon.h:293
double_t P32_
progagator matrix elem, 3rd row
Definition: iaf_psc_alpha_canon.h:386
double_t y0_
external input current
Definition: iaf_psc_alpha_canon.h:331
double_t PSCInitialValue_
e / tau_syn
Definition: iaf_psc_alpha_canon.h:378
Buffers_(iaf_psc_alpha_canon &)
Definition: iaf_psc_alpha_canon.cpp:185
Definition: iaf_psc_alpha_canon.h:253
void propagate_(const double_t dt)
Propagate neuron state.
Definition: iaf_psc_alpha_canon.cpp:427
double_t expm1_tau_syn_
exp(-h/tau_syn) - 1
Definition: iaf_psc_alpha_canon.h:383
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
double_t y3_before_
y3_ at beginning of mini-step, for interpolation
Definition: iaf_psc_alpha_canon.h:389
Definition: lockptrdatum.h:40
void set(const DictionaryDatum &, const Parameters_ &, double)
Set values from dictionary.
Definition: iaf_psc_alpha_canon.cpp:174
Parameters_()
Sets default parameter values.
Definition: iaf_psc_alpha_canon.cpp:62
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
double_t tau_m_
Membrane time constant in ms.
Definition: iaf_psc_alpha_canon.h:281
Declarations for base class Node.
Parameters_ P_
Definition: iaf_psc_alpha_canon.h:412
double_t last_spike_offset_
offset of most recent spike
Definition: iaf_psc_alpha_canon.h:337
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
long_t refractory_steps_
refractory time in steps
Definition: iaf_psc_alpha_canon.h:379
Definition: iaf_psc_alpha_canon.h:253
Buffers_ B_
Definition: iaf_psc_alpha_canon.h:415
UniversalDataLogger< iaf_psc_alpha_canon > logger_
Logger for all analog data.
Definition: iaf_psc_alpha_canon.h:368
double_t y3_
Membrane pot. rel. to resting pot. E_L_.
Definition: iaf_psc_alpha_canon.h:334
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
bool is_refractory_
true while refractory
Definition: iaf_psc_alpha_canon.h:335
State variables of the model.
Definition: iaf_psc_alpha_canon.h:330
Queue for all spikes arriving into a neuron.
Definition: slice_ring_buffer.h:56
double_t get_y2_() const
Read out state variable y2.
Definition: iaf_psc_alpha_canon.h:401
double_t gamma_
1/c_m * 1/(1/tau_syn - 1/tau_m)
Definition: iaf_psc_alpha_canon.h:380
void update(Time const &origin, const long_t from, const long_t to)
Time Evolution Operator.
Definition: iaf_psc_alpha_canon.cpp:263
double_t thresh_find1_(double_t const) const
Definition: iaf_psc_alpha_canon.cpp:512
SliceRingBuffer events_
Queue for incoming events.
Definition: iaf_psc_alpha_canon.h:364
State_()
Default initialization.
Definition: iaf_psc_alpha_canon.cpp:75
double_t y1_
alpha current, first component
Definition: iaf_psc_alpha_canon.h:332
Map names of recordables to data access functions.
Definition: recordables_map.h:58
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_psc_alpha_canon.h:423
Leaky iaf neuron, alpha PSC synapses, canonical implementation.
Definition: iaf_psc_alpha_canon.h:134
Definition: nest_time.h:130
friend class UniversalDataLogger< iaf_psc_alpha_canon >
Definition: iaf_psc_alpha_canon.h:271
double_t thresh_find3_(double_t const) const
Definition: iaf_psc_alpha_canon.cpp:540
Definition: iaf_psc_alpha_canon.h:253
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_psc_alpha_canon.cpp:89
Independent parameters of the model.
Definition: iaf_psc_alpha_canon.h:278
std::string get_name() const
Return class name.
Definition: node.cpp:83
double_t y2_
alpha current, second component
Definition: iaf_psc_alpha_canon.h:333
double_t U_reset_
Reset potential.
Definition: iaf_psc_alpha_canon.h:310
interpOrder
Interpolation orders.
Definition: iaf_psc_alpha_canon.h:253
double_t tau_syn_
Time constant of synaptic current in ms.
Definition: iaf_psc_alpha_canon.h:284
double_t y0_before_
y0_ at beginning of mini-step, forinterpolation
Definition: iaf_psc_alpha_canon.h:387
double_t gamma_sq_
1/c_m * 1/(1/tau_syn - 1/tau_m)^2
Definition: iaf_psc_alpha_canon.h:381
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
Variables_ V_
Definition: iaf_psc_alpha_canon.h:414
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
double_t thresh_find2_(double_t const) const
Definition: iaf_psc_alpha_canon.cpp:519
double_t get_y1_() const
Read out state variable y1.
Definition: iaf_psc_alpha_canon.h:398
interpOrder Interpol_
Interpolation order.
Definition: iaf_psc_alpha_canon.h:313
double_t h_ms_
time resolution in ms
Definition: iaf_psc_alpha_canon.h:377
Main administrative interface to the network.
Definition: network.h:135
const Name origin("origin")
Device parameters.
Definition: nest_names.h:215
void emit_instant_spike_(Time const &origin, const long_t lag, const double_t spike_offset)
Emit a single spike at a precisely given time.
Definition: iaf_psc_alpha_canon.cpp:475
double_t get_V_m_() const
Read out the real membrane potential.
Definition: iaf_psc_alpha_canon.h:395
void set_status(const DictionaryDatum &)
Definition: iaf_psc_alpha_canon.h:464
Internal variables of the model.
Definition: iaf_psc_alpha_canon.h:376
long_t last_spike_step_
time stamp of most recent spike
Definition: iaf_psc_alpha_canon.h:336
double_t P31_
progagator matrix elem, 3rd row
Definition: iaf_psc_alpha_canon.h:385
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_psc_alpha_canon.cpp:232
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
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
void get_status(DictionaryDatum &) const
Definition: iaf_psc_alpha_canon.h:456
void emit_spike_(Time const &origin, const long_t lag, const double_t t0, const double_t dt)
Emit a single spike caused by DC current in absence of spike input.
Definition: iaf_psc_alpha_canon.cpp:453
const Name dt("dt")
Miscellaneous parameters.
Definition: nest_names.h:105
double_t thresh_find_(double_t const) const
Localize threshold crossing.
Definition: iaf_psc_alpha_canon.cpp:498
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 U_min_
Lower bound, RELATIVE TO RESTING POTENTAIL(!).
Definition: iaf_psc_alpha_canon.h:304
Request data to be logged/logged data to be sent.
Definition: event.h:486
Definition: iaf_psc_alpha_canon.h:253
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
double_t t_ref_
Refractory period in ms.
Definition: iaf_psc_alpha_canon.h:290
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_psc_alpha_canon.h:431
static RecordablesMap< iaf_psc_alpha_canon > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_psc_alpha_canon.h:419
void get(DictionaryDatum &, const Parameters_ &) const
Definition: iaf_psc_alpha_canon.cpp:163
Default types used by the NEST kernel.
double_t U_th_
Threshold, RELATIVE TO RESTING POTENTAIL(!).
Definition: iaf_psc_alpha_canon.h:300
Event for spike information.
Definition: event.h:320
iaf_psc_alpha_canon()
Basic constructor.
Definition: iaf_psc_alpha_canon.cpp:198
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_psc_alpha_canon.cpp:224
Base class for all NEST network objects.
Definition: node.h:96
void set_spiketime(Time const &)
Definition: iaf_psc_alpha_canon.cpp:422
Definition: iaf_psc_alpha_canon.h:253
double set(const DictionaryDatum &)
Set values from dictionary.
Definition: iaf_psc_alpha_canon.cpp:103
double_t P30_
progagator matrix elem, 3rd row
Definition: iaf_psc_alpha_canon.h:384
double_t c_m_
Membrane capacitance in pF.
Definition: iaf_psc_alpha_canon.h:287
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
Buffers of the model.
Definition: iaf_psc_alpha_canon.h:356
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_psc_alpha_canon.cpp:389
const double e
Definition: numerics.cpp:62
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_psc_alpha_canon.cpp:218
RingBuffer currents_
Definition: iaf_psc_alpha_canon.h:365
double_t expm1_tau_m_
exp(-h/tau_m) - 1
Definition: iaf_psc_alpha_canon.h:382
Buffer Layout.
Definition: ring_buffer.h:77
State_ S_
Definition: iaf_psc_alpha_canon.h:413
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_alpha_canon.h:174