NEST  2.6.0,not_revisioned_source_dir@0
hh_cond_exp_traub.h
Go to the documentation of this file.
1 /*
2  * hh_cond_exp_traub.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 HH_COND_EXP_TRAUB_H
24 #define HH_COND_EXP_TRAUB_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_odeiv.h>
39 
40 namespace nest {
41 
52  extern "C"
53  int hh_cond_exp_traub_dynamics(double, const double*, double*, void*);
54 
55  /* BeginDocumentation
56 Name: hh_cond_exp_traub - Hodgin Huxley based model, Traub modified.
57 
58 Description:
59 
60  hh_cond_exp_traub is an implementation of a modified Hodkin-Huxley model
61 
62  (1) Post-syaptic currents
63  Incoming spike events induce a post-synaptic change of conductance modelled
64  by an exponential function. The exponential function is normalised such that an event of
65  weight 1.0 results in a peak current of 1 nS.
66 
67  (2) Spike Detection
68  Spike detection is done by a combined threshold-and-local-maximum search: if there
69  is a local maximum above a certain threshold of the membrane potential, it is considered a spike.
70 
71 Problems/Todo:
72  Only the channel variables m,h,n are implemented. The original
73  contains variables called y,s,r,q and \chi.
74 
75 Parameters:
76 
77  The following parameters can be set in the status dictionary.
78 
79  V_m double - Membrane potential in mV
80  V_T double - Voltage offset that controls dynamics. For default
81  parameters, V_T = -63mV results in a threshold around -50mV.
82  E_L double - Leak reversal potential in mV.
83  C_m double - Capacity of the membrane in pF.
84  g_L double - Leak conductance in nS.
85  tau_syn_ex double - Time constant of the excitatory synaptic exponential function in ms.
86  tau_syn_in double - Time constant of the inhibitory synaptic exponential function in ms.
87  E_ex double - Excitatory synaptic reversal potential in mV.
88  E_in double - Inhibitory synaptic reversal potential in mV.
89  E_Na double - Sodium reversal potential in mV.
90  g_Na double - Sodium peak conductance in nS.
91  E_K double - Potassium reversal potential in mV.
92  g_K double - Potassium peak conductance in nS.
93  I_e double - External input current in pA.
94 
95 References:
96 
97  Traub, R.D. and Miles, R. (1991)
98  Neuronal Networks of the Hippocampus. Cambridge University Press,
99  Cambridge UK.
100 
101 Sends: SpikeEvent
102 
103 Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
104 
105 Author: Schrader
106 
107 SeeAlso: hh_psc_alpha
108 */
109 
111  public Archiving_Node
112  {
113 
114  public:
115 
119 
124  using Node::handle;
126 
128 
129  void handle(SpikeEvent &);
130  void handle(CurrentEvent &);
131  void handle(DataLoggingRequest &);
132 
136 
137  void get_status(DictionaryDatum &) const;
138  void set_status(const DictionaryDatum &);
139 
140  private:
141 
142  void init_state_(const Node& proto);
143  void init_buffers_();
144  void calibrate();
145 
146  void update(Time const &, const long_t, const long_t);
147 
148  // END Boilerplate function declarations ----------------------------
149 
150  // Friends --------------------------------------------------------
151 
152  // make dynamics function quasi-member
153  friend int hh_cond_exp_traub_dynamics(double, const double*, double*, void*);
154 
155  // The next two classes need to be friends to access the State_ class/member
157  friend class UniversalDataLogger<hh_cond_exp_traub>;
158 
159  private:
160 
161  // ----------------------------------------------------------------
162 
166  struct Parameters_ {
167  double g_Na;
168  double g_K;
169  double g_L;
170  double C_m;
171 
172  double E_Na;
173  double E_K;
174  double E_L;
175 
176  double V_T;
177 
178  double E_ex;
179  double E_in;
180  double tau_synE;
181  double tau_synI;
182  double I_e;
183 
184  Parameters_();
185 
186  void get(DictionaryDatum&) const;
187  void set(const DictionaryDatum&);
188  };
189 
190  public:
191 
192  // ----------------------------------------------------------------
193 
197  struct State_ {
198 
200  enum StateVecElems { V_M = 0,
201  HH_M , // 1
202  HH_H , // 2
203  HH_N , // 3
204  G_EXC , // 4
205  G_INH , // 5
207  };
208 
209  double y_[STATE_VEC_SIZE];
211 
212  State_(const Parameters_& p);
213  State_(const State_& s);
214 
215  State_& operator=(const State_& s);
216 
217  void get(DictionaryDatum&) const;
218  void set(const DictionaryDatum&, const Parameters_&);
219  };
220 
221  // ----------------------------------------------------------------
222 
226  struct Variables_ {
228  double U_old_; // for spike-detection
229  };
230 
231  // ----------------------------------------------------------------
232 
236  struct Buffers_ {
239 
242 
247 
249  gsl_odeiv_step* s_;
250  gsl_odeiv_control* c_;
251  gsl_odeiv_evolve* e_;
252  gsl_odeiv_system sys_;
253 
254  // IntergrationStep_ should be reset with the neuron on ResetNetwork,
255  // but remain unchanged during calibration. Since it is initialized with
256  // step_, and the resolution cannot change after nodes have been created,
257  // it is safe to place both here.
260 
269  };
270 
271  // Access functions for UniversalDataLogger -------------------------------
272 
274  template <State_::StateVecElems elem>
275  double_t get_y_elem_() const { return S_.y_[elem]; }
276 
281 
284  };
285 
286  inline
288  {
289  SpikeEvent e;
290  e.set_sender(*this);
291 
292  return target.handles_test_event(e, receptor_type);
293  }
294 
295 
296  inline
298  {
299  if (receptor_type != 0)
300  throw UnknownReceptorType(receptor_type, get_name());
301  return 0;
302  }
303 
304  inline
306  {
307  if (receptor_type != 0)
308  throw UnknownReceptorType(receptor_type, get_name());
309  return 0;
310  }
311 
312  inline
315  {
316  if (receptor_type != 0)
317  throw UnknownReceptorType(receptor_type, get_name());
318  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
319  }
320 
321  inline
323  {
324  P_.get(d);
325  S_.get(d);
327 
328  (*d)[names::recordables] = recordablesMap_.get_list();
329 
330  def<double_t>(d, names::t_spike, get_spiketime_ms());
331  }
332 
333  inline
335  {
336  Parameters_ ptmp = P_; // temporary copy in case of errors
337  ptmp.set(d); // throws if BadProperty
338  State_ stmp = S_; // temporary copy in case of errors
339  stmp.set(d, ptmp); // throws if BadProperty
340 
341  // We now know that (ptmp, stmp) are consistent. We do not
342  // write them back to (P_, S_) before we are also sure that
343  // the properties to be set in the parent class are internally
344  // consistent.
346 
347  // if we get here, temporaries contain consistent set of properties
348  P_ = ptmp;
349  S_ = stmp;
350 
351  calibrate();
352  }
353 
354 } // namespace
355 
356 
357 
358 #endif //HAVE_GSL
359 #endif //HH_COND_EXP_TRAUB_H
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: hh_cond_exp_traub.cpp:305
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
double IntegrationStep_
current integration time step, updated by GSL
Definition: hh_cond_exp_traub.h:259
Parameters_()
Definition: hh_cond_exp_traub.cpp:127
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
Buffers of the model.
Definition: hh_cond_exp_traub.h:236
void get(DictionaryDatum &) const
Definition: hh_cond_exp_traub.cpp:226
double g_Na
Sodium Conductance in nS.
Definition: hh_cond_exp_traub.h:167
RingBuffer currents_
Definition: hh_cond_exp_traub.h:246
State variables of the model.
Definition: hh_cond_exp_traub.h:197
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: hh_cond_exp_traub.cpp:352
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
Definition: hh_cond_exp_traub.h:205
double I_e
External Current in pA.
Definition: hh_cond_exp_traub.h:182
Definition: hh_cond_exp_traub.h:202
StateVecElems
Symbolic indices to the elements of the state vector y.
Definition: hh_cond_exp_traub.h:200
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
gsl_odeiv_step * s_
GSL ODE stuff.
Definition: hh_cond_exp_traub.h:249
double_t get_y_elem_() const
Read out state vector elements, used by UniversalDataLogger.
Definition: hh_cond_exp_traub.h:275
double tau_synE
Synaptic Time Constant Excitatory Synapse in ms.
Definition: hh_cond_exp_traub.h:180
Internal variables of the model.
Definition: hh_cond_exp_traub.h:226
double V_T
Voltage offset for dynamics (adjusts threshold to around -50 mV)
Definition: hh_cond_exp_traub.h:176
Parameters_ P_
Definition: hh_cond_exp_traub.h:277
double_t I_stim_
Input current injected by CurrentEvent.
Definition: hh_cond_exp_traub.h:268
Definition: hh_cond_exp_traub.h:110
friend class UniversalDataLogger< hh_cond_exp_traub >
Definition: hh_cond_exp_traub.h:157
Map names of recordables to data access functions.
Definition: recordables_map.h:58
RingBuffer spike_inh_
Definition: hh_cond_exp_traub.h:245
Definition: hh_cond_exp_traub.h:203
int hh_cond_exp_traub_dynamics(double, const double y[], double f[], void *pnode)
Definition: hh_cond_exp_traub.cpp:72
gsl_odeiv_system sys_
struct describing system
Definition: hh_cond_exp_traub.h:252
Definition: nest_time.h:130
double E_in
Inhibitory reversal Potential in mV.
Definition: hh_cond_exp_traub.h:179
std::string get_name() const
Return class name.
Definition: node.cpp:83
void calibrate()
Re-calculate dependent parameters of the node.
Definition: hh_cond_exp_traub.cpp:342
Independent parameters of the model.
Definition: hh_cond_exp_traub.h:166
static RecordablesMap< hh_cond_exp_traub > recordablesMap_
Mapping of recordables names to access functions.
Definition: hh_cond_exp_traub.h:283
double_t step_
step size in ms
Definition: hh_cond_exp_traub.h:258
UniversalDataLogger< hh_cond_exp_traub > logger_
Logger for all analog data.
Definition: hh_cond_exp_traub.h:241
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
double y_[STATE_VEC_SIZE]
neuron state, must be C-array for GSL solver
Definition: hh_cond_exp_traub.h:209
Variables_ V_
Definition: hh_cond_exp_traub.h:279
Definition: hh_cond_exp_traub.h:204
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
double E_L
Leak Reversal Potential in mV.
Definition: hh_cond_exp_traub.h:174
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
double U_old_
Definition: hh_cond_exp_traub.h:228
int_t RefractoryCounts_
Definition: hh_cond_exp_traub.h:227
gsl_odeiv_control * c_
adaptive stepsize control function
Definition: hh_cond_exp_traub.h:250
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: hh_cond_exp_traub.cpp:411
gsl_odeiv_evolve * e_
evolution function
Definition: hh_cond_exp_traub.h:251
double E_Na
Sodium Reversal Potential in mV.
Definition: hh_cond_exp_traub.h:172
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: hh_cond_exp_traub.h:297
double C_m
Membrane Capacitance in pF.
Definition: hh_cond_exp_traub.h:170
void set_status(const DictionaryDatum &)
Definition: hh_cond_exp_traub.h:334
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: hh_cond_exp_traub.cpp:299
~hh_cond_exp_traub()
Definition: hh_cond_exp_traub.cpp:287
int_t r_
number of refractory steps remaining
Definition: hh_cond_exp_traub.h:210
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
void set(const DictionaryDatum &, const Parameters_ &)
Definition: hh_cond_exp_traub.cpp:234
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
Buffers_(hh_cond_exp_traub &)
Sets buffer pointers to 0.
Definition: hh_cond_exp_traub.cpp:246
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
friend int hh_cond_exp_traub_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
double g_K
Potassium Conductance in nS.
Definition: hh_cond_exp_traub.h:168
double double_t
Double precision floating point numbers.
Definition: nest.h:93
double E_ex
Excitatory reversal Potential in mV.
Definition: hh_cond_exp_traub.h:178
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
double g_L
Leak Conductance in nS.
Definition: hh_cond_exp_traub.h:169
RingBuffer spike_exc_
buffers and sums up incoming spikes/currents
Definition: hh_cond_exp_traub.h:244
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
double tau_synI
Synaptic Time Constant Inhibitory Synapse in ms.
Definition: hh_cond_exp_traub.h:181
Definition: hh_cond_exp_traub.h:206
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: hh_cond_exp_traub.cpp:186
Buffers_ B_
Definition: hh_cond_exp_traub.h:280
Definition: hh_cond_exp_traub.h:201
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
State_ S_
Definition: hh_cond_exp_traub.h:278
Event for spike information.
Definition: event.h:320
Base class for all NEST network objects.
Definition: node.h:96
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: hh_cond_exp_traub.h:287
State_(const Parameters_ &p)
Definition: hh_cond_exp_traub.cpp:144
double_t get_spiketime_ms() const
Definition: archiving_node.h:163
double E_K
Potassium Reversal Potential in mV.
Definition: hh_cond_exp_traub.h:173
const Name p("p")
current release probability (Tsodyks2_connection)
Definition: nest_names.h:218
hh_cond_exp_traub()
Definition: hh_cond_exp_traub.cpp:270
void get_status(DictionaryDatum &) const
Definition: hh_cond_exp_traub.h:322
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
State_ & operator=(const State_ &s)
Definition: hh_cond_exp_traub.cpp:172
Buffer Layout.
Definition: ring_buffer.h:77
const Name t_spike("t_spike")
Time of last spike.
Definition: nest_names.h:281
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: hh_cond_exp_traub.cpp:203
Definition: hh_cond_exp_traub.h:200