NEST main@f146f75
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
99.. note::
100
101 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
102 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
103 the inhibitory one. Only the absolute value of the weight sets the conductance
104 amplitude. Spike connections must use the default ``receptor_type`` of 0.
105
106 See :ref:`synapse_selection` for the conventions used by other models.
107
108Parameters
109++++++++++
110
111The following parameters can be set in the status Dictionary.
112
113=========== ====== =========================================================
114V_m mV Membrane potential
115V_T mV Voltage offset that controls dynamics. For default
116 parameters, V_T = -63mV results in a threshold around
117 -50mV.
118E_L mV Leak reversal potential
119C_m pF Capacity of the membrane
120g_L nS Leak conductance
121tau_syn_ex ms Time constant of the excitatory synaptic exponential
122 function
123tau_syn_in ms Time constant of the inhibitory synaptic exponential
124 function
125t_ref ms Duration of refractory period (see Note).
126E_ex mV Excitatory synaptic reversal potential
127E_in mV Inhibitory synaptic reversal potential
128E_Na mV Sodium reversal potential
129g_Na nS Sodium peak conductance
130E_K mV Potassium reversal potential
131g_K nS Potassium peak conductance
132I_e pA External input current
133=========== ====== =========================================================
134
135References
136++++++++++
137
138.. footbibliography::
139
140Sends
141+++++
142
143SpikeEvent
144
145Receives
146++++++++
147
148SpikeEvent, CurrentEvent, DataLoggingRequest
149
150See also
151++++++++
152
153hh_psc_alpha
154
155Examples using this model
156+++++++++++++++++++++++++
157
158.. listexamples:: hh_cond_exp_traub
159
160EndUserDocs */
161
162void register_hh_cond_exp_traub( const std::string& name );
163
164class hh_cond_exp_traub : public ArchivingNode
165{
166
167public:
168 hh_cond_exp_traub();
169 hh_cond_exp_traub( const hh_cond_exp_traub& );
170 ~hh_cond_exp_traub() override;
171
177 using Node::handle;
178 using Node::handles_test_event;
179
180 size_t send_test_event( Node&, size_t, synindex, bool ) override;
181
182 void handle( SpikeEvent& ) override;
183 void handle( CurrentEvent& ) override;
184 void handle( DataLoggingRequest& ) override;
185
186 size_t handles_test_event( SpikeEvent&, size_t ) override;
187 size_t handles_test_event( CurrentEvent&, size_t ) override;
188 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
189
190 void get_status( Dictionary& ) const override;
191 void set_status( const Dictionary& ) override;
192
193private:
194 void init_buffers_() override;
195 void pre_run_hook() override;
196
197 void update( Time const&, const long, const long ) override;
198
199 // END Boilerplate function declarations ----------------------------
200
201 // Friends --------------------------------------------------------
202
203 // make dynamics function quasi-member
204 friend int hh_cond_exp_traub_dynamics( double, const double*, double*, void* );
205
206 // The next two classes need to be friends to access the State_ class/member
207 friend class RecordablesMap< hh_cond_exp_traub >;
208 friend class UniversalDataLogger< hh_cond_exp_traub >;
209
210private:
211 // ----------------------------------------------------------------
212
216 struct Parameters_
217 {
218 double g_Na;
219 double g_K;
220 double g_L;
221 double C_m;
222
223 double E_Na;
224 double E_K;
225 double E_L;
226
228 double V_T;
229
230 double E_ex;
231 double E_in;
232 double tau_synE;
233 double tau_synI;
234 double t_ref_;
235 double I_e;
236
237 Parameters_();
238
239 void get( Dictionary& ) const;
240 void set( const Dictionary&, Node* node );
241 };
242
243public:
244 // ----------------------------------------------------------------
245
249 struct State_
250 {
252 enum StateVecElems
253 {
254 V_M = 0,
255 HH_M, // 1
256 HH_H, // 2
257 HH_N, // 3
258 G_EXC, // 4
259 G_INH, // 5
260 STATE_VEC_SIZE
261 };
262
264 double y_[ STATE_VEC_SIZE ];
265 int r_;
266
267 State_( const Parameters_& p );
268 State_( const State_& s );
269
270 State_& operator=( const State_& );
271
272 void get( Dictionary& ) const;
273 void set( const Dictionary&, const Parameters_&, Node* );
274 };
275
276 // ----------------------------------------------------------------
277
281 struct Variables_
282 {
283 int refractory_counts_;
284 double U_old_; // for spike-detection
285 };
286
287 // ----------------------------------------------------------------
288
292 struct Buffers_
293 {
294 Buffers_( hh_cond_exp_traub& );
296 Buffers_( const Buffers_&, hh_cond_exp_traub& );
297
299 UniversalDataLogger< hh_cond_exp_traub > logger_;
300
302 RingBuffer spike_exc_;
303 RingBuffer spike_inh_;
304 RingBuffer currents_;
305
307 gsl_odeiv_step* s_;
308 gsl_odeiv_control* c_;
309 gsl_odeiv_evolve* e_;
310 gsl_odeiv_system sys_;
311
312 // Since IntegrationStep_ is initialized with step_, and the resolution
313 // cannot change after nodes have been created, it is safe to place both
314 // here.
315 double step_;
316 double IntegrationStep_;
317
325 double I_stim_;
326 };
327
328 // Access functions for UniversalDataLogger -------------------------------
329
331 template < State_::StateVecElems elem >
332 double
333 get_y_elem_() const
334 {
335 return S_.y_[ elem ];
336 }
337
338 Parameters_ P_;
339 State_ S_;
340 Variables_ V_;
341 Buffers_ B_;
342
344 static RecordablesMap< hh_cond_exp_traub > recordablesMap_;
345};
346
347inline size_t
348hh_cond_exp_traub::send_test_event( Node& target, size_t receptor_type, synindex, bool )
349{
351 e.set_sender( *this );
352
353 return target.handles_test_event( e, receptor_type );
354}
355
356
357inline size_t
358hh_cond_exp_traub::handles_test_event( SpikeEvent&, size_t receptor_type )
359{
360 if ( receptor_type != 0 )
361 {
362 throw UnknownReceptorType( receptor_type, get_name() );
363 }
364 return 0;
365}
366
367inline size_t
368hh_cond_exp_traub::handles_test_event( CurrentEvent&, size_t receptor_type )
369{
370 if ( receptor_type != 0 )
371 {
372 throw UnknownReceptorType( receptor_type, get_name() );
373 }
374 return 0;
375}
376
377inline size_t
378hh_cond_exp_traub::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
379{
380 if ( receptor_type != 0 )
381 {
382 throw UnknownReceptorType( receptor_type, get_name() );
383 }
384 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
385}
386
387inline void
388hh_cond_exp_traub::get_status( Dictionary& d ) const
389{
390 P_.get( d );
391 S_.get( d );
393
394 d[ names::recordables ] = recordablesMap_.get_list();
395
396 d[ names::t_spike ] = get_spiketime_ms();
397}
398
399inline void
400hh_cond_exp_traub::set_status( const Dictionary& d )
401{
402 Parameters_ ptmp = P_; // temporary copy in case of errors
403 ptmp.set( d, this ); // throws if BadProperty
404 State_ stmp = S_; // temporary copy in case of errors
405 stmp.set( d, ptmp, this ); // throws if BadProperty
406
407 // We now know that (ptmp, stmp) are consistent. We do not
408 // write them back to (P_, S_) before we are also sure that
409 // the properties to be set in the parent class are internally
410 // consistent.
412
413 // if we get here, temporaries contain consistent set of properties
414 P_ = ptmp;
415 S_ = stmp;
416
417 pre_run_hook();
418}
419
420} // namespace
421
422
423#endif // HAVE_GSL
424#endif // HH_COND_EXP_TRAUB_H
A node which archives spike history for the purposes of spike-timing dependent plasticity (STDP).
Definition archiving_node.h:49
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition archiving_node.cpp:249
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition archiving_node.cpp:265
Event for electrical currents.
Definition event.h:608
Request data to be logged/logged data to be sent.
Definition event.h:675
Base class for all NEST network objects.
Definition node.h:99
Event for spike information.
Definition event.h:420
Exception to be thrown if the specified receptor type does not exist in the node.
Definition exceptions.h:417
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
RecordablesMap< binary_neuron< TGainfunction > > binary_neuron< TGainfunction >::recordablesMap_
Definition binary_neuron.h:319
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:121
const double e
Definition numerics.cpp:32