NEST  2.6.0,not_revisioned_source_dir@0
iaf_cond_exp.h
Go to the documentation of this file.
1 /*
2  * iaf_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 IAF_COND_EXP_H
24 #define IAF_COND_EXP_H
25 
26 #include "config.h"
27 
28 #ifdef HAVE_GSL
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: iaf_cond_exp - Simple conductance based leaky integrate-and-fire neuron model.
44 
45 Description:
46 iaf_cond_exp is an implementation of a spiking neuron using IAF dynamics with
47 conductance-based synapses. Incoming spike events induce a post-synaptic change
48 of conductance modelled by an exponential function. The exponential function
49 is normalised such that an event of weight 1.0 results in a peak conductance of 1 nS.
50 
51 Parameters:
52 The following parameters can be set in the status dictionary.
53 
54 V_m double - Membrane potential in mV
55 E_L double - Leak reversal potential in mV.
56 C_m double - Capacity of the membrane in pF
57 t_ref double - Duration of refractory period in ms.
58 V_th double - Spike threshold in mV.
59 V_reset double - Reset potential of the membrane in mV.
60 E_ex double - Excitatory reversal potential in mV.
61 E_in double - Inhibitory reversal potential in mV.
62 g_L double - Leak conductance in nS;
63 tau_syn_ex double - Time constant of the excitatory synaptic exponential function in ms.
64 tau_syn_in double - Time constant of the inhibitory synaptic exponential function in ms.
65 I_e double - Constant external input current in pA.
66 
67 Sends: SpikeEvent
68 
69 Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
70 
71 References:
72 
73 Meffin, H., Burkitt, A. N., & Grayden, D. B. (2004). An analytical
74 model for the large, fluctuating synaptic conductance state typical of
75 neocortical neurons in vivo. J. Comput. Neurosci., 16, 159-175.
76 
77 Author: Sven Schrader
78 
79 SeeAlso: iaf_psc_delta, iaf_psc_exp, iaf_cond_exp
80 */
81 
82 namespace nest
83 {
94  extern "C"
95  int iaf_cond_exp_dynamics (double, const double*, double*, void*);
96 
98  {
99 
100  public:
101 
102  iaf_cond_exp();
103  iaf_cond_exp(const iaf_cond_exp&);
104  ~iaf_cond_exp();
105 
110  using Node::handle;
112 
114 
115  void handle(SpikeEvent &);
116  void handle(CurrentEvent &);
117  void handle(DataLoggingRequest &);
118 
122 
123  void get_status(DictionaryDatum &) const;
124  void set_status(const DictionaryDatum &);
125 
126  private:
127  void init_state_(const Node& proto);
128  void init_buffers_();
129  void calibrate();
130  void update(Time const &, const long_t, const long_t);
131 
132  // END Boilerplate function declarations ----------------------------
133 
134  // Friends --------------------------------------------------------
135 
136  // make dynamics function quasi-member
137  friend int iaf_cond_exp_dynamics(double, const double*, double*, void*);
138 
139  // The next two classes need to be friends to access the State_ class/member
141  friend class UniversalDataLogger<iaf_cond_exp>;
142 
143  private:
144 
145  // ----------------------------------------------------------------
146 
148  struct Parameters_ {
160 
161  Parameters_();
162 
163  void get(DictionaryDatum&) const;
164  void set(const DictionaryDatum&);
165  };
166 
167  public:
168  // ----------------------------------------------------------------
169 
175  struct State_ {
176 
178  enum StateVecElems { V_M = 0,
182 
185 
186  State_(const Parameters_&);
187  State_(const State_&);
188  State_& operator=(const State_&);
189 
190  void get(DictionaryDatum&) const;
191  void set(const DictionaryDatum&, const Parameters_&);
192  };
193 
194  // ----------------------------------------------------------------
195 
196  private:
200  struct Buffers_ {
202  Buffers_(const Buffers_&, iaf_cond_exp&);
203 
206 
211 
213  gsl_odeiv_step* s_;
214  gsl_odeiv_control* c_;
215  gsl_odeiv_evolve* e_;
216  gsl_odeiv_system sys_;
217 
218  // IntergrationStep_ should be reset with the neuron on ResetNetwork,
219  // but remain unchanged during calibration. Since it is initialized with
220  // step_, and the resolution cannot change after nodes have been created,
221  // it is safe to place both here.
224 
233  };
234 
235  // ----------------------------------------------------------------
236 
240  struct Variables_ {
242  };
243 
244  // Access functions for UniversalDataLogger -------------------------------
245 
247  template <State_::StateVecElems elem>
248  double_t get_y_elem_() const { return S_.y_[elem]; }
249 
250  // ----------------------------------------------------------------
251 
256 
259  };
260 
261 
262  inline
264 {
265  SpikeEvent e;
266  e.set_sender(*this);
267  return target.handles_test_event(e, receptor_type);
268 }
269 
270 inline
272 {
273  if (receptor_type != 0)
274  throw UnknownReceptorType(receptor_type, get_name());
275  return 0;
276 }
277 
278 inline
280 {
281  if (receptor_type != 0)
282  throw UnknownReceptorType(receptor_type, get_name());
283  return 0;
284 }
285 
286 inline
289 {
290  if (receptor_type != 0)
291  throw UnknownReceptorType(receptor_type, get_name());
292  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
293 }
294 
295 
296 
297  inline
299  {
300  P_.get(d);
301  S_.get(d);
303 
304  (*d)[names::recordables] = recordablesMap_.get_list();
305  }
306 
307  inline
309  {
310  Parameters_ ptmp = P_; // temporary copy in case of errors
311  ptmp.set(d); // throws if BadProperty
312  State_ stmp = S_; // temporary copy in case of errors
313  stmp.set(d, ptmp); // throws if BadProperty
314 
315  // We now know that (ptmp, stmp) are consistent. We do not
316  // write them back to (P_, S_) before we are also sure that
317  // the properties to be set in the parent class are internally
318  // consistent.
320 
321  // if we get here, temporaries contain consistent set of properties
322  P_ = ptmp;
323  S_ = stmp;
324  }
325 
326 } // namespace
327 
328 #endif //HAVE_GSL
329 #endif //IAF_COND_EXP_H
Variables_ V_
Definition: iaf_cond_exp.h:254
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
~iaf_cond_exp()
Definition: iaf_cond_exp.cpp:239
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.
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
iaf_cond_exp()
Definition: iaf_cond_exp.cpp:222
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_cond_exp.h:263
StateVecElems
Symbolic indices to the elements of the state vector y.
Definition: iaf_cond_exp.h:178
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
gsl_odeiv_system sys_
struct describing system
Definition: iaf_cond_exp.h:216
int iaf_cond_exp_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
Parameters_()
Sets default parameter values.
Definition: iaf_cond_exp.cpp:98
static RecordablesMap< iaf_cond_exp > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_cond_exp.h:258
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_cond_exp.cpp:373
State_ S_
Definition: iaf_cond_exp.h:253
RingBuffer spike_inh_
Definition: iaf_cond_exp.h:209
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
Buffers_(iaf_cond_exp &)
Sets buffer pointers to 0.
Definition: iaf_cond_exp.cpp:198
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_cond_exp.cpp:141
double IntegrationStep_
current integration time step, updated by GSL
Definition: iaf_cond_exp.h:223
gsl_odeiv_step * s_
GSL ODE stuff.
Definition: iaf_cond_exp.h:213
State_(const Parameters_ &)
Default initialization.
Definition: iaf_cond_exp.cpp:113
double_t C_m
Membrane Capacitance in pF.
Definition: iaf_cond_exp.h:153
double_t E_in
Inhibitory reversal Potential in mV.
Definition: iaf_cond_exp.h:155
void get(DictionaryDatum &) const
Definition: iaf_cond_exp.cpp:188
Map names of recordables to data access functions.
Definition: recordables_map.h:58
double_t V_th_
Threshold Potential in mV.
Definition: iaf_cond_exp.h:149
Definition: iaf_cond_exp.h:179
double_t E_L
Leak reversal Potential (aka resting potential) in mV.
Definition: iaf_cond_exp.h:156
Definition: nest_time.h:130
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_cond_exp.h:271
UniversalDataLogger< iaf_cond_exp > logger_
Logger for all analog data.
Definition: iaf_cond_exp.h:205
std::string get_name() const
Return class name.
Definition: node.cpp:83
double_t tau_synE
Synaptic Time Constant Excitatory Synapse in ms.
Definition: iaf_cond_exp.h:157
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
double_t step_
step size in ms
Definition: iaf_cond_exp.h:222
int_t RefractoryCounts_
Definition: iaf_cond_exp.h:241
void get_status(DictionaryDatum &) const
Definition: iaf_cond_exp.h:298
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
double_t tau_synI
Synaptic Time Constant for Inhibitory Synapse in ms.
Definition: iaf_cond_exp.h:158
RingBuffer currents_
Definition: iaf_cond_exp.h:210
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: iaf_cond_exp.cpp:306
Definition: iaf_cond_exp.h:180
gsl_odeiv_control * c_
adaptive stepsize control function
Definition: iaf_cond_exp.h:214
double_t get_y_elem_() const
Read out state vector elements, used by UniversalDataLogger.
Definition: iaf_cond_exp.h:248
Buffers of the model.
Definition: iaf_cond_exp.h:200
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_cond_exp.cpp:257
double_t y_[STATE_VEC_SIZE]
neuron state, must be C-array for GSL solver
Definition: iaf_cond_exp.h:183
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: iaf_cond_exp.cpp:156
Buffers_ B_
Definition: iaf_cond_exp.h:255
friend class UniversalDataLogger< iaf_cond_exp >
Definition: iaf_cond_exp.h:141
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
Model parameters.
Definition: iaf_cond_exp.h:148
double_t t_ref_
Refractory period in ms.
Definition: iaf_cond_exp.h:151
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_cond_exp.cpp:294
friend int iaf_cond_exp_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
Definition: iaf_cond_exp.h:181
double double_t
Double precision floating point numbers.
Definition: nest.h:93
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
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_cond_exp.cpp:251
Internal variables of the model.
Definition: iaf_cond_exp.h:240
void set_status(const DictionaryDatum &)
Definition: iaf_cond_exp.h:308
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
double_t I_stim_
Input current injected by CurrentEvent.
Definition: iaf_cond_exp.h:232
Event for spike information.
Definition: event.h:320
gsl_odeiv_evolve * e_
evolution function
Definition: iaf_cond_exp.h:215
double_t V_reset_
Reset Potential in mV.
Definition: iaf_cond_exp.h:150
Definition: iaf_cond_exp.h:97
Base class for all NEST network objects.
Definition: node.h:96
int_t r_
number of refractory steps remaining
Definition: iaf_cond_exp.h:184
Parameters_ P_
Definition: iaf_cond_exp.h:252
Definition: iaf_cond_exp.h:178
void set(const DictionaryDatum &, const Parameters_ &)
Definition: iaf_cond_exp.cpp:193
double_t g_L
Leak Conductance in nS.
Definition: iaf_cond_exp.h:152
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
RingBuffer spike_exc_
buffers and sums up incoming spikes/currents
Definition: iaf_cond_exp.h:208
State_ & operator=(const State_ &)
Definition: iaf_cond_exp.cpp:127
double_t E_ex
Excitatory reversal Potential in mV.
Definition: iaf_cond_exp.h:154
Buffer Layout.
Definition: ring_buffer.h:77
double_t I_e
Constant Current in pA.
Definition: iaf_cond_exp.h:159
State variables of the model.
Definition: iaf_cond_exp.h:175