NEST main@caf0ae8
 
Loading...
Searching...
No Matches
hh_cond_beta_gap_traub.h
Go to the documentation of this file.
1/*
2 * hh_cond_beta_gap_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_BETA_GAP_TRAUB_H
24#define HH_COND_BETA_GAP_TRAUB_H
25
26// Generated includes:
27#include "config.h"
28
29#ifdef HAVE_GSL
30
31// C includes:
32#include <gsl/gsl_errno.h>
33#include <gsl/gsl_matrix.h>
34#include <gsl/gsl_odeiv.h>
35#include <gsl/gsl_sf_exp.h>
36
37// Includes from nestkernel:
38#include "archiving_node.h"
39#include "connection.h"
40#include "event.h"
41#include "nest_types.h"
42#include "node.h"
43#include "recordables_map.h"
44#include "ring_buffer.h"
46
47namespace nest
48{
49
60extern "C" int hh_cond_beta_gap_traub_dynamics( double, const double*, double*, void* );
61
62/* BeginUserDocs: neuron, Hodgkin-Huxley, conductance-based, soft threshold
63
64Short description
65+++++++++++++++++
66
67Hodgkin-Huxley neuron with gap junction support and beta function synaptic conductances
68
69Description
70+++++++++++
71
72``hh_cond_beta_gap_traub`` is an implementation of a modified Hodgkin-Huxley model
73that also supports gap junctions.
74
75This model is derived from the ``hh_conda_exp`` model, but supports double-exponential-shaped
76(beta-shaped) synaptic conductances and also supports gap junctions. The model is originally
77based on a model of hippocampal pyramidal cells by Traub and Miles :footcite:p:`Traub1991`.
78The key differences between the current model and the model in :footcite:p:`Traub1991` are:
79
80- This model is a point neuron, not a compartmental model.
81- Following :footcite:p:`Brette2007`, this model includes only ``I_Na`` and ``I_K``, with simpler ``I_K`` dynamics than
82 in :footcite:p:`Traub1991`, so it has only three instead of eight gating variables;
83 in particular, all Ca dynamics have been removed.
84- Incoming spikes induce an instantaneous conductance change followed by
85 exponential decay instead of activation over time.
86- The model incorporates gap junctions :footcite:p:`Hahne2015`.
87
88For details on asynchronicity in spike and firing events with Hodgkin Huxley models
89see :ref:`here <hh_details>`.
90
91
92Postsynaptic currents
93---------------------
94
95Incoming spike events induce a postsynaptic change of conductance modelled by a
96beta function as outlined in :footcite:p:`Rotter1999` :footcite:p:`Roth2010`. The beta function is normalized such that
97an event of weight 1.0 results in a peak conductance of 1 nS at :math:`t = \tau_{rise,xx}` where xx is `ex` or `in`.
98
99Spike Detection
100---------------
101
102Spike detection is done by a combined threshold-and-local-maximum search: if
103there is a local maximum above a certain threshold of the membrane potential,
104it is considered a spike.
105
106Gap Junctions
107-------------
108
109Gap Junctions are implemented by a gap current of the form
110:math:`g_{ij}( V_i - V_j)`.
111
112.. note::
113 In this model, a spike is emitted if :math:`V_m \geq V_T + 30` mV and
114 :math:`V_m` has fallen during the current time step.
115
116 To avoid multiple spikes from occurring during the falling flank of a
117 spike, it is essential to choose a sufficiently long refractory period.
118 Traub and Miles used :math:`t_{ref} = 3` ms (:footcite:p:`Traub1991`, p 118), while we used
119 :math:`t_{ref} = 2` ms in :footcite:p:`Traub1991`.
120
121Parameters
122++++++++++
123
124The following parameters can be set in the status Dictionary.
125
126============ ====== =======================================================
127V_m mV Membrane potential
128V_T mV Voltage offset that controls dynamics. For default
129 parameters, V_T = -63mV results in a threshold around
130 -50mV
131E_L mV Leak reversal potential
132C_m pF Capacity of the membrane
133g_L nS Leak conductance
134tau_rise_ex ms Excitatory synaptic beta function rise time
135tau_decay_ex ms Excitatory synaptic beta function decay time
136tau_rise_in ms Inhibitory synaptic beta function rise time
137tau_decay_in ms Inhibitory synaptic beta function decay time
138t_ref ms Duration of refractory period (see Note)
139E_ex mV Excitatory synaptic reversal potential
140E_in mV Inhibitory synaptic reversal potential
141E_Na mV Sodium reversal potential
142g_Na nS Sodium peak conductance
143E_K mV Potassium reversal potential
144g_K nS Potassium peak conductance
145I_e pA External input current
146============ ====== =======================================================
147
148References
149++++++++++
150
151.. footbibliography::
152
153Sends
154+++++
155
156SpikeEvent
157
158Receives
159++++++++
160
161SpikeEvent, CurrentEvent, DataLoggingRequest
162
163See also
164++++++++
165
166hh_psc_alpha_gap, hh_cond_exp_traub, gap_junction, iaf_cond_beta
167
168
169Examples using this model
170+++++++++++++++++++++++++
171
172.. listexamples:: hh_cond_beta_gap_traub
173
174EndUserDocs */
175
176void register_hh_cond_beta_gap_traub( const std::string& name );
177
178class hh_cond_beta_gap_traub : public ArchivingNode
179{
180
181public:
182 typedef Node base;
183
184 hh_cond_beta_gap_traub();
185 hh_cond_beta_gap_traub( const hh_cond_beta_gap_traub& );
186 ~hh_cond_beta_gap_traub() override;
187
193 using Node::handle;
194 using Node::handles_test_event;
195 using Node::sends_secondary_event;
196
197 size_t send_test_event( Node& target, size_t receptor_type, synindex, bool ) override;
198
199 void handle( SpikeEvent& ) override;
200 void handle( CurrentEvent& ) override;
201 void handle( DataLoggingRequest& ) override;
202 void handle( GapJunctionEvent& ) override;
203
204 size_t handles_test_event( SpikeEvent&, size_t ) override;
205 size_t handles_test_event( CurrentEvent&, size_t ) override;
206 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
207 size_t handles_test_event( GapJunctionEvent&, size_t ) override;
208
209 void
210 sends_secondary_event( GapJunctionEvent& ) override
211 {
212 }
213
214 void get_status( Dictionary& ) const override;
215 void set_status( const Dictionary& ) override;
216
217private:
218 void init_buffers_() override;
219 double get_normalisation_factor( double, double );
220 void pre_run_hook() override;
221
225 bool update_( Time const&, const long, const long, const bool );
226
227 void update( Time const&, const long, const long ) override;
228 bool wfr_update( Time const&, const long, const long ) override;
229
230 // END Boilerplate function declarations ----------------------------
231
232 // Friends --------------------------------------------------------
233
234 // make dynamics function quasi-member
235 friend int hh_cond_beta_gap_traub_dynamics( double, const double*, double*, void* );
236
237 // The next two classes need to be friends to access the State_ class/member
238 friend class RecordablesMap< hh_cond_beta_gap_traub >;
239 friend class UniversalDataLogger< hh_cond_beta_gap_traub >;
240
241private:
242 // ----------------------------------------------------------------
243
247 struct Parameters_
248 {
249 double g_Na;
250 double g_K;
251 double g_L;
252 double C_m;
253 double E_Na;
254 double E_K;
255 double E_L;
256 double V_T;
257 double E_ex;
258 double E_in;
259 double tau_rise_ex;
260 double tau_decay_ex;
261 double tau_rise_in;
262 double tau_decay_in;
263 double t_ref_;
264 double I_e;
265
266 Parameters_();
267
268 void get( Dictionary& ) const;
269 void set( const Dictionary&, Node* );
270 };
271
272public:
273 // ----------------------------------------------------------------
274
278 struct State_
279 {
280
282 enum StateVecElems
283 {
284 V_M = 0,
285 HH_M, // 1
286 HH_H, // 2
287 HH_N, // 3
288 DG_EXC, // 4
289 G_EXC, // 5
290 DG_INH, // 6
291 G_INH, // 7
292 STATE_VEC_SIZE
293 };
294
296 double y_[ STATE_VEC_SIZE ];
297 int r_;
298
299 State_( const Parameters_& p );
300 State_( const State_& s );
301
302 State_& operator=( const State_& );
303
304 void get( Dictionary& ) const;
305 void set( const Dictionary&, const Parameters_&, Node* );
306 };
307
308 // Variables class -------------------------------------------------------
309
314 struct Variables_
315 {
320 double PSConInit_E;
321
326 double PSConInit_I;
327
329 int refractory_counts_;
330 double U_old_; // for spike-detection
331 };
332
333 // ----------------------------------------------------------------
334
338 struct Buffers_
339 {
340 Buffers_( hh_cond_beta_gap_traub& );
342 Buffers_( const Buffers_&, hh_cond_beta_gap_traub& );
343
345 UniversalDataLogger< hh_cond_beta_gap_traub > logger_;
346
348 RingBuffer spike_exc_;
349 RingBuffer spike_inh_;
350 RingBuffer currents_;
351
353 gsl_odeiv_step* s_;
354 gsl_odeiv_control* c_;
355 gsl_odeiv_evolve* e_;
356 gsl_odeiv_system sys_;
357
358 // Since IntegrationStep_ is initialized with step_, and the resolution
359 // cannot change after nodes have been created, it is safe to place both
360 // here.
361 double step_;
362 double IntegrationStep_;
363
364 // remembers current lag for piecewise interpolation
365 long lag_;
366
367 // remembers y_values from last wfr_update
368 std::vector< double > last_y_values;
369
370 // summarized gap weight
371 double sumj_g_ij_;
372
373 // summarized coefficients of the interpolation polynomial
374 std::vector< double > interpolation_coefficients;
375
383 double I_stim_;
384 };
385
386 // Access functions for UniversalDataLogger -------------------------------
387
389 template < State_::StateVecElems elem >
390 double
391 get_y_elem_() const
392 {
393 return S_.y_[ elem ];
394 }
395
396 Parameters_ P_;
397 State_ S_;
398 Variables_ V_;
399 Buffers_ B_;
400
402 static RecordablesMap< hh_cond_beta_gap_traub > recordablesMap_;
403};
404
405inline void
406hh_cond_beta_gap_traub::update( Time const& origin, const long from, const long to )
407{
408 update_( origin, from, to, false );
409}
410
411inline bool
412hh_cond_beta_gap_traub::wfr_update( Time const& origin, const long from, const long to )
413{
414 State_ old_state = S_; // save state before wfr_update
415 const bool wfr_tol_exceeded = update_( origin, from, to, true );
416 S_ = old_state; // restore old state
417
418 return not wfr_tol_exceeded;
419}
420
421inline size_t
422hh_cond_beta_gap_traub::send_test_event( Node& target, size_t receptor_type, synindex, bool )
423{
424 SpikeEvent e;
425 e.set_sender( *this );
426
427 return target.handles_test_event( e, receptor_type );
428}
429
430
431inline size_t
432hh_cond_beta_gap_traub::handles_test_event( SpikeEvent&, size_t receptor_type )
433{
434 if ( receptor_type != 0 )
435 {
436 throw UnknownReceptorType( receptor_type, get_name() );
437 }
438 return 0;
439}
440
441inline size_t
442hh_cond_beta_gap_traub::handles_test_event( CurrentEvent&, size_t receptor_type )
443{
444 if ( receptor_type != 0 )
445 {
446 throw UnknownReceptorType( receptor_type, get_name() );
447 }
448 return 0;
449}
450
451inline size_t
452hh_cond_beta_gap_traub::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
453{
454 if ( receptor_type != 0 )
455 {
456 throw UnknownReceptorType( receptor_type, get_name() );
457 }
458 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
459}
460
461inline size_t
462hh_cond_beta_gap_traub::handles_test_event( GapJunctionEvent&, size_t receptor_type )
463{
464 if ( receptor_type != 0 )
465 {
466 throw UnknownReceptorType( receptor_type, get_name() );
467 }
468 return 0;
469}
470
471inline void
472hh_cond_beta_gap_traub::get_status( Dictionary& d ) const
473{
474 P_.get( d );
475 S_.get( d );
477
478 d[ names::recordables ] = recordablesMap_.get_list();
479
480 d[ names::t_spike ] = get_spiketime_ms();
481}
482
483inline void
484hh_cond_beta_gap_traub::set_status( const Dictionary& d )
485{
486 Parameters_ ptmp = P_; // temporary copy in case of errors
487 ptmp.set( d, this ); // throws if BadProperty
488 State_ stmp = S_; // temporary copy in case of errors
489 stmp.set( d, ptmp, this ); // throws if BadProperty
490
491 // We now know that (ptmp, stmp) are consistent. We do not
492 // write them back to (P_, S_) before we are also sure that
493 // the properties to be set in the parent class are internally
494 // consistent.
496
497 // if we get here, temporaries contain consistent set of properties
498 P_ = ptmp;
499 S_ = stmp;
500
501 pre_run_hook();
502}
503
504} // namespace
505
506
507#endif // HAVE_GSL
508#endif // HH_COND_BETA_GAP_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 tau_rise_in("tau_rise_in")
const std::string tau_decay_in("tau_decay_in")
const std::string g_K("g_K")
const std::string E_in("E_in")
const std::string tau_decay_ex("tau_decay_ex")
const std::string target("target")
const std::string t_spike("t_spike")
const std::string E_ex("E_ex")
const std::string tau_rise_ex("tau_rise_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
Declarations for base class Node.