NEST  2.6.0,not_revisioned_source_dir@0
aeif_cond_exp.h
Go to the documentation of this file.
1 /*
2  * aeif_cond_exp.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 AEIF_COND_EXP_H
24 #define AEIF_COND_EXP_H
25 
26 #include "config.h"
27 
28 #ifdef HAVE_GSL_1_11
29 
30 #include "nest.h"
31 #include "event.h"
32 #include "archiving_node.h"
33 #include "ring_buffer.h"
34 #include "connection.h"
35 #include "universal_data_logger.h"
36 #include "recordables_map.h"
37 
38 #include <gsl/gsl_errno.h>
39 #include <gsl/gsl_matrix.h>
40 #include <gsl/gsl_odeiv.h>
41 
42 /* BeginDocumentation
43 Name: aeif_cond_exp - Conductance based exponential integrate-and-fire neuron model according to Brette and Gerstner (2005).
44 
45 Description:
46 
47 aeif_cond_exp is the adaptive exponential integrate and fire neuron
48 according to Brette and Gerstner (2005), with post-synaptic
49 conductances in the form of truncated exponentials.
50 
51 This implementation uses the embedded 4th order Runge-Kutta-Fehlberg
52 solver with adaptive stepsize to integrate the differential equation.
53 
54 The membrane potential is given by the following differential equation:
55 C dV/dt= -g_L(V-E_L)+g_L*Delta_T*exp((V-V_T)/Delta_T)-g_e(t)(V-E_e) -g_i(t)(V-E_i)-w +I_e
56 
57 and
58 
59 tau_w * dw/dt= a(V-E_L) -W
60 
61 
62 Note that the spike detection threshold V_peak is automatically set to
63 V_th+10 mV to avoid numerical instabilites that may result from
64 setting V_peak too high.
65 
66 Parameters:
67 The following parameters can be set in the status dictionary.
68 
69 Dynamic state variables:
70  V_m double - Membrane potential in mV
71  g_ex double - Excitatory synaptic conductance in nS.
72  g_in double - Inhibitory synaptic conductance in nS.
73  w double - Spike-adaptation current in pA.
74 
75 Membrane Parameters:
76  C_m double - Capacity of the membrane in pF
77  t_ref double - Duration of refractory period in ms.
78  V_reset double - Reset value for V_m after a spike. In mV.
79  E_L double - Leak reversal potential in mV.
80  g_L double - Leak conductance in nS.
81  I_e double - Constant external input current in pA.
82 
83 Spike adaptation parameters:
84  a double - Subthreshold adaptation in nS.
85  b double - Spike-triggered adaptation in pA.
86  Delta_T double - Slope factor in mV
87  tau_w double - Adaptation time constant in ms
88  V_t double - Spike initiation threshold in mV
89  V_peak double - Spike detection threshold in mV.
90 
91 Synaptic parameters
92  E_ex double - Excitatory reversal potential in mV.
93  tau_syn_ex double - Rise time of excitatory synaptic conductance in ms (exp function).
94  E_in double - Inhibitory reversal potential in mV.
95  tau_syn_in double - Rise time of the inhibitory synaptic conductance in ms (exp function).
96 
97 Integration parameters
98  gsl_error_tol double - This parameter controls the admissible error of the GSL integrator.
99  Reduce it if NEST complains about numerical instabilities.
100 
101 Author: Adapted from aeif_cond_alpha by Lyle Muller
102 
103 Sends: SpikeEvent
104 
105 Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
106 
107 References: Brette R and Gerstner W (2005) Adaptive Exponential Integrate-and-Fire Model as
108  an Effective Description of Neuronal Activity. J Neurophysiol 94:3637-3642
109 
110 SeeAlso: iaf_cond_exp, aeif_cond_alpha
111 */
112 
113 namespace nest
114 {
125  extern "C"
126  int aeif_cond_exp_dynamics (double, const double*, double*, void*);
127 
129  public Archiving_Node
130  {
131 
132  public:
133 
134  aeif_cond_exp();
136  ~aeif_cond_exp();
137 
142  using Node::handle;
144 
146 
147  void handle(SpikeEvent &);
148  void handle(CurrentEvent &);
149  void handle(DataLoggingRequest &);
150 
154 
155  void get_status(DictionaryDatum &) const;
156  void set_status(const DictionaryDatum &);
157 
158  private:
159 
160  void init_state_(const Node &proto);
161  void init_buffers_();
162  void calibrate();
163  void update(const Time &, const long_t, const long_t);
164 
165  // END Boilerplate function declarations ----------------------------
166 
167  // Friends --------------------------------------------------------
168 
169  // make dynamics function quasi-member
170  friend int aeif_cond_exp_dynamics(double, const double*, double*, void*);
171 
172  // The next two classes need to be friends to access the State_ class/member
174  friend class UniversalDataLogger<aeif_cond_exp>;
175 
176  private:
177  // ----------------------------------------------------------------
178 
180  struct Parameters_
181  {
185 
200 
202 
203  Parameters_();
204 
205  void get(DictionaryDatum &) const;
206  void set(const DictionaryDatum &);
207  };
208 
209  public:
210  // ----------------------------------------------------------------
211 
217  struct State_
218  {
226  {
227  V_M = 0,
228  G_EXC , // 1
229  G_INH , // 2
230  W , // 3
232  };
233 
236 
237  State_(const Parameters_ &);
238  State_(const State_ &);
239  State_& operator = (const State_ &);
240 
241  void get(DictionaryDatum &) const;
242  void set(const DictionaryDatum &, const Parameters_ &);
243  };
244 
245  // ----------------------------------------------------------------
246 
250  struct Buffers_
251  {
253  Buffers_(const Buffers_ &, aeif_cond_exp &);
254 
257 
262 
264  gsl_odeiv_step* s_;
265  gsl_odeiv_control* c_;
266  gsl_odeiv_evolve* e_;
267  gsl_odeiv_system sys_;
268 
269  // IntergrationStep_ should be reset with the neuron on ResetNetwork,
270  // but remain unchanged during calibration. Since it is initialized with
271  // step_, and the resolution cannot change after nodes have been created,
272  // it is safe to place both here.
275 
284  };
285 
286  // ----------------------------------------------------------------
287 
291  struct Variables_
292  {
294  };
295 
296  // Access functions for UniversalDataLogger -------------------------------
297 
299  template <State_::StateVecElems elem>
300  double_t get_y_elem_() const { return S_.y_[elem]; }
301 
302  // ----------------------------------------------------------------
303 
308 
311  };
312 
313  inline
315  {
316  SpikeEvent e;
317  e.set_sender(*this);
318 
319  return target.handles_test_event(e, receptor_type);
320  }
321 
322  inline
324  {
325  if (receptor_type != 0)
326  throw UnknownReceptorType(receptor_type, get_name());
327  return 0;
328  }
329 
330  inline
332  {
333  if (receptor_type != 0)
334  throw UnknownReceptorType(receptor_type, get_name());
335  return 0;
336  }
337 
338  inline
341  {
342  if (receptor_type != 0)
343  throw UnknownReceptorType(receptor_type, get_name());
344  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
345  }
346 
347  inline
349  {
350  P_.get(d);
351  S_.get(d);
353 
354  (*d)[names::recordables] = recordablesMap_.get_list();
355  }
356 
357  inline
359  {
360  Parameters_ ptmp = P_; // temporary copy in case of errors
361  ptmp.set(d); // throws if BadProperty
362  State_ stmp = S_; // temporary copy in case of errors
363  stmp.set(d, ptmp); // throws if BadProperty
364 
365  // We now know that (ptmp, stmp) are consistent. We do not
366  // write them back to (P_, S_) before we are also sure that
367  // the properties to be set in the parent class are internally
368  // consistent.
370 
371  // if we get here, temporaries contain consistent set of properties
372  P_ = ptmp;
373  S_ = stmp;
374  }
375 
376 } // namespace
377 
378 #endif // HAVE_GSL_1_11
379 #endif // AEIF_COND_EXP_H
double_t I_stim_
Input current injected by CurrentEvent.
Definition: aeif_cond_exp.h:283
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
RingBuffer spike_exc_
buffers and sums up incoming spikes/currents
Definition: aeif_cond_exp.h:259
int int_t
Integer number with at least 16 bit.
Definition: nest.h:95
Definition of Archiving_Node which is capable of recording and managing a spike history.
Buffers of the model.
Definition: aeif_cond_exp.h:250
~aeif_cond_exp()
Definition: aeif_cond_exp.cpp:300
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: aeif_cond_exp.cpp:318
Buffers_ B_
Definition: aeif_cond_exp.h:307
double_t t_ref_
Refractory period in ms.
Definition: aeif_cond_exp.h:184
double_t b
Spike-triggered adaptation in pA.
Definition: aeif_cond_exp.h:194
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
int_t r_
number of refractory steps remaining
Definition: aeif_cond_exp.h:235
double_t y_[STATE_VEC_SIZE]
neuron state, must be C-array for GSL solver
Definition: aeif_cond_exp.h:234
double IntegrationStep_
current integration time step, updated by GSL
Definition: aeif_cond_exp.h:274
int_t RefractoryCounts_
Definition: aeif_cond_exp.h:293
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
double_t Delta_T
Slope faktor in ms.
Definition: aeif_cond_exp.h:191
double_t V_peak_
Spike detection threshold in mV.
Definition: aeif_cond_exp.h:182
double_t V_th
Spike threshold in mV.
Definition: aeif_cond_exp.h:195
Definition: aeif_cond_exp.h:227
double_t E_in
Inhibitory reversal Potential in mV.
Definition: aeif_cond_exp.h:189
RingBuffer currents_
Definition: aeif_cond_exp.h:261
double_t tau_w
adaptation time-constant in ms.
Definition: aeif_cond_exp.h:192
gsl_odeiv_step * s_
GSL ODE stuff.
Definition: aeif_cond_exp.h:264
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: aeif_cond_exp.cpp:312
double_t tau_syn_in
Excitatory synaptic rise time.
Definition: aeif_cond_exp.h:198
Map names of recordables to data access functions.
Definition: recordables_map.h:58
State_ & operator=(const State_ &)
Definition: aeif_cond_exp.cpp:161
void set_status(const DictionaryDatum &)
Definition: aeif_cond_exp.h:358
Definition: aeif_cond_exp.h:229
double_t a
Subthreshold adaptation in nS.
Definition: aeif_cond_exp.h:193
Definition: nest_time.h:130
StateVecElems
Enumeration identifying elements in state array State_::y_.
Definition: aeif_cond_exp.h:225
std::string get_name() const
Return class name.
Definition: node.cpp:83
aeif_cond_exp()
Definition: aeif_cond_exp.cpp:283
State variables of the model.
Definition: aeif_cond_exp.h:217
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: aeif_cond_exp.h:314
Parameters_ P_
Definition: aeif_cond_exp.h:304
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
void update(const Time &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: aeif_cond_exp.cpp:368
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
double_t V_reset_
Reset Potential in mV.
Definition: aeif_cond_exp.h:183
double_t g_L
Leak Conductance in nS.
Definition: aeif_cond_exp.h:186
double_t C_m
Membrane Capacitance in pF.
Definition: aeif_cond_exp.h:187
gsl_odeiv_control * c_
adaptive stepsize control function
Definition: aeif_cond_exp.h:265
friend class UniversalDataLogger< aeif_cond_exp >
Definition: aeif_cond_exp.h:174
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: aeif_cond_exp.h:323
UniversalDataLogger< aeif_cond_exp > logger_
Logger for all analog data.
Definition: aeif_cond_exp.h:256
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: aeif_cond_exp.cpp:196
static RecordablesMap< aeif_cond_exp > recordablesMap_
Mapping of recordables names to access functions.
Definition: aeif_cond_exp.h:310
Buffers_(aeif_cond_exp &)
Sets buffer pointers to 0.
Definition: aeif_cond_exp.cpp:259
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: aeif_cond_exp.cpp:175
Variables_ V_
Definition: aeif_cond_exp.h:306
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: aeif_cond_exp.cpp:434
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
State_(const Parameters_ &)
Default initialization.
Definition: aeif_cond_exp.cpp:146
double double_t
Double precision floating point numbers.
Definition: nest.h:93
double_t step_
step size in ms
Definition: aeif_cond_exp.h:273
void set(const DictionaryDatum &, const Parameters_ &)
Definition: aeif_cond_exp.cpp:248
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
Definition: aeif_cond_exp.h:128
Request data to be logged/logged data to be sent.
Definition: event.h:486
RingBuffer spike_inh_
Definition: aeif_cond_exp.h:260
Parameters_()
Sets default parameter values.
Definition: aeif_cond_exp.cpp:125
Definition: aeif_cond_exp.h:230
double_t E_L
Leak reversal Potential (aka resting potential) in mV.
Definition: aeif_cond_exp.h:190
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
friend int aeif_cond_exp_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
void calibrate()
Re-calculate dependent parameters of the node.
Definition: aeif_cond_exp.cpp:357
Definition: aeif_cond_exp.h:228
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
int aeif_cond_exp_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
Event for spike information.
Definition: event.h:320
double_t tau_syn_ex
Excitatory synaptic rise time.
Definition: aeif_cond_exp.h:197
gsl_odeiv_evolve * e_
evolution function
Definition: aeif_cond_exp.h:266
Base class for all NEST network objects.
Definition: node.h:96
double_t E_ex
Excitatory reversal Potential in mV.
Definition: aeif_cond_exp.h:188
Internal variables of the model.
Definition: aeif_cond_exp.h:291
Independent parameters.
Definition: aeif_cond_exp.h:180
double_t gsl_error_tol
error bound for GSL integrator
Definition: aeif_cond_exp.h:201
double_t t_ref
Refractory period in ms.
Definition: aeif_cond_exp.h:196
gsl_odeiv_system sys_
struct describing system
Definition: aeif_cond_exp.h:267
double_t get_y_elem_() const
Read out state vector elements, used by UniversalDataLogger.
Definition: aeif_cond_exp.h:300
void get(DictionaryDatum &) const
Definition: aeif_cond_exp.cpp:240
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
void get_status(DictionaryDatum &) const
Definition: aeif_cond_exp.h:348
double_t I_e
Intrinsic current in pA.
Definition: aeif_cond_exp.h:199
State_ S_
Definition: aeif_cond_exp.h:305
Buffer Layout.
Definition: ring_buffer.h:77
Definition: aeif_cond_exp.h:231