NEST  2.6.0,not_revisioned_source_dir@0
iaf_cond_alpha.h
Go to the documentation of this file.
1 /*
2  * iaf_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 IAF_COND_ALPHA_H
24 #define IAF_COND_ALPHA_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_alpha - Simple conductance based leaky integrate-and-fire neuron model.
44 
45 Description:
46 iaf_cond_alpha 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 alpha function. The alpha function
49 is normalised such that an event of weight 1.0 results in a peak current of 1 nS
50 at t = tau_syn.
51 
52 Parameters:
53 The following parameters can be set in the status dictionary.
54 
55 V_m double - Membrane potential in mV
56 E_L double - Leak reversal potential in mV.
57 C_m double - Capacity of the membrane in pF
58 t_ref double - Duration of refractory period in ms.
59 V_th double - Spike threshold in mV.
60 V_reset double - Reset potential of the membrane in mV.
61 E_ex double - Excitatory reversal potential in mV.
62 E_in double - Inhibitory reversal potential in mV.
63 g_L double - Leak conductance in nS;
64 tau_syn_ex double - Rise time of the excitatory synaptic alpha function in ms.
65 tau_syn_in double - Rise time of the inhibitory synaptic alpha function in ms.
66 I_e double - Constant input current in pA.
67 
68 Sends: SpikeEvent
69 
70 Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
71 
72 References:
73 
74 Meffin, H., Burkitt, A. N., & Grayden, D. B. (2004). An analytical
75 model for the large, fluctuating synaptic conductance state typical of
76 neocortical neurons in vivo. J. Comput. Neurosci., 16, 159-175.
77 
78 Bernander, O ., Douglas, R. J., Martin, K. A. C., & Koch, C. (1991).
79 Synaptic background activity influences spatiotemporal integration in
80 single pyramidal cells. Proc. Natl. Acad. Sci. USA, 88(24),
81 11569-11573.
82 
83 Kuhn, Aertsen, Rotter (2004) Neuronal Integration of Synaptic Input in
84 the Fluctuation- Driven Regime. Jneurosci 24(10) 2345-2356
85 
86 Author: Schrader, Plesser
87 
88 SeeAlso: iaf_cond_exp, iaf_cond_alpha_mc
89 */
90 
91 namespace nest
92 {
103  extern "C"
104  int iaf_cond_alpha_dynamics (double, const double*, double*, void*);
105 
117  {
118 
119  // Boilerplate function declarations --------------------------------
120 
121  public:
122 
123  iaf_cond_alpha();
125  ~iaf_cond_alpha();
126 
127  /*
128  * Import all overloaded virtual functions that we
129  * override in this class. For background information,
130  * see http://www.gotw.ca/gotw/005.htm.
131  */
132 
133  using Node::handle;
135 
137 
141 
142  void handle(SpikeEvent &);
143  void handle(CurrentEvent &);
144  void handle(DataLoggingRequest &);
145 
146  void get_status(DictionaryDatum &) const;
147  void set_status(const DictionaryDatum &);
148 
149  private:
150  void init_state_(const Node& proto);
151  void init_buffers_();
152  void calibrate();
153  void update(Time const &, const long_t, const long_t);
154 
155  // END Boilerplate function declarations ----------------------------
156 
157  // Friends --------------------------------------------------------
158 
159  // make dynamics function quasi-member
160  friend int iaf_cond_alpha_dynamics(double, const double*, double*, void*);
161 
162  // The next two classes need to be friends to access the State_ class/member
164  friend class UniversalDataLogger<iaf_cond_alpha>;
165 
166  private:
167 
168  // Parameters class -------------------------------------------------
169 
171  struct Parameters_ {
183 
184  Parameters_();
185 
186  void get(DictionaryDatum&) const;
187  void set(const DictionaryDatum&);
188  };
189 
190  // State variables class --------------------------------------------
191 
202  public:
203  struct State_ {
204 
206  enum StateVecElems { V_M = 0,
210 
213 
216 
217  State_(const Parameters_&);
218  State_(const State_&);
219  State_& operator=(const State_&);
220 
221  void get(DictionaryDatum&) const;
222 
227  void set(const DictionaryDatum&, const Parameters_&);
228  };
229  private:
230 
231  // Buffers class --------------------------------------------------------
232 
239  struct Buffers_ {
241  Buffers_(const Buffers_&, iaf_cond_alpha&);
242 
245 
250 
251  /* GSL ODE stuff */
252  gsl_odeiv_step* s_;
253  gsl_odeiv_control* c_;
254  gsl_odeiv_evolve* e_;
255  gsl_odeiv_system sys_;
256 
257  // IntergrationStep_ should be reset with the neuron on ResetNetwork,
258  // but remain unchanged during calibration. Since it is initialized with
259  // step_, and the resolution cannot change after nodes have been created,
260  // it is safe to place both here.
263 
272  };
273 
274  // Variables class -------------------------------------------------------
275 
280  struct Variables_ {
286 
292 
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 
304  double_t get_r_() const { return Time::get_resolution().get_ms() * S_.r; }
305 
306  // Data members -----------------------------------------------------------
307 
308  // keep the order of these lines, seems to give best performance
313 
316  };
317 
318 
319  // Boilerplate inline function definitions ----------------------------------
320 
321  inline
323 {
324  SpikeEvent e;
325  e.set_sender(*this);
326  return target.handles_test_event(e, receptor_type);
327 }
328 
329 inline
331 {
332  if (receptor_type != 0)
333  throw UnknownReceptorType(receptor_type, get_name());
334  return 0;
335 }
336 
337 inline
339 {
340  if (receptor_type != 0)
341  throw UnknownReceptorType(receptor_type, get_name());
342  return 0;
343 }
344 
345 inline
348 {
349  if (receptor_type != 0)
350  throw UnknownReceptorType(receptor_type, get_name());
351  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
352 }
353 
354  inline
356  {
357  P_.get(d);
358  S_.get(d);
360 
361  (*d)[names::recordables] = recordablesMap_.get_list();
362  }
363 
364  inline
366  {
367  Parameters_ ptmp = P_; // temporary copy in case of errors
368  ptmp.set(d); // throws if BadProperty
369  State_ stmp = S_; // temporary copy in case of errors
370  stmp.set(d, ptmp); // throws if BadProperty
371 
372  // We now know that (ptmp, stmp) are consistent. We do not
373  // write them back to (P_, S_) before we are also sure that
374  // the properties to be set in the parent class are internally
375  // consistent.
377 
378  // if we get here, temporaries contain consistent set of properties
379  P_ = ptmp;
380  S_ = stmp;
381  }
382 
383 } // namespace
384 
385 #endif //IAF_COND_ALPHA_H
386 
387 #endif //HAVE_GSL
Definition: iaf_cond_alpha.h:208
Definition: iaf_cond_alpha.h:207
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
State_ S_
Definition: iaf_cond_alpha.h:310
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.
RingBuffer currents_
Definition: iaf_cond_alpha.h:249
friend int iaf_cond_alpha_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
Parameters_ P_
Definition: iaf_cond_alpha.h:309
double_t V_th
Threshold Potential in mV.
Definition: iaf_cond_alpha.h:172
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
double_t E_in
Inhibitory reversal Potential in mV.
Definition: iaf_cond_alpha.h:178
UniversalDataLogger< iaf_cond_alpha > logger_
Logger for all analog data.
Definition: iaf_cond_alpha.h:244
int iaf_cond_alpha_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
double_t PSConInit_E
Impulse to add to DG_EXC on spike arrival to evoke unit-amplitude conductance excursion.
Definition: iaf_cond_alpha.h:285
StateVecElems
Symbolic indices to the elements of the state vector y.
Definition: iaf_cond_alpha.h:206
port send_test_event(Node &tagret, rport receptor_type, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_cond_alpha.h:322
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: iaf_cond_alpha.cpp:192
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 I_e
Constant Current in pA.
Definition: iaf_cond_alpha.h:182
int_t RefractoryCounts
refractory time in steps
Definition: iaf_cond_alpha.h:294
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_cond_alpha.cpp:274
Model parameters.
Definition: iaf_cond_alpha.h:171
Parameters_()
Set default parameter values.
Definition: iaf_cond_alpha.cpp:111
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_cond_alpha.cpp:268
void set(const DictionaryDatum &, const Parameters_ &)
Set state from values in dictionary.
Definition: iaf_cond_alpha.cpp:229
double_t I_stim_
Input current injected by CurrentEvent.
Definition: iaf_cond_alpha.h:271
State_(const Parameters_ &)
Default initialization.
Definition: iaf_cond_alpha.cpp:126
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_cond_alpha.cpp:177
Definition: iaf_cond_alpha.h:208
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_cond_alpha.cpp:224
Map names of recordables to data access functions.
Definition: recordables_map.h:58
gsl_odeiv_step * s_
stepping function
Definition: iaf_cond_alpha.h:252
friend class UniversalDataLogger< iaf_cond_alpha >
Definition: iaf_cond_alpha.h:164
Definition: nest_time.h:130
double_t tau_synE
Synaptic Time Constant Excitatory Synapse in ms.
Definition: iaf_cond_alpha.h:180
std::string get_name() const
Return class name.
Definition: node.cpp:83
gsl_odeiv_control * c_
adaptive stepsize control function
Definition: iaf_cond_alpha.h:253
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
double_t get_y_elem_() const
Read out state vector elements, used by UniversalDataLogger.
Definition: iaf_cond_alpha.h:301
Definition: iaf_cond_alpha.h:206
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
Variables_ V_
Definition: iaf_cond_alpha.h:311
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
Buffers_ B_
Definition: iaf_cond_alpha.h:312
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: iaf_cond_alpha.cpp:327
double_t E_ex
Excitatory reversal Potential in mV.
Definition: iaf_cond_alpha.h:177
double_t C_m
Membrane Capacitance in pF.
Definition: iaf_cond_alpha.h:176
static RecordablesMap< iaf_cond_alpha > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_cond_alpha.h:315
iaf_cond_alpha()
Definition: iaf_cond_alpha.cpp:239
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_cond_alpha.cpp:396
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_cond_alpha.cpp:312
gsl_odeiv_evolve * e_
evolution function
Definition: iaf_cond_alpha.h:254
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
gsl_odeiv_system sys_
struct describing system
Definition: iaf_cond_alpha.h:255
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
double_t y[STATE_VEC_SIZE]
state vector, must be C-array for GSL solver
Definition: iaf_cond_alpha.h:212
double_t PSConInit_I
Impulse to add to DG_INH on spike arrival to evoke unit-amplitude conductance excursion.
Definition: iaf_cond_alpha.h:291
Definition: iaf_cond_alpha.h:207
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
double_t g_L
Leak Conductance in nS.
Definition: iaf_cond_alpha.h:175
double double_t
Double precision floating point numbers.
Definition: nest.h:93
Buffers_(iaf_cond_alpha &)
Sets buffer pointers to 0.
Definition: iaf_cond_alpha.cpp:153
double_t t_ref
Refractory period in ms.
Definition: iaf_cond_alpha.h:174
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
State_ & operator=(const State_ &)
Definition: iaf_cond_alpha.cpp:141
double_t get_ms() const
Definition: nest_time.h:389
Request data to be logged/logged data to be sent.
Definition: event.h:486
static Time get_resolution()
Definition: nest_time.h:303
double_t step_
step size in ms
Definition: iaf_cond_alpha.h:261
Internal variables of the model.
Definition: iaf_cond_alpha.h:280
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
void get_status(DictionaryDatum &) const
Definition: iaf_cond_alpha.h:355
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
Event for spike information.
Definition: event.h:320
double_t tau_synI
Synaptic Time Constant for Inhibitory Synapse in ms.
Definition: iaf_cond_alpha.h:181
double_t V_reset
Reset Potential in mV.
Definition: iaf_cond_alpha.h:173
RingBuffer spike_exc_
buffers and sums up incoming spikes/currents
Definition: iaf_cond_alpha.h:247
Base class for all NEST network objects.
Definition: node.h:96
Integrate-and-fire neuron model with two conductance-based synapses.
Definition: iaf_cond_alpha.h:116
Definition: iaf_cond_alpha.h:209
double_t E_L
Leak reversal Potential (aka resting potential) in mV.
Definition: iaf_cond_alpha.h:179
double_t get_r_() const
Read out remaining refractory time, used by UniversalDataLogger.
Definition: iaf_cond_alpha.h:304
Buffers of the model.
Definition: iaf_cond_alpha.h:239
~iaf_cond_alpha()
Definition: iaf_cond_alpha.cpp:256
int_t r
Definition: iaf_cond_alpha.h:215
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
double IntegrationStep_
current integration time step, updated by GSL
Definition: iaf_cond_alpha.h:262
const double e
Definition: numerics.cpp:62
void set_status(const DictionaryDatum &)
Definition: iaf_cond_alpha.h:365
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_cond_alpha.h:330
RingBuffer spike_inh_
Definition: iaf_cond_alpha.h:248
Buffer Layout.
Definition: ring_buffer.h:77
State variables of the model.
Definition: iaf_cond_alpha.h:203