NEST  2.6.0,not_revisioned_source_dir@0
iaf_psc_alpha_presc.h
Go to the documentation of this file.
1 /*
2  * iaf_psc_alpha_presc.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_PRESC_H
24 #define IAF_PSC_ALPHA_PRESC_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 "connection.h"
33 
34 #include "universal_data_logger.h"
35 
36 #include <vector>
37 
38 /*BeginDocumentation
39  Name: iaf_psc_alpha_presc - Leaky integrate-and-fire neuron
40  with alpha-shape postsynaptic currents; prescient implementation.
41 
42  Description:
43  iaf_psc_alpha_presc is the "prescient" implementation of the leaky
44  integrate-and-fire model neuron with alpha-shaped postsynaptic
45  currents in the sense of [1].
46 
47  PSCs are normalized to an amplitude of 1pA.
48 
49  The prescient implementation predicts the effect of spikes arriving
50  during a time step by exactly integrating their effect from the
51  precise time of spike arrival to the end of the time step. This is
52  exact if the neuron was not refractory at the beginning of the
53  interval and remains subthreshold throughout the
54  interval. Subthreshold dynamics are integrated using exact integration
55  between events [2].
56 
57  Parameters:
58  The following parameters can be set in the status dictionary.
59 
60 
61  V_m double - Membrane potential in mV
62  E_L double - Resting membrane potential in mV.
63  V_min double - Absolute lower value for the membrane potential.
64  C_m double - Capacity of the membrane in pF
65  tau_m double - Membrane time constant in ms.
66  t_ref double - Duration of refractory period in ms.
67  V_th double - Spike threshold in mV.
68  V_reset double - Reset potential of the membrane in mV.
69  tau_syn double - Rise time of the synaptic alpha function in ms.
70  I_e double - Constant external input current in pA.
71  Interpol_Order int - Interpolation order for spike time:
72  0-none, 1-linear, 2-quadratic, 3-cubic
73 
74  Remarks:
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  Note:
82  tau_m != tau_syn is required by the current implementation to avoid a
83  degenerate case of the ODE describing the model [1]. For very similar values,
84  numerics will be unstable.
85 
86  References:
87  [1] Morrison A, Straube S, Plesser H E, & Diesmann M (2006) Exact Subthreshold
88  Integration with Continuous Spike Times in Discrete Time Neural Network
89  Simulations. To appear in Neural Computation.
90  [2] Rotter S & Diesmann M (1999) Exact simulation of time-invariant linear
91  systems with applications to neuronal modeling. Biologial Cybernetics
92  81:381-402.
93 
94  Author: Diesmann, Eppler, Morrison, Plesser, Straube
95 
96  Sends: SpikeEvent
97 
98  Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
99 
100  SeeAlso: iaf_psc_alpha, iaf_psc_alpha_canon, iaf_psc_delta_canon
101 
102 */
103 
104 namespace nest{
105 
113  public Node
114  {
115 
116  class Network;
117 
118  public:
119 
125 
134 
139  using Node::handle;
141 
143 
144  void handle(SpikeEvent &);
145  void handle(CurrentEvent &);
146  void handle(DataLoggingRequest &);
147 
151 
152  bool is_off_grid() const {return true;} // uses off_grid events
153 
154  void get_status(DictionaryDatum &) const;
155  void set_status(const DictionaryDatum &) ;
156 
157  private:
158 
166  void init_state_(const Node& proto);
167  void init_buffers_();
168  void calibrate();
169 
187  void update(Time const & origin, const long_t from, const long_t to);
188 
190 
191  Time get_spiketime() const;
192  void set_spiketime(Time const &);
193 
197  double_t update_y3_delta_() const;
198 
206 
209 
217  double_t thresh_find_(const double_t) const;
218  double_t thresh_find1_(const double_t) const;
219  double_t thresh_find2_(const double_t) const;
220  double_t thresh_find3_(const double_t) const;
222 
223  // The next two classes need to be friends to access the State_ class/member
225  friend class UniversalDataLogger<iaf_psc_alpha_presc>;
226 
227  // ----------------------------------------------------------------
228 
232  struct Parameters_ {
233 
236 
239 
242 
245 
248 
251 
255 
259 
265 
268 
269  Parameters_();
270 
271  void get(DictionaryDatum&) const;
272 
276  double set(const DictionaryDatum&);
277  };
278 
279  // ----------------------------------------------------------------
280 
284  struct State_ {
289 
291 
294 
295  State_();
296 
297  void get(DictionaryDatum&, const Parameters_&) const;
298 
304  void set(const DictionaryDatum&, const Parameters_&, double);
305  };
306 
307  // ----------------------------------------------------------------
308 
312  struct Buffers_ {
315 
320 
323  };
324 
325  // ----------------------------------------------------------------
326 
330  struct Variables_ {
335 
345 
347  };
348 
349  // Access functions for UniversalDataLogger -------------------------------
350 
352  double_t get_V_m_() const { return S_.y3_ + P_.E_L_; }
353 
354  // ----------------------------------------------------------------
355 
371 
372  };
373 
374 
375 
376 inline
378 {
379  SpikeEvent e;
380  e.set_sender(*this);
381  return target.handles_test_event(e, receptor_type);
382 }
383 
384 inline
386 {
387  if (receptor_type != 0)
388  throw UnknownReceptorType(receptor_type, get_name());
389  return 0;
390 }
391 
392 inline
394 {
395  if (receptor_type != 0)
396  throw UnknownReceptorType(receptor_type, get_name());
397  return 0;
398 }
399 
400 inline
403 {
404  if (receptor_type != 0)
405  throw UnknownReceptorType(receptor_type, get_name());
406  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
407 }
408 
409  inline
411  {
412  P_.get(d);
413  S_.get(d, P_);
414  (*d)[names::recordables] = recordablesMap_.get_list();
415  }
416 
417  inline
419  {
420  Parameters_ ptmp = P_; // temporary copy in case of errors
421  const double delta_EL = ptmp.set(d); // throws if BadProperty
422  State_ stmp = S_; // temporary copy in case of errors
423  stmp.set(d, ptmp, delta_EL); // throws if BadProperty
424 
425  // if we get here, temporaries contain consistent set of properties
426  P_ = ptmp;
427  S_ = stmp;
428  }
429 
430 } // namespace
431 
432 #endif //IAF_PSC_ALPHA_PRESC_H
double_t thresh_find2_(const double_t) const
Definition: iaf_psc_alpha_presc.cpp:489
double_t t_ref_
Refractory period in ms.
Definition: iaf_psc_alpha_presc.h:244
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_psc_alpha_presc.cpp:209
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
double_t y3_
Membrane pot. rel. to resting pot. E_L_.
Definition: iaf_psc_alpha_presc.h:288
double_t h_ms_
time resolution in ms
Definition: iaf_psc_alpha_presc.h:336
RingBuffer spike_y3_
membrane potential
Definition: iaf_psc_alpha_presc.h:318
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_psc_alpha_presc.cpp:372
long_t last_spike_step_
time stamp of most recent spike
Definition: iaf_psc_alpha_presc.h:292
static RecordablesMap< iaf_psc_alpha_presc > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_psc_alpha_presc.h:370
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
UniversalDataLogger< iaf_psc_alpha_presc > logger_
Logger for all analog data.
Definition: iaf_psc_alpha_presc.h:322
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
Declarations for base class Node.
double_t y0_
external input current
Definition: iaf_psc_alpha_presc.h:285
Buffers_ B_
Definition: iaf_psc_alpha_presc.h:366
double_t y2_
alpha current, second component
Definition: iaf_psc_alpha_presc.h:287
void set(const DictionaryDatum &, const Parameters_ &, double)
Set values from dictionary.
Definition: iaf_psc_alpha_presc.cpp:169
double_t thresh_find1_(const double_t) const
Definition: iaf_psc_alpha_presc.cpp:482
double_t P32_
progagator matrix elem, 3rd row
Definition: iaf_psc_alpha_presc.h:344
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
State_ S_
Definition: iaf_psc_alpha_presc.h:364
Parameters_ P_
Definition: iaf_psc_alpha_presc.h:363
double_t y1_before_
y1_ at beginning of mini-step, for interpolation
Definition: iaf_psc_alpha_presc.h:332
double_t U_th_
Threshold, RELATIVE TO RESTING POTENTAIL(!).
Definition: iaf_psc_alpha_presc.h:254
Definition: iaf_psc_alpha_presc.h:208
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_psc_alpha_presc.cpp:225
double_t thresh_find3_(const double_t) const
Definition: iaf_psc_alpha_presc.cpp:510
double_t U_reset_
Reset potential.
Definition: iaf_psc_alpha_presc.h:264
State variables of the model.
Definition: iaf_psc_alpha_presc.h:284
Time get_spiketime() const
Definition: iaf_psc_alpha_presc.cpp:420
double_t gamma_
1/c_m * 1/(1/tau_syn - 1/tau_m)
Definition: iaf_psc_alpha_presc.h:338
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_alpha_presc.h:365
double_t thresh_find_(const double_t) const
Localize threshold crossing.
Definition: iaf_psc_alpha_presc.cpp:466
RingBuffer spike_y1_
first alpha component
Definition: iaf_psc_alpha_presc.h:316
double_t E_L_
Resting potential in mV.
Definition: iaf_psc_alpha_presc.h:247
void update(Time const &origin, const long_t from, const long_t to)
Time Evolution Operator.
Definition: iaf_psc_alpha_presc.cpp:252
double_t P30_
progagator matrix elem, 3rd row
Definition: iaf_psc_alpha_presc.h:342
double_t gamma_sq_
1/c_m * 1/(1/tau_syn - 1/tau_m)^2
Definition: iaf_psc_alpha_presc.h:339
double_t tau_m_
Membrane time constant in ms.
Definition: iaf_psc_alpha_presc.h:235
RingBuffer spike_y2_
second alpha component
Definition: iaf_psc_alpha_presc.h:317
void get_status(DictionaryDatum &) const
Definition: iaf_psc_alpha_presc.h:410
Definition: iaf_psc_alpha_presc.h:208
State_()
Default initialization.
Definition: iaf_psc_alpha_presc.cpp:73
Map names of recordables to data access functions.
Definition: recordables_map.h:58
iaf_psc_alpha_presc()
Basic constructor.
Definition: iaf_psc_alpha_presc.cpp:189
double_t c_m_
Membrane capacitance in pF.
Definition: iaf_psc_alpha_presc.h:241
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_psc_alpha_presc.cpp:215
Definition: nest_time.h:130
interpOrder Interpol_
Interpolation order.
Definition: iaf_psc_alpha_presc.h:267
std::string get_name() const
Return class name.
Definition: node.cpp:83
void set_status(const DictionaryDatum &)
Definition: iaf_psc_alpha_presc.h:418
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_psc_alpha_presc.h:377
Definition: iaf_psc_alpha_presc.h:208
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_psc_alpha_presc.h:385
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
void get(DictionaryDatum &, const Parameters_ &) const
Definition: iaf_psc_alpha_presc.cpp:161
double_t tau_syn_
Time constant of synaptic current in ms.
Definition: iaf_psc_alpha_presc.h:238
double_t y3_before_
y3_ at beginning of mini-step, for interpolation
Definition: iaf_psc_alpha_presc.h:334
Main administrative interface to the network.
Definition: network.h:135
double_t expm1_tau_m_
exp(-h/tau_m) - 1
Definition: iaf_psc_alpha_presc.h:340
const Name origin("origin")
Device parameters.
Definition: nest_names.h:215
Definition: iaf_psc_alpha_presc.h:208
Independent parameters of the model.
Definition: iaf_psc_alpha_presc.h:232
double_t PSCInitialValue_
e / tau_syn
Definition: iaf_psc_alpha_presc.h:337
double_t I_e_
External DC current [pA].
Definition: iaf_psc_alpha_presc.h:250
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_psc_alpha_presc.cpp:87
Leaky iaf neuron, alpha PSC synapses, canonical implementation.
Definition: iaf_psc_alpha_presc.h:112
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
Buffers_(iaf_psc_alpha_presc &)
Definition: iaf_psc_alpha_presc.cpp:177
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
Request data to be logged/logged data to be sent.
Definition: event.h:486
RingBuffer currents_
Definition: iaf_psc_alpha_presc.h:319
Parameters_()
Sets default parameter values.
Definition: iaf_psc_alpha_presc.cpp:60
friend class UniversalDataLogger< iaf_psc_alpha_presc >
Definition: iaf_psc_alpha_presc.h:225
double_t y2_before_
y2_ at beginning of mini-step, for interpolation
Definition: iaf_psc_alpha_presc.h:333
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
Internal variables of the model.
Definition: iaf_psc_alpha_presc.h:330
Buffers of the model.
Definition: iaf_psc_alpha_presc.h:312
double_t y1_
alpha current, first component
Definition: iaf_psc_alpha_presc.h:286
Default types used by the NEST kernel.
Event for spike information.
Definition: event.h:320
double_t update_y3_delta_() const
Compute membrane potential after return from refractoriness.
Definition: iaf_psc_alpha_presc.cpp:425
Base class for all NEST network objects.
Definition: node.h:96
long_t refractory_steps_
refractory time in steps remaining
Definition: iaf_psc_alpha_presc.h:346
void set_spiketime(Time const &)
Definition: iaf_psc_alpha_presc.cpp:414
double_t P31_
progagator matrix elem, 3rd row
Definition: iaf_psc_alpha_presc.h:343
double_t y0_before_
y0_ at beginning of mini-step, for interpolation
Definition: iaf_psc_alpha_presc.h:331
double_t expm1_tau_syn_
exp(-h/tau_syn) - 1
Definition: iaf_psc_alpha_presc.h:341
double_t U_min_
Lower bound, RELATIVE TO RESTING POTENTAIL(!).
Definition: iaf_psc_alpha_presc.h:258
double_t get_V_m_() const
Read out the real membrane potential.
Definition: iaf_psc_alpha_presc.h:352
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_presc.h:152
Definition: iaf_psc_alpha_presc.h:208
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
double_t last_spike_offset_
offset of most recent spike
Definition: iaf_psc_alpha_presc.h:293
double set(const DictionaryDatum &)
Set values from dictionary.
Definition: iaf_psc_alpha_presc.cpp:101
const double e
Definition: numerics.cpp:62
long_t r_
refractory steps remaining
Definition: iaf_psc_alpha_presc.h:290
interpOrder
Interpolation orders.
Definition: iaf_psc_alpha_presc.h:208
Buffer Layout.
Definition: ring_buffer.h:77