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