NEST  2.6.0,not_revisioned_source_dir@0
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 #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 #include "universal_data_logger.h"
35 #include "recordables_map.h"
36 
37 #include <vector>
38 
39 /*BeginDocumentation
40 Name: iaf_psc_exp_ps - Leaky integrate-and-fire neuron
41 with exponential postsynaptic currents; canoncial implementation;
42 bisectioning method for approximation of threshold crossing.
43 
44 Description:
45 iaf_psc_exp_ps is the "canonical" implementation of the leaky
46 integrate-and-fire model neuron with exponential postsynaptic currents
47 that uses the bisectioning method to approximate the timing of a threshold
48 crossing [1,2]. This is the most exact implementation available.
49 
50 The canonical implementation handles neuronal dynamics in a locally
51 event-based manner with in coarse time grid defined by the minimum
52 delay in the network, see [1,2]. Incoming spikes are applied at the
53 precise moment of their arrival, while the precise time of outgoing
54 spikes is determined by bisectioning once a threshold crossing has
55 been detected. Return from refractoriness occurs precisely at spike
56 time plus refractory period.
57 
58 This implementation is more complex than the plain iaf_psc_exp
59 neuron, but achieves much higher precision. In particular, it does not
60 suffer any binning of spike times to grid points. Depending on your
61 application, the canonical application with bisectioning may provide
62 superior overall performance given an accuracy goal; see [1,2] for
63 details. Subthreshold dynamics are integrated using exact integration
64 between events [3].
65 
66 Parameters:
67  The following parameters can be set in the status dictionary.
68  E_L double - Resting membrane potential in mV.
69  C_m double - Specific capacitance of the membrane in pF/mum^2.
70  tau_m double - Membrane time constant in ms.
71  tau_syn_ex double - Excitatory synaptic time constant in ms.
72  tau_syn_in double - Inhibitory synaptic time constant in ms.
73  t_ref double - Duration of refractory period in ms.
74  V_th double - Spike threshold in mV.
75  I_e double - Constant input current in pA.
76  V_min double - Absolute lower value for the membrane potential.
77  V_reset double - Reset value for the membrane potential.
78 
79 Remarks:
80  Please note that this node is capable of sending precise spike times
81  to target nodes (on-grid spike time plus offset). If this node is
82  connected to a spike_detector, the property "precise_times" of the
83  spike_detector has to be set to true in order to record the offsets
84  in addition to the on-grid spike times.
85 
86 Note:
87  tau_m != tau_syn_{ex,in} is required by the current implementation to avoid a
88  degenerate case of the ODE describing the model [1]. For very similar values,
89  numerics will be unstable.
90 
91 References:
92  [1] Morrison A, Straube S, Plesser HE & Diesmann M (2007) Exact subthreshold
93  integration with continuous spike times in discrete time neural network
94  simulations. Neural Comput 19, 47-79
95  [2] Hanuschkin A, Kunkel S, Helias M, Morrison A and Diesmann M (2010) A
96  general and efficient method for incorporating precise spike times in
97  globally timedriven simulations. Front Neuroinform 4:113
98  [3] Rotter S & Diesmann M (1999) Exact simulation of time-invariant linear
99  systems with applications to neuronal modeling. Biol Cybern 81:381-402
100 
101 Author: Kunkel
102 
103 Sends: SpikeEvent
104 
105 Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
106 
107 SeeAlso: iaf_psc_exp, iaf_psc_alpha_canon
108 */
109 
110 namespace nest
111 {
112 
119  class iaf_psc_exp_ps : public Node
120  {
121 
122  class Network;
123 
124  public:
125 
130  iaf_psc_exp_ps();
131 
140 
145  using Node::handle;
147 
149 
153 
154  void handle(SpikeEvent &);
155  void handle(CurrentEvent &);
156  void handle(DataLoggingRequest &);
157 
158  bool is_off_grid() const // uses off_grid events
159  {
160  return true;
161  }
162 
163  void get_status(DictionaryDatum &) const;
164  void set_status(const DictionaryDatum &);
165 
166  private:
167 
173  void init_state_(const Node & proto);
174  void init_buffers_();
175  void calibrate();
176 
194  void update(Time const & origin, const long_t from, const long_t to);
196 
197  // The next two classes need to be friends to access the State_ class/member
199  friend class UniversalDataLogger<iaf_psc_exp_ps>;
200 
201  void set_spiketime(Time const &);
202 
208  void propagate_(const double_t dt);
209 
221  void emit_spike_(const Time & origin, const long_t lag,
222  const double_t t0, const double_t dt);
223 
231  void emit_instant_spike_(const Time & origin, const long_t lag,
232  const double_t spike_offset);
233 
239  double_t bisectioning_(const double_t dt) const;
240 
241  // ----------------------------------------------------------------
242 
246  struct Parameters_
247  {
250 
253 
256 
259 
262 
265 
268 
272 
276 
281 
282  Parameters_();
283 
284  void get(DictionaryDatum &) const;
285 
289  double set(const DictionaryDatum &);
290  };
291 
292  // ----------------------------------------------------------------
293 
297  struct State_
298  {
303 
307 
308  State_();
309 
310  void get(DictionaryDatum &, const Parameters_ &) const;
311 
317  void set(const DictionaryDatum &, const Parameters_ &, double);
318  };
319 
320  // ----------------------------------------------------------------
321 
325  struct Buffers_
326  {
328  Buffers_(const Buffers_ &, iaf_psc_exp_ps &);
329 
336 
339  };
340 
341  // ----------------------------------------------------------------
342 
346  struct Variables_
347  {
360  };
361 
362  // Access functions for UniversalDataLogger -------------------------------
363 
365  double_t get_V_m_() const { return S_.y2_ + P_.E_L_; }
366 
367  // ----------------------------------------------------------------
368 
384  };
385 
386  inline
388  {
389  SpikeEvent e;
390  e.set_sender(*this);
391  return target.handles_test_event(e, receptor_type);
392  }
393 
394  inline
396  {
397  if (receptor_type != 0)
398  throw UnknownReceptorType(receptor_type, get_name());
399  return 0;
400  }
401 
402  inline
404  {
405  if (receptor_type != 0)
406  throw UnknownReceptorType(receptor_type, get_name());
407  return 0;
408  }
409 
410  inline
413  {
414  if (receptor_type != 0)
415  throw UnknownReceptorType(receptor_type, get_name());
416  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
417  }
418 
419  inline
421  {
422  P_.get(d);
423  S_.get(d, P_);
424  }
425 
426  inline
428  {
429  Parameters_ ptmp = P_; // temporary copy in case of errors
430  const double delta_EL = ptmp.set(d); // throws if BadProperty
431  State_ stmp = S_; // temporary copy in case of errors
432  stmp.set(d, ptmp, delta_EL); // throws if BadProperty
433 
434  // if we get here, temporaries contain consistent set of properties
435  P_ = ptmp;
436  S_ = stmp;
437  }
438 
439 } // namespace
440 
441 #endif // IAF_PSC_EXP_PS_H
Buffers of the model.
Definition: iaf_psc_exp_ps.h:325
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_psc_exp_ps.cpp:366
Variables_ V_
Definition: iaf_psc_exp_ps.h:378
double_t get_V_m_() const
Read out the real membrane potential.
Definition: iaf_psc_exp_ps.h:365
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
Declarations for base class Node.
State_ S_
Definition: iaf_psc_exp_ps.h:377
double_t c_m_
Membrane capacitance in pF.
Definition: iaf_psc_exp_ps.h:258
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_psc_exp_ps.cpp:206
double_t h_ms_
Time resolution [ms].
Definition: iaf_psc_exp_ps.h:348
double_t P21_in_
Progagator matrix element, 2nd row.
Definition: iaf_psc_exp_ps.h:354
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
double_t expm1_tau_ex_
exp(-h/tau_ex) - 1
Definition: iaf_psc_exp_ps.h:351
State_()
Default initialization.
Definition: iaf_psc_exp_ps.cpp:71
SliceRingBuffer events_
Queue for incoming events.
Definition: iaf_psc_exp_ps.h:334
void set_spiketime(Time const &)
Definition: iaf_psc_exp_ps.cpp:400
State variables of the model.
Definition: iaf_psc_exp_ps.h:297
double_t y1_in_before_
y1_ at beginning of ministep
Definition: iaf_psc_exp_ps.h:358
Internal variables of the model.
Definition: iaf_psc_exp_ps.h:346
void emit_spike_(const Time &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_exp_ps.cpp:424
double_t y2_before_
y2_ at beginning of ministep
Definition: iaf_psc_exp_ps.h:359
void set_status(const DictionaryDatum &)
Definition: iaf_psc_exp_ps.h:427
double_t bisectioning_(const double_t dt) const
Localize threshold crossing by bisectioning.
Definition: iaf_psc_exp_ps.cpp:466
double_t U_min_
Lower bound, RELATIVE TO RESTING POTENTAIL(!).
Definition: iaf_psc_exp_ps.h:275
double_t y2_
Membrane potential (relative to resting potential)
Definition: iaf_psc_exp_ps.h:302
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
Independent parameters of the model.
Definition: iaf_psc_exp_ps.h:246
Queue for all spikes arriving into a neuron.
Definition: slice_ring_buffer.h:56
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_psc_exp_ps.h:395
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_psc_exp_ps.cpp:93
Parameters_ P_
Definition: iaf_psc_exp_ps.h:376
double set(const DictionaryDatum &)
Set values from dictionary.
Definition: iaf_psc_exp_ps.cpp:107
double_t y1_ex_
Exc. exponetial current.
Definition: iaf_psc_exp_ps.h:300
Map names of recordables to data access functions.
Definition: recordables_map.h:58
Buffers_(iaf_psc_exp_ps &)
Definition: iaf_psc_exp_ps.cpp:81
double_t t_ref_
Refractory period in ms.
Definition: iaf_psc_exp_ps.h:261
Definition: nest_time.h:130
void set(const DictionaryDatum &, const Parameters_ &, double)
Set values from dictionary.
Definition: iaf_psc_exp_ps.cpp:167
std::string get_name() const
Return class name.
Definition: node.cpp:83
double_t tau_ex_
Time constant of exc.
Definition: iaf_psc_exp_ps.h:252
void emit_instant_spike_(const Time &origin, const long_t lag, const double_t spike_offset)
Emit a single spike at a precisely given time.
Definition: iaf_psc_exp_ps.cpp:446
double_t last_spike_offset_
Offset of most recent spike.
Definition: iaf_psc_exp_ps.h:306
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
Main administrative interface to the network.
Definition: network.h:135
double_t tau_m_
Membrane time constant in ms.
Definition: iaf_psc_exp_ps.h:249
const Name origin("origin")
Device parameters.
Definition: nest_names.h:215
long_t last_spike_step_
Time stamp of most recent spike.
Definition: iaf_psc_exp_ps.h:305
double_t U_reset_
Reset potential.
Definition: iaf_psc_exp_ps.h:280
Leaky iaf neuron, exponential PSC synapses, canonical implementation.
Definition: iaf_psc_exp_ps.h:119
double_t P21_ex_
Progagator matrix element, 2nd row.
Definition: iaf_psc_exp_ps.h:355
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_exp_ps.h:158
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
void get(DictionaryDatum &, const Parameters_ &) const
Definition: iaf_psc_exp_ps.cpp:158
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
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 y1_ex_before_
y1_ at beginning of ministep
Definition: iaf_psc_exp_ps.h:357
Request data to be logged/logged data to be sent.
Definition: event.h:486
double_t I_e_
External DC current [pA].
Definition: iaf_psc_exp_ps.h:267
UniversalDataLogger< iaf_psc_exp_ps > logger_
Logger for all analog data.
Definition: iaf_psc_exp_ps.h:338
void propagate_(const double_t dt)
Propagate neuron state.
Definition: iaf_psc_exp_ps.cpp:405
double_t expm1_tau_m_
exp(-h/tau_m) - 1
Definition: iaf_psc_exp_ps.h:350
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_psc_exp_ps.cpp:199
double_t expm1_tau_in_
exp(-h/tau_in) - 1
Definition: iaf_psc_exp_ps.h:352
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
double_t E_L_
Resting potential in mV.
Definition: iaf_psc_exp_ps.h:264
friend class UniversalDataLogger< iaf_psc_exp_ps >
Definition: iaf_psc_exp_ps.h:199
Default types used by the NEST kernel.
double_t y1_in_
Inh. exponetial current.
Definition: iaf_psc_exp_ps.h:301
Event for spike information.
Definition: event.h:320
bool is_refractory_
True while refractory.
Definition: iaf_psc_exp_ps.h:304
double_t y0_before_
y0_ at beginning of ministep
Definition: iaf_psc_exp_ps.h:356
static RecordablesMap< iaf_psc_exp_ps > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_psc_exp_ps.h:383
Base class for all NEST network objects.
Definition: node.h:96
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_psc_exp_ps.h:387
double_t U_th_
Threshold, RELATIVE TO RESTING POTENTAIL(!).
Definition: iaf_psc_exp_ps.h:271
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_psc_exp_ps.cpp:214
RingBuffer currents_
Definition: iaf_psc_exp_ps.h:335
double_t P20_
Progagator matrix element, 2nd row.
Definition: iaf_psc_exp_ps.h:353
double_t y0_
External input current.
Definition: iaf_psc_exp_ps.h:299
double_t tau_in_
Time constant of inh.
Definition: iaf_psc_exp_ps.h:255
long_t refractory_steps_
Refractory time in steps.
Definition: iaf_psc_exp_ps.h:349
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
Buffers_ B_
Definition: iaf_psc_exp_ps.h:379
const double e
Definition: numerics.cpp:62
iaf_psc_exp_ps()
Basic constructor.
Definition: iaf_psc_exp_ps.cpp:179
void get_status(DictionaryDatum &) const
Definition: iaf_psc_exp_ps.h:420
Buffer Layout.
Definition: ring_buffer.h:77
Parameters_()
Sets default parameter values.
Definition: iaf_psc_exp_ps.cpp:58
void update(Time const &origin, const long_t from, const long_t to)
Time Evolution Operator.
Definition: iaf_psc_exp_ps.cpp:235