NEST  2.6.0,not_revisioned_source_dir@0
iaf_chxk_2008.h
Go to the documentation of this file.
1 /*
2  * iaf_chxk_2008.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_CHXK_2008_H
24 #define IAF_CHXK_2008_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_chxk_2008 - Conductance based leaky integrate-and-fire neuron model used in
44 Casti et al 2008.
45 
46 Description:
47 iaf_chxk_2008 is an implementation of a spiking neuron using IAF dynamics with
48 conductance-based synapses [1]. It is modeled after iaf_cond_alpha with the addition
49 of after hyperpolarization current instead of a membrane potential reset.
50 Incoming spike events induce a post-synaptic change
51 of conductance modeled by an alpha function. The alpha function
52 is normalized such that an event of weight 1.0 results in a peak current of 1 nS
53 at t = tau_syn.
54 
55 Parameters:
56 The following parameters can be set in the status dictionary.
57 
58 V_m double - Membrane potential in mV
59 E_L double - Leak reversal potential in mV.
60 C_m double - Capacity of the membrane in pF
61 V_th double - Spike threshold in mV.
62 E_ex double - Excitatory reversal potential in mV.
63 E_in double - Inhibitory reversal potential in mV.
64 g_L double - Leak conductance in nS.
65 tau_ex double - Rise time of the excitatory synaptic alpha function in ms.
66 tau_in double - Rise time of the inhibitory synaptic alpha function in ms.
67 I_e double - Constant input current in pA.
68 tau_ahp double - Afterhyperpolarization (AHP) time constant in ms.
69 E_ahp double - AHP potential in mV.
70 g_ahp double - AHP conductance in nS.
71 ahp_bug bool - Defaults to false. If true, behaves like original model implementation.
72 
73 References:
74 [1] Casti A, Hayot F, Xiao Y, and Kaplan E (2008) A simple model of retina-LGN transmission.
75  J Comput Neurosci 24:235-252.
76 
77 Sends: SpikeEvent
78 
79 Receives: SpikeEvent, CurrentEvent
80 
81 Author: Heiberg
82 
83 SeeAlso: iaf_cond_alpha
84 */
85 
86 namespace nest
87 {
98  extern "C"
99  int iaf_chxk_2008_dynamics (double, const double*, double*, void*);
100 
105  {
106 
107  // Boilerplate function declarations --------------------------------
108 
109  public:
110 
111  iaf_chxk_2008();
113  ~iaf_chxk_2008();
114 
119  using Node::handle;
121 
123 
124  bool is_off_grid() const {return true;} // uses off_grid events
125 
129 
130  void handle(SpikeEvent&);
131  void handle(CurrentEvent&);
132  void handle(DataLoggingRequest&);
133 
134  void get_status(DictionaryDatum &) const;
135  void set_status(const DictionaryDatum &);
136 
137  private:
138  void init_state_(const Node& proto);
139  void init_buffers_();
140  void calibrate();
141  void update(Time const &, const long_t, const long_t);
142 
143  // END Boilerplate function declarations ----------------------------
144 
145  // Friends --------------------------------------------------------
146 
147  // make dynamics function quasi-member
148  friend int iaf_chxk_2008_dynamics(double, const double*, double*, void*);
149 
150  // The next two classes need to be friends to access the State_ class/member
152  friend class UniversalDataLogger<iaf_chxk_2008>;
153 
154  private:
155 
156  // Parameters class -------------------------------------------------
157 
159  struct Parameters_ {
172  bool ahp_bug;
173  Parameters_();
174 
175  void get(DictionaryDatum&) const;
176  void set(const DictionaryDatum&);
177  };
178 
179  // State variables class --------------------------------------------
180 
191  public:
192  struct State_ {
193 
195  enum StateVecElems { V_M = 0,
200 
203 
206 
207  State_(const Parameters_&);
208  State_(const State_&);
209  State_& operator=(const State_&);
210 
211  void get(DictionaryDatum&) const;
212 
217  void set(const DictionaryDatum&, const Parameters_&);
218  };
219  private:
220 
221  // Buffers class --------------------------------------------------------
222 
229  struct Buffers_ {
231  Buffers_(const Buffers_&, iaf_chxk_2008&);
232 
235 
240 
241  /* GSL ODE stuff */
242  gsl_odeiv_step* s_;
243  gsl_odeiv_control* c_;
244  gsl_odeiv_evolve* e_;
245  gsl_odeiv_system sys_;
246 
247  // IntergrationStep_ should be reset with the neuron on ResetNetwork,
248  // but remain unchanged during calibration. Since it is initialized with
249  // step_, and the resolution cannot change after nodes have been created,
250  // it is safe to place both here.
253 
262  };
263 
264  // Variables class -------------------------------------------------------
265 
270  struct Variables_ {
276 
282 
288  };
289 
290  // Access functions for UniversalDataLogger -------------------------------
291 
293  template <State_::StateVecElems elem>
294  double_t get_y_elem_() const { return S_.y[elem]; }
295 
297  double_t get_r_() const { return Time::get_resolution().get_ms() * S_.r; }
298 
301  double_t get_I_ahp_() const { return S_.y[State_::G_AHP] * (S_.y[State_::V_M] - P_.E_ahp); }
302 
303 
304  // Data members -----------------------------------------------------------
305 
306  // keep the order of these lines, seems to give best performance
311 
314  };
315 
316 
317  // Boilerplate inline function definitions ----------------------------------
318 
319  inline
321  {
322  SpikeEvent e;
323  e.set_sender(*this);
324 
325  return target.handles_test_event(e, receptor_type);
326  }
327 
328  inline
330  {
331  if (receptor_type != 0)
332  throw UnknownReceptorType(receptor_type, get_name());
333  return 0;
334  }
335 
336  inline
338  {
339  if (receptor_type != 0)
340  throw UnknownReceptorType(receptor_type, get_name());
341  return 0;
342  }
343 
344  inline
347  {
348  if (receptor_type != 0)
349  throw UnknownReceptorType(receptor_type, get_name());
350  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
351  }
352 
353  inline
355  {
356  P_.get(d);
357  S_.get(d);
359 
360  (*d)[names::recordables] = recordablesMap_.get_list();
361  }
362 
363  inline
365  {
366  Parameters_ ptmp = P_; // temporary copy in case of errors
367  ptmp.set(d); // throws if BadProperty
368  State_ stmp = S_; // temporary copy in case of errors
369  stmp.set(d, ptmp); // throws if BadProperty
370 
371  // We now know that (ptmp, stmp) are consistent. We do not
372  // write them back to (P_, S_) before we are also sure that
373  // the properties to be set in the parent class are internally
374  // consistent.
376 
377  // if we get here, temporaries contain consistent set of properties
378  P_ = ptmp;
379  S_ = stmp;
380  }
381 
382 } // namespace
383 
384 
385 #endif //HAVE_GSL
386 #endif //IAF_CHXK_2008_H
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
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.
Definition: iaf_chxk_2008.h:196
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
Definition: lockptrdatum.h:40
Definition: iaf_chxk_2008.h:195
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
iaf_chxk_2008()
Definition: iaf_chxk_2008.cpp:232
gsl_odeiv_step * s_
stepping function
Definition: iaf_chxk_2008.h:242
double IntegrationStep_
current integration time step, updated by GSL
Definition: iaf_chxk_2008.h:252
gsl_odeiv_control * c_
adaptive step size control function
Definition: iaf_chxk_2008.h:243
UniversalDataLogger< iaf_chxk_2008 > logger_
Logger for all analog data.
Definition: iaf_chxk_2008.h:234
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
double_t E_in
Inhibitory reversal Potential in mV.
Definition: iaf_chxk_2008.h:164
double_t g_ahp
AHP conductance.
Definition: iaf_chxk_2008.h:170
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_chxk_2008.cpp:219
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_chxk_2008.cpp:254
gsl_odeiv_system sys_
struct describing system
Definition: iaf_chxk_2008.h:245
void set(const DictionaryDatum &)
Set values from dictionary.
Definition: iaf_chxk_2008.cpp:196
double_t PSConInit_AHP
Impulse to add to DG_AHP on spike generation to evoke unit-amplitude conductance excursion.
Definition: iaf_chxk_2008.h:287
double_t E_L
Leak reversal Potential (a.k.a. resting potential) in mV.
Definition: iaf_chxk_2008.h:165
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_chxk_2008.cpp:296
Event for electrical currents.
Definition: event.h:420
Integrate-and-fire neuron model with two conductance-based synapses.
Definition: iaf_chxk_2008.h:104
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
double_t get_r_() const
Read out remaining refractory time, used by UniversalDataLogger.
Definition: iaf_chxk_2008.h:297
Parameters_()
Set default parameter values.
Definition: iaf_chxk_2008.cpp:117
double_t PSConInit_E
Impulse to add to DG_EXC on spike arrival to evoke unit-amplitude conductance excursion.
Definition: iaf_chxk_2008.h:275
double_t E_ahp
AHP potential.
Definition: iaf_chxk_2008.h:171
friend class UniversalDataLogger< iaf_chxk_2008 >
Definition: iaf_chxk_2008.h:152
double_t get_I_syn_exc_() const
Definition: iaf_chxk_2008.h:299
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_chxk_2008.h:124
double_t V_th
Threshold Potential in mV.
Definition: iaf_chxk_2008.h:160
double_t y[STATE_VEC_SIZE]
state vector, must be C-array for GSL solver
Definition: iaf_chxk_2008.h:202
Definition: iaf_chxk_2008.h:196
Definition: iaf_chxk_2008.h:198
void set_status(const DictionaryDatum &)
Definition: iaf_chxk_2008.h:364
State_ S_
Definition: iaf_chxk_2008.h:308
Map names of recordables to data access functions.
Definition: recordables_map.h:58
Definition: iaf_chxk_2008.h:197
RingBuffer spike_exc_
buffers and sums up incoming spikes/currents
Definition: iaf_chxk_2008.h:237
Parameters_ P_
Definition: iaf_chxk_2008.h:307
Definition: nest_time.h:130
std::string get_name() const
Return class name.
Definition: node.cpp:83
Definition: iaf_chxk_2008.h:197
RingBuffer currents_
Definition: iaf_chxk_2008.h:239
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
State_ & operator=(const State_ &)
Definition: iaf_chxk_2008.cpp:152
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
double_t PSConInit_I
Impulse to add to DG_INH on spike arrival to evoke unit-amplitude conductance excursion.
Definition: iaf_chxk_2008.h:281
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
Variables_ V_
Definition: iaf_chxk_2008.h:309
State variables of the model.
Definition: iaf_chxk_2008.h:192
double_t get_y_elem_() const
Read out state vector elements, used by UniversalDataLogger.
Definition: iaf_chxk_2008.h:294
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: iaf_chxk_2008.cpp:308
void set(const DictionaryDatum &, const Parameters_ &)
Set state from values in dictionary.
Definition: iaf_chxk_2008.cpp:223
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
Internal variables of the model.
Definition: iaf_chxk_2008.h:270
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
double_t g_L
Leak Conductance in nS.
Definition: iaf_chxk_2008.h:161
double double_t
Double precision floating point numbers.
Definition: nest.h:93
double_t C_m
Membrane Capacitance in pF.
Definition: iaf_chxk_2008.h:162
Model parameters.
Definition: iaf_chxk_2008.h:159
double_t tau_synE
Synaptic Time Constant Excitatory Synapse in ms.
Definition: iaf_chxk_2008.h:166
void get_status(DictionaryDatum &) const
Definition: iaf_chxk_2008.h:354
State_(const Parameters_ &)
Default initialization.
Definition: iaf_chxk_2008.cpp:139
bool ahp_bug
If true, discard AHP conductance value from previous spikes.
Definition: iaf_chxk_2008.h:172
double_t tau_ahp
Afterhyperpolarization (AHP) time constant.
Definition: iaf_chxk_2008.h:169
double_t I_e
Constant Current in pA.
Definition: iaf_chxk_2008.h:168
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
double_t E_ex
Excitatory reversal Potential in mV.
Definition: iaf_chxk_2008.h:163
Definition: iaf_chxk_2008.h:198
friend int iaf_chxk_2008_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
int iaf_chxk_2008_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
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
static RecordablesMap< iaf_chxk_2008 > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_chxk_2008.h:313
Buffers_(iaf_chxk_2008 &)
Sets buffer pointers to 0.
Definition: iaf_chxk_2008.cpp:164
double_t I_stim_
Input current injected by CurrentEvent.
Definition: iaf_chxk_2008.h:261
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
Buffers of the model.
Definition: iaf_chxk_2008.h:229
Definition: iaf_chxk_2008.h:199
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
double_t tau_synI
Synaptic Time Constant for Inhibitory Synapse in ms.
Definition: iaf_chxk_2008.h:167
Event for spike information.
Definition: event.h:320
Base class for all NEST network objects.
Definition: node.h:96
~iaf_chxk_2008()
Definition: iaf_chxk_2008.cpp:240
int_t r
Definition: iaf_chxk_2008.h:205
double_t get_I_syn_inh_() const
Definition: iaf_chxk_2008.h:300
double_t step_
step size in ms
Definition: iaf_chxk_2008.h:251
RingBuffer spike_inh_
Definition: iaf_chxk_2008.h:238
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_chxk_2008.cpp:180
StateVecElems
Symbolic indices to the elements of the state vector y.
Definition: iaf_chxk_2008.h:195
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_chxk_2008.cpp:388
Buffers_ B_
Definition: iaf_chxk_2008.h:310
double_t get_I_ahp_() const
Definition: iaf_chxk_2008.h:301
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_chxk_2008.cpp:259
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
gsl_odeiv_evolve * e_
evolution function
Definition: iaf_chxk_2008.h:244
Buffer Layout.
Definition: ring_buffer.h:77
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_chxk_2008.h:320
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_chxk_2008.h:329