NEST main@caf0ae8
 
Loading...
Searching...
No Matches
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// Generated includes:
27#include "config.h"
28
29#ifdef HAVE_GSL
30
31// C includes:
32#include <gsl/gsl_odeiv.h>
33
34// Includes from nestkernel:
35#include "archiving_node.h"
36#include "connection.h"
37#include "event.h"
38#include "nest_types.h"
39#include "recordables_map.h"
40#include "ring_buffer.h"
42
43namespace nest
44{
45
56extern "C" int hh_cond_exp_traub_dynamics( double, const double*, double*, void* );
57
58/* BeginUserDocs: neuron, Hodgkin-Huxley, conductance-based, soft threshold
59
60Short description
61+++++++++++++++++
62
63Hodgkin-Huxley model for Brette et al (2007) review
64
65Description
66+++++++++++
67
68``hh_cond_exp_traub`` is an implementation of a modified Hodgkin-Huxley model.
69
70This model was specifically developed for a major review of simulators :footcite:p:`Brette2007`,
71based on a model of hippocampal pyramidal cells by Traub and Miles :footcite:p:`Traub1991`.
72The key differences between the current model and the model in :footcite:p:`Traub1991` are:
73
74- This model is a point neuron, not a compartmental model.
75- This model includes only ``I_Na`` and ``I_K``, with simpler ``I_K`` dynamics than
76 in :footcite:p:`Traub1991`, so it has only three instead of eight gating variables;
77 in particular, all Ca dynamics have been removed.
78- Incoming spikes induce an instantaneous conductance change followed by
79 exponential decay instead of activation over time.
80
81This model is primarily provided as reference implementation for hh_coba
82example of the Brette et al (2007) review. Default parameter values are chosen
83to match those used with NEST 1.9.10 when preparing data for :footcite:p:`Brette2007`. Code for all
84simulators covered is available from ModelDB :footcite:p:`Traub1991b`.
85
86.. note::
87
88 In this model, a spike is emitted if :math:`V_m \geq V_T + 30` mV and :math:`V_m`
89 has fallen during the current time step.
90
91 To avoid multiple spikes from occurring during the falling flank of a
92 spike, it is essential to choose a sufficiently long refractory period.
93 Traub and Miles used :math:`t_{ref} = 3` ms (:footcite:p:`Traub1991`, p 118), while we used
94 :math:`t_{ref} = 2` ms in :footcite:p:`Traub1991`.
95
96 For further details on asynchronicity in spike and firing events with Hodgkin Huxley models
97 see :ref:`here <hh_details>`.
98
99Parameters
100++++++++++
101
102The following parameters can be set in the status Dictionary.
103
104=========== ====== =========================================================
105V_m mV Membrane potential
106V_T mV Voltage offset that controls dynamics. For default
107 parameters, V_T = -63mV results in a threshold around
108 -50mV.
109E_L mV Leak reversal potential
110C_m pF Capacity of the membrane
111g_L nS Leak conductance
112tau_syn_ex ms Time constant of the excitatory synaptic exponential
113 function
114tau_syn_in ms Time constant of the inhibitory synaptic exponential
115 function
116t_ref ms Duration of refractory period (see Note).
117E_ex mV Excitatory synaptic reversal potential
118E_in mV Inhibitory synaptic reversal potential
119E_Na mV Sodium reversal potential
120g_Na nS Sodium peak conductance
121E_K mV Potassium reversal potential
122g_K nS Potassium peak conductance
123I_e pA External input current
124=========== ====== =========================================================
125
126References
127++++++++++
128
129.. footbibliography::
130
131Sends
132+++++
133
134SpikeEvent
135
136Receives
137++++++++
138
139SpikeEvent, CurrentEvent, DataLoggingRequest
140
141See also
142++++++++
143
144hh_psc_alpha
145
146Examples using this model
147+++++++++++++++++++++++++
148
149.. listexamples:: hh_cond_exp_traub
150
151EndUserDocs */
152
153void register_hh_cond_exp_traub( const std::string& name );
154
155class hh_cond_exp_traub : public ArchivingNode
156{
157
158public:
159 hh_cond_exp_traub();
160 hh_cond_exp_traub( const hh_cond_exp_traub& );
161 ~hh_cond_exp_traub() override;
162
168 using Node::handle;
169 using Node::handles_test_event;
170
171 size_t send_test_event( Node&, size_t, synindex, bool ) override;
172
173 void handle( SpikeEvent& ) override;
174 void handle( CurrentEvent& ) override;
175 void handle( DataLoggingRequest& ) override;
176
177 size_t handles_test_event( SpikeEvent&, size_t ) override;
178 size_t handles_test_event( CurrentEvent&, size_t ) override;
179 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
180
181 void get_status( Dictionary& ) const override;
182 void set_status( const Dictionary& ) override;
183
184private:
185 void init_buffers_() override;
186 void pre_run_hook() override;
187
188 void update( Time const&, const long, const long ) override;
189
190 // END Boilerplate function declarations ----------------------------
191
192 // Friends --------------------------------------------------------
193
194 // make dynamics function quasi-member
195 friend int hh_cond_exp_traub_dynamics( double, const double*, double*, void* );
196
197 // The next two classes need to be friends to access the State_ class/member
198 friend class RecordablesMap< hh_cond_exp_traub >;
199 friend class UniversalDataLogger< hh_cond_exp_traub >;
200
201private:
202 // ----------------------------------------------------------------
203
207 struct Parameters_
208 {
209 double g_Na;
210 double g_K;
211 double g_L;
212 double C_m;
213
214 double E_Na;
215 double E_K;
216 double E_L;
217
219 double V_T;
220
221 double E_ex;
222 double E_in;
223 double tau_synE;
224 double tau_synI;
225 double t_ref_;
226 double I_e;
227
228 Parameters_();
229
230 void get( Dictionary& ) const;
231 void set( const Dictionary&, Node* node );
232 };
233
234public:
235 // ----------------------------------------------------------------
236
240 struct State_
241 {
243 enum StateVecElems
244 {
245 V_M = 0,
246 HH_M, // 1
247 HH_H, // 2
248 HH_N, // 3
249 G_EXC, // 4
250 G_INH, // 5
251 STATE_VEC_SIZE
252 };
253
255 double y_[ STATE_VEC_SIZE ];
256 int r_;
257
258 State_( const Parameters_& p );
259 State_( const State_& s );
260
261 State_& operator=( const State_& );
262
263 void get( Dictionary& ) const;
264 void set( const Dictionary&, const Parameters_&, Node* );
265 };
266
267 // ----------------------------------------------------------------
268
272 struct Variables_
273 {
274 int refractory_counts_;
275 double U_old_; // for spike-detection
276 };
277
278 // ----------------------------------------------------------------
279
283 struct Buffers_
284 {
285 Buffers_( hh_cond_exp_traub& );
287 Buffers_( const Buffers_&, hh_cond_exp_traub& );
288
290 UniversalDataLogger< hh_cond_exp_traub > logger_;
291
293 RingBuffer spike_exc_;
294 RingBuffer spike_inh_;
295 RingBuffer currents_;
296
298 gsl_odeiv_step* s_;
299 gsl_odeiv_control* c_;
300 gsl_odeiv_evolve* e_;
301 gsl_odeiv_system sys_;
302
303 // Since IntegrationStep_ is initialized with step_, and the resolution
304 // cannot change after nodes have been created, it is safe to place both
305 // here.
306 double step_;
307 double IntegrationStep_;
308
316 double I_stim_;
317 };
318
319 // Access functions for UniversalDataLogger -------------------------------
320
322 template < State_::StateVecElems elem >
323 double
324 get_y_elem_() const
325 {
326 return S_.y_[ elem ];
327 }
328
329 Parameters_ P_;
330 State_ S_;
331 Variables_ V_;
332 Buffers_ B_;
333
335 static RecordablesMap< hh_cond_exp_traub > recordablesMap_;
336};
337
338inline size_t
339hh_cond_exp_traub::send_test_event( Node& target, size_t receptor_type, synindex, bool )
340{
341 SpikeEvent e;
342 e.set_sender( *this );
343
344 return target.handles_test_event( e, receptor_type );
345}
346
347
348inline size_t
349hh_cond_exp_traub::handles_test_event( SpikeEvent&, size_t receptor_type )
350{
351 if ( receptor_type != 0 )
352 {
353 throw UnknownReceptorType( receptor_type, get_name() );
354 }
355 return 0;
356}
357
358inline size_t
359hh_cond_exp_traub::handles_test_event( CurrentEvent&, size_t receptor_type )
360{
361 if ( receptor_type != 0 )
362 {
363 throw UnknownReceptorType( receptor_type, get_name() );
364 }
365 return 0;
366}
367
368inline size_t
369hh_cond_exp_traub::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
370{
371 if ( receptor_type != 0 )
372 {
373 throw UnknownReceptorType( receptor_type, get_name() );
374 }
375 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
376}
377
378inline void
379hh_cond_exp_traub::get_status( Dictionary& d ) const
380{
381 P_.get( d );
382 S_.get( d );
384
385 d[ names::recordables ] = recordablesMap_.get_list();
386
387 d[ names::t_spike ] = get_spiketime_ms();
388}
389
390inline void
391hh_cond_exp_traub::set_status( const Dictionary& d )
392{
393 Parameters_ ptmp = P_; // temporary copy in case of errors
394 ptmp.set( d, this ); // throws if BadProperty
395 State_ stmp = S_; // temporary copy in case of errors
396 stmp.set( d, ptmp, this ); // throws if BadProperty
397
398 // We now know that (ptmp, stmp) are consistent. We do not
399 // write them back to (P_, S_) before we are also sure that
400 // the properties to be set in the parent class are internally
401 // consistent.
403
404 // if we get here, temporaries contain consistent set of properties
405 P_ = ptmp;
406 S_ = stmp;
407
408 pre_run_hook();
409}
410
411} // namespace
412
413
414#endif // HAVE_GSL
415#endif // HH_COND_EXP_TRAUB_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition archiving_node.cpp:220
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition archiving_node.cpp:236
const std::string V_T("V_T")
const std::string E_L("E_L")
const std::string I_e("I_e")
const std::string E_K("E_K")
const std::string recordables("recordables")
const std::string C_m("C_m")
const std::string d("d")
const std::string g_Na("g_Na")
const std::string E_Na("E_Na")
const std::string g_K("g_K")
const std::string E_in("E_in")
const std::string target("target")
const std::string t_spike("t_spike")
const std::string E_ex("E_ex")
const std::string g_L("g_L")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
const double e
Definition numerics.cpp:32