NEST  2.6.0,not_revisioned_source_dir@0
ht_neuron.h
Go to the documentation of this file.
1 /*
2  * ht_neuron.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 HT_NEURON_H
24 #define HT_NEURON_H
25 
26 #include "archiving_node.h"
27 #include <vector>
28 #include <string>
29 #include "stringdatum.h"
30 
31 #ifdef HAVE_GSL_1_11
32 
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: ht_neuron - Neuron model after Hill & Tononi (2005).
44 
45  Description:
46  This model neuron implements a slightly modified version of the
47  neuron model described in [1]. The most important properties are:
48 
49  - Integrate-and-fire with threshold that is increased on spiking
50  and decays back to an equilibrium value.
51  - No hard reset, but repolarizing potassium current.
52  - AMPA, NMDA, GABA_A, and GABA_B conductance-based synapses with
53  beta-function (difference of two exponentials) time course.
54  - Intrinsic currents I_h (pacemaker), I_T (low-threshold calcium),
55  I_Na(p) (persistent sodium), and I_KNa (depolarization-activated
56  potassium).
57 
58  In comparison to the model described in the paper, the following
59  modifications were mare:
60 
61  - NMDA conductance is given by g(t) = g_peak * m(V), where
62 
63  m(V) = 1 / ( 1 + exp( - ( V - NMDA_Vact ) / NMDA_Sact ) )
64 
65  This is an approximation to the NMDA model used in [2].
66 
67  - Several apparent typographical errors in the descriptions of
68  the intrinsic currents were fixed, hopefully in a meaningful
69  way.
70 
71  I'd like to thank Sean Hill for giving me access to his
72  simulator source code.
73 
74  See examples/hilltononi for usage examples.
75 
76  Warning:
77  THIS MODEL NEURON HAS NOT BEEN TESTED EXTENSIVELY!
78 
79  Parameters:
80  V_m - membrane potential
81  spike_duration - duration of re-polarizing potassium current
82  Tau_m - membrane time constant applying to all currents but repolarizing K-current
83  (see [1, p 1677])
84  Tau_spike - membrane time constant applying to repolarizing K-current
85  Theta, Theta_eq, Tau_theta - Threshold, equilibrium value, time constant
86  g_KL, E_K, g_NaL, E_Na - conductances and reversal potentials for K and Na leak currents
87 
88  {AMPA,NMDA,GABA_A,GABA_B}_{E_rev,g_peak,Tau_1,Tau_2}
89  - reversal potentials, peak conductances and time constants for synapses
90  (Tau_1: rise time, Tau_2: decay time, Tau_1 < Tau_2)
91 
92  NMDA_Sact, NMDA_Vact - Parameters for voltage dependence of NMDA-synapse, see eq. above
93 
94  {h,T,NaP,KNa}_{E_rev,g_peak} - reversal potential and peak conductance for intrinsic currents
95 
96  receptor_types - dictionary mapping synapse names to ports on neuron model
97  recordables - list of recordable quantities.
98 
99  Author: Hans Ekkehard Plesser
100 
101  Sends: SpikeEvent
102 
103  Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
104 
105  FirstVersion: October 2009
106 
107  References:
108  [1] S Hill and G Tononi (2005). J Neurophysiol 93:1671-1698.
109  [2] ED Lumer, GM Edelman, and G Tononi (1997). Cereb Cortex 7:207-227.
110 
111  SeeAlso: ht_synapse
112 */
113 
114 namespace nest{
125  extern "C"
126  int ht_neuron_dynamics (double, const double*, double*, void*);
127 
128  class ht_neuron: public Archiving_Node
129  {
130  public:
131  ht_neuron();
132  ht_neuron(const ht_neuron&);
133  ~ht_neuron();
134 
139  using Node::handle;
141 
143 
144  void handle(SpikeEvent & e);
145  void handle(CurrentEvent& e);
146  void handle(DataLoggingRequest &);
147 
151 
152  void get_status(DictionaryDatum &) const;
153  void set_status(const DictionaryDatum &);
154 
155  private:
164 
165  void init_state_(const Node& proto);
166  void init_buffers_();
167  void calibrate();
168 
169  void update(Time const &, const long_t, const long_t);
170 
172 
173  // END Boilerplate function declarations ----------------------------
174 
175  // Friends --------------------------------------------------------
176 
177  // make dynamics function quasi-member
178  friend int ht_neuron_dynamics(double, const double*, double*, void*);
179 
180  // ----------------------------------------------------------------
181 
185  struct Parameters_ {
186  // Leaks
187  double_t E_Na; // 30 mV
188  double_t E_K; // -90 mV
189  double_t g_NaL; // 0.2
190  double_t g_KL; // 1.0 - 1.85
192 
193  // Dynamic threshold
196 
197  // Spike potassium current
200 
201  Parameters_();
202 
203  void get(DictionaryDatum&) const;
204  void set(const DictionaryDatum&);
205 
206  // Parameters for synapse of type AMPA, GABA_A, GABA_B and NMDA
211 
218 
223 
228 
229  // parameters for intrinsic currents
232 
235 
238 
241  };
242 
243  // ----------------------------------------------------------------
244 
248  public:
249  struct State_ {
250 
251  // y_ = [V, Theta, Synapses]
252  enum StateVecElems_ { VM = 0,
262 
264 
265  // Timer (counter) for potassium current.
267 
268  bool g_spike_; // active / not active
269 
274 
275  State_();
276  State_(const Parameters_& p);
277  State_(const State_& s);
278  ~State_();
279 
280  State_& operator=(const State_& s);
281 
282  void get(DictionaryDatum&) const;
283  void set(const DictionaryDatum&, const Parameters_&);
284  };
285  private:
286 
287  // These friend declarations must be precisely here.
288  friend class RecordablesMap<ht_neuron>;
289  friend class UniversalDataLogger<ht_neuron>;
290 
291 
292  // ----------------------------------------------------------------
293 
297  struct Buffers_ {
299  Buffers_(const Buffers_&, ht_neuron&);
300 
302 
304  std::vector<RingBuffer> spike_inputs_;
306 
308  gsl_odeiv_step* s_;
309  gsl_odeiv_control* c_;
310  gsl_odeiv_evolve* e_;
311  gsl_odeiv_system sys_;
312 
313  // IntergrationStep_ should be reset with the neuron on ResetNetwork,
314  // but remain unchanged during calibration. Since it is initialized with
315  // step_, and the resolution cannot change after nodes have been created,
316  // it is safe to place both here.
319 
328  };
329 
330  // ----------------------------------------------------------------
331 
335  struct Variables_ {
337  std::vector<double_t> cond_steps_;
338 
341  };
342 
343 
344  // readout functions, can use template for vector elements
345  template <State_::StateVecElems_ elem>
346  double_t get_y_elem_() const { return S_.y_[elem]; }
348  double_t get_g_spike_() const { return S_.g_spike_; }
349  double_t get_I_NaP_() const { return S_.I_NaP_; }
350  double_t get_I_KNa_() const { return S_.I_KNa_; }
351  double_t get_I_T_() const { return S_.I_T_; }
352  double_t get_I_h_() const { return S_.I_h_; }
353 
355 
360  };
361 
362 
363 inline
365 {
366  SpikeEvent e;
367  e.set_sender(*this);
368 
369  return target.handles_test_event(e, receptor_type);
370 }
371 
372 
373 inline
375 {
376  assert(B_.spike_inputs_.size() == 4);
377 
378  if ( !( INF_SPIKE_RECEPTOR < receptor_type
379  && receptor_type < SUP_SPIKE_RECEPTOR ) )
380  {
381  throw UnknownReceptorType(receptor_type, get_name());
382  return 0;
383  }
384  else
385  return receptor_type - 1;
386 
387 
388  /*
389  if (receptor_type != 0)
390  throw UnknownReceptorType(receptor_type, get_name());
391  return 0;*/
392 }
393 
394 inline
396 {
397 
398  if (receptor_type != 0)
399  throw UnknownReceptorType(receptor_type, get_name());
400  return 0;
401 }
402 
403 inline
406 {
407  if (receptor_type != 0)
408  throw UnknownReceptorType(receptor_type, get_name());
409  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
410 }
411 
412 }
413 
414 #endif //HAVE_GSL
415 #endif //HT_NEURON_H
double_t GABA_B_Tau_2
Definition: ht_neuron.h:226
double_t NaP_g_peak
Definition: ht_neuron.h:230
int int_t
Integer number with at least 16 bit.
Definition: nest.h:95
RingBuffer currents_
Definition: ht_neuron.h:305
Definition of Archiving_Node which is capable of recording and managing a spike history.
double_t NMDA_Sact
mV, scale of inactivation
Definition: ht_neuron.h:217
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
Definition: ht_neuron.h:259
double_t h_E_rev
Definition: ht_neuron.h:240
double_t GABA_B_Tau_1
Definition: ht_neuron.h:225
static RecordablesMap< ht_neuron > recordablesMap_
Definition: ht_neuron.h:354
Internal variables of the model.
Definition: ht_neuron.h:335
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
Parameters_()
Definition: ht_neuron.cpp:171
double_t get_g_spike_() const
Definition: ht_neuron.h:348
double_t GABA_A_E_rev
Definition: ht_neuron.h:222
double_t Theta_eq
Definition: ht_neuron.h:194
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: ht_neuron.cpp:430
Definition: ht_neuron.h:252
int ht_neuron_dynamics(double, const double y[], double f[], void *pnode)
Definition: ht_neuron.cpp:61
double_t I_NaP_
Persistent Na current; member only to allow recording.
Definition: ht_neuron.h:270
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
friend class UniversalDataLogger< ht_neuron >
Definition: ht_neuron.h:289
Definition: ht_neuron.h:162
~State_()
Definition: ht_neuron.cpp:271
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: ht_neuron.cpp:318
Definition: ht_neuron.h:162
assert(pNet!=0)
gsl_odeiv_system sys_
struct describing system
Definition: ht_neuron.h:311
void calibrate()
Re-calculate dependent parameters of the node.
Definition: ht_neuron.cpp:490
double_t g_KL
Definition: ht_neuron.h:190
State_ & operator=(const State_ &s)
Definition: ht_neuron.cpp:251
double_t Tau_theta
Definition: ht_neuron.h:195
UniversalDataLogger< ht_neuron > logger_
Definition: ht_neuron.h:301
friend int ht_neuron_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
double_t GABA_B_E_rev
Definition: ht_neuron.h:227
Definition: ht_neuron.h:254
double_t KNa_g_peak
Definition: ht_neuron.h:233
double_t T_E_rev
Definition: ht_neuron.h:237
bool g_spike_
Definition: ht_neuron.h:268
Map names of recordables to data access functions.
Definition: recordables_map.h:58
double_t get_synapse_constant(double_t, double_t, double_t)
Definition: ht_neuron.cpp:473
void set(const DictionaryDatum &, const Parameters_ &)
Definition: ht_neuron.cpp:363
Definition: nest_time.h:130
double IntegrationStep_
current integration time step, updated by GSL
Definition: ht_neuron.h:318
double_t AMPA_E_rev
Definition: ht_neuron.h:210
double_t T_g_peak
Definition: ht_neuron.h:236
double_t NMDA_Tau_2
Definition: ht_neuron.h:214
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: ht_neuron.cpp:554
std::string get_name() const
Return class name.
Definition: node.cpp:83
double_t h_g_peak
Definition: ht_neuron.h:239
Definition: ht_neuron.h:255
Definition: ht_neuron.h:256
Buffers_ B_
Definition: ht_neuron.h:359
Buffers_(ht_neuron &)
Definition: ht_neuron.cpp:370
Definition: ht_neuron.h:255
Buffers of the model.
Definition: ht_neuron.h:297
double_t GABA_A_g_peak
Definition: ht_neuron.h:219
double_t NaP_E_rev
Definition: ht_neuron.h:231
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: ht_neuron.cpp:424
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
Definition: ht_neuron.h:253
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
SynapseTypes
Synapse types to connect to.
Definition: ht_neuron.h:161
double_t get_I_T_() const
Definition: ht_neuron.h:351
Definition: ht_neuron.h:260
Definition: ht_neuron.h:257
double_t get_I_h_() const
Definition: ht_neuron.h:352
double_t I_T_
Low-thresh Ca current; member only to allow recording.
Definition: ht_neuron.h:272
double_t y_[STATE_VEC_SIZE]
neuron state, must be C-array for GSL solver
Definition: ht_neuron.h:263
double_t Tau_spike
Definition: ht_neuron.h:198
double_t get_y_elem_() const
Definition: ht_neuron.h:346
ht_neuron()
Definition: ht_neuron.cpp:396
double_t E_K
Definition: ht_neuron.h:188
State_()
Definition: ht_neuron.cpp:209
Independent parameters of the model.
Definition: ht_neuron.h:185
double_t I_h_
Pacemaker current; member only to allow recording.
Definition: ht_neuron.h:273
double_t GABA_A_Tau_2
Definition: ht_neuron.h:221
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
double_t I_KNa_
Depol act. K current; member only to allow recording.
Definition: ht_neuron.h:271
gsl_odeiv_evolve * e_
evolution function
Definition: ht_neuron.h:310
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
~ht_neuron()
Definition: ht_neuron.cpp:412
gsl_odeiv_control * c_
adaptive stepsize control function
Definition: ht_neuron.h:309
double_t NMDA_E_rev
Definition: ht_neuron.h:215
double_t I_stim_
Input current injected by CurrentEvent.
Definition: ht_neuron.h:327
double_t AMPA_Tau_1
Definition: ht_neuron.h:208
double_t get_I_KNa_() const
Definition: ht_neuron.h:350
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
std::vector< double_t > cond_steps_
size of conductance steps for arriving spikes
Definition: ht_neuron.h:337
double double_t
Double precision floating point numbers.
Definition: nest.h:93
double_t Tau_m
Definition: ht_neuron.h:191
Definition: ht_neuron.h:258
double_t AMPA_Tau_2
Definition: ht_neuron.h:209
Definition: ht_neuron.h:257
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 GABA_B_g_peak
Definition: ht_neuron.h:224
Request data to be logged/logged data to be sent.
Definition: event.h:486
double_t g_NaL
Definition: ht_neuron.h:189
double_t NMDA_Vact
mV, inactive for V << Vact, inflection of sigmoid
Definition: ht_neuron.h:216
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
State variables of the model.
Definition: ht_neuron.h:249
double_t KNa_E_rev
Definition: ht_neuron.h:234
double_t get_I_NaP_() const
Definition: ht_neuron.h:349
Definition: ht_neuron.h:161
double_t NMDA_g_peak
Definition: ht_neuron.h:212
double_t get_r_potassium_() const
Definition: ht_neuron.h:347
void get_status(DictionaryDatum &) const
Definition: ht_neuron.cpp:515
State_ S_
Definition: ht_neuron.h:357
Event for spike information.
Definition: event.h:320
StateVecElems_
Definition: ht_neuron.h:252
double_t NMDA_Tau_1
Definition: ht_neuron.h:213
double_t t_spike
Definition: ht_neuron.h:199
int_t PotassiumRefractoryCounts_
Duration of potassium current.
Definition: ht_neuron.h:340
Base class for all NEST network objects.
Definition: node.h:96
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: ht_neuron.h:374
int_t r_potassium_
Definition: ht_neuron.h:266
gsl_odeiv_step * s_
GSL ODE stuff.
Definition: ht_neuron.h:308
Variables_ V_
Definition: ht_neuron.h:358
Definition: ht_neuron.h:163
double_t step_
step size in ms
Definition: ht_neuron.h:317
Definition: ht_neuron.h:259
Definition: ht_neuron.h:254
const Name p("p")
current release probability (Tsodyks2_connection)
Definition: nest_names.h:218
Definition: ht_neuron.h:256
Definition: ht_neuron.h:162
Definition: ht_neuron.h:261
void set_status(const DictionaryDatum &)
Definition: ht_neuron.cpp:532
void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: ht_neuron.cpp:613
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
Definition: ht_neuron.h:162
double_t GABA_A_Tau_1
Definition: ht_neuron.h:220
double_t E_Na
Definition: ht_neuron.h:187
Parameters_ P_
Definition: ht_neuron.h:356
Buffer Layout.
Definition: ring_buffer.h:77
std::vector< RingBuffer > spike_inputs_
buffers and sums up incoming spikes/currents
Definition: ht_neuron.h:304
double_t AMPA_g_peak
Definition: ht_neuron.h:207
Definition: ht_neuron.h:128
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: ht_neuron.h:364