NEST main@f146f75
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-function 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
121.. note::
122
123 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
124 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
125 the inhibitory one. Only the absolute value of the weight sets the conductance
126 amplitude. Spike connections must use the default ``receptor_type`` of 0.
127
128 See :ref:`synapse_selection` for the conventions used by other models.
129
130Parameters
131++++++++++
132
133The following parameters can be set in the status Dictionary.
134
135============ ====== =======================================================
136V_m mV Membrane potential
137V_T mV Voltage offset that controls dynamics. For default
138 parameters, V_T = -63mV results in a threshold around
139 -50mV
140E_L mV Leak reversal potential
141C_m pF Capacity of the membrane
142g_L nS Leak conductance
143tau_rise_ex ms Rise time of the excitatory synaptic conductance
144 (beta function)
145tau_decay_ex ms Decay time of the excitatory synaptic conductance
146 (beta function)
147tau_rise_in ms Rise time of the inhibitory synaptic conductance
148 (beta function)
149tau_decay_in ms Decay time of the inhibitory synaptic conductance
150 (beta function)
151t_ref ms Duration of refractory period (see Note)
152E_ex mV Excitatory synaptic reversal potential
153E_in mV Inhibitory synaptic reversal potential
154E_Na mV Sodium reversal potential
155g_Na nS Sodium peak conductance
156E_K mV Potassium reversal potential
157g_K nS Potassium peak conductance
158I_e pA External input current
159============ ====== =======================================================
160
161References
162++++++++++
163
164.. footbibliography::
165
166Sends
167+++++
168
169SpikeEvent
170
171Receives
172++++++++
173
174SpikeEvent, CurrentEvent, DataLoggingRequest
175
176See also
177++++++++
178
179hh_psc_alpha_gap, hh_cond_exp_traub, gap_junction, iaf_cond_beta
180
181
182Examples using this model
183+++++++++++++++++++++++++
184
185.. listexamples:: hh_cond_beta_gap_traub
186
187EndUserDocs */
188
189void register_hh_cond_beta_gap_traub( const std::string& name );
190
191class hh_cond_beta_gap_traub : public ArchivingNode
192{
193
194public:
195 typedef Node base;
196
197 hh_cond_beta_gap_traub();
198 hh_cond_beta_gap_traub( const hh_cond_beta_gap_traub& );
199 ~hh_cond_beta_gap_traub() override;
200
206 using Node::handle;
207 using Node::handles_test_event;
208 using Node::sends_secondary_event;
209
210 size_t send_test_event( Node& target, size_t receptor_type, synindex, bool ) override;
211
212 void handle( SpikeEvent& ) override;
213 void handle( CurrentEvent& ) override;
214 void handle( DataLoggingRequest& ) override;
215 void handle( GapJunctionEvent& ) override;
216
217 size_t handles_test_event( SpikeEvent&, size_t ) override;
218 size_t handles_test_event( CurrentEvent&, size_t ) override;
219 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
220 size_t handles_test_event( GapJunctionEvent&, size_t ) override;
221
222 void
223 sends_secondary_event( GapJunctionEvent& ) override
224 {
225 }
226
227 void get_status( Dictionary& ) const override;
228 void set_status( const Dictionary& ) override;
229
230private:
231 void init_buffers_() override;
232 double get_normalisation_factor( double, double );
233 void pre_run_hook() override;
234
238 bool update_( Time const&, const long, const long, const bool );
239
240 void update( Time const&, const long, const long ) override;
241 bool wfr_update( Time const&, const long, const long ) override;
242
243 // END Boilerplate function declarations ----------------------------
244
245 // Friends --------------------------------------------------------
246
247 // make dynamics function quasi-member
248 friend int hh_cond_beta_gap_traub_dynamics( double, const double*, double*, void* );
249
250 // The next two classes need to be friends to access the State_ class/member
251 friend class RecordablesMap< hh_cond_beta_gap_traub >;
252 friend class UniversalDataLogger< hh_cond_beta_gap_traub >;
253
254private:
255 // ----------------------------------------------------------------
256
260 struct Parameters_
261 {
262 double g_Na;
263 double g_K;
264 double g_L;
265 double C_m;
266 double E_Na;
267 double E_K;
268 double E_L;
269 double V_T;
270 double E_ex;
271 double E_in;
272 double tau_rise_ex;
273 double tau_decay_ex;
274 double tau_rise_in;
275 double tau_decay_in;
276 double t_ref_;
277 double I_e;
278
279 Parameters_();
280
281 void get( Dictionary& ) const;
282 void set( const Dictionary&, Node* );
283 };
284
285public:
286 // ----------------------------------------------------------------
287
291 struct State_
292 {
293
295 enum StateVecElems
296 {
297 V_M = 0,
298 HH_M, // 1
299 HH_H, // 2
300 HH_N, // 3
301 DG_EXC, // 4
302 G_EXC, // 5
303 DG_INH, // 6
304 G_INH, // 7
305 STATE_VEC_SIZE
306 };
307
309 double y_[ STATE_VEC_SIZE ];
310 int r_;
311
312 State_( const Parameters_& p );
313 State_( const State_& s );
314
315 State_& operator=( const State_& );
316
317 void get( Dictionary& ) const;
318 void set( const Dictionary&, const Parameters_&, Node* );
319 };
320
321 // Variables class -------------------------------------------------------
322
327 struct Variables_
328 {
333 double PSConInit_E;
334
339 double PSConInit_I;
340
342 int refractory_counts_;
343 double U_old_; // for spike-detection
344 };
345
346 // ----------------------------------------------------------------
347
351 struct Buffers_
352 {
353 Buffers_( hh_cond_beta_gap_traub& );
355 Buffers_( const Buffers_&, hh_cond_beta_gap_traub& );
356
358 UniversalDataLogger< hh_cond_beta_gap_traub > logger_;
359
361 RingBuffer spike_exc_;
362 RingBuffer spike_inh_;
363 RingBuffer currents_;
364
366 gsl_odeiv_step* s_;
367 gsl_odeiv_control* c_;
368 gsl_odeiv_evolve* e_;
369 gsl_odeiv_system sys_;
370
371 // Since IntegrationStep_ is initialized with step_, and the resolution
372 // cannot change after nodes have been created, it is safe to place both
373 // here.
374 double step_;
375 double IntegrationStep_;
376
377 // remembers current lag for piecewise interpolation
378 long lag_;
379
380 // remembers y_values from last wfr_update
381 std::vector< double > last_y_values;
382
383 // summarized gap weight
384 double sumj_g_ij_;
385
386 // summarized coefficients of the interpolation polynomial
387 std::vector< double > interpolation_coefficients;
388
396 double I_stim_;
397 };
398
399 // Access functions for UniversalDataLogger -------------------------------
400
402 template < State_::StateVecElems elem >
403 double
404 get_y_elem_() const
405 {
406 return S_.y_[ elem ];
407 }
408
409 Parameters_ P_;
410 State_ S_;
411 Variables_ V_;
412 Buffers_ B_;
413
415 static RecordablesMap< hh_cond_beta_gap_traub > recordablesMap_;
416};
417
418inline void
419hh_cond_beta_gap_traub::update( Time const& origin, const long from, const long to )
420{
421 update_( origin, from, to, false );
422}
423
424inline bool
425hh_cond_beta_gap_traub::wfr_update( Time const& origin, const long from, const long to )
426{
427 State_ old_state = S_; // save state before wfr_update
428 const bool wfr_tol_exceeded = update_( origin, from, to, true );
429 S_ = old_state; // restore old state
430
431 return not wfr_tol_exceeded;
432}
433
434inline size_t
435hh_cond_beta_gap_traub::send_test_event( Node& target, size_t receptor_type, synindex, bool )
436{
438 e.set_sender( *this );
439
440 return target.handles_test_event( e, receptor_type );
441}
442
443
444inline size_t
445hh_cond_beta_gap_traub::handles_test_event( SpikeEvent&, size_t receptor_type )
446{
447 if ( receptor_type != 0 )
448 {
449 throw UnknownReceptorType( receptor_type, get_name() );
450 }
451 return 0;
452}
453
454inline size_t
455hh_cond_beta_gap_traub::handles_test_event( CurrentEvent&, size_t receptor_type )
456{
457 if ( receptor_type != 0 )
458 {
459 throw UnknownReceptorType( receptor_type, get_name() );
460 }
461 return 0;
462}
463
464inline size_t
465hh_cond_beta_gap_traub::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
466{
467 if ( receptor_type != 0 )
468 {
469 throw UnknownReceptorType( receptor_type, get_name() );
470 }
471 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
472}
473
474inline size_t
475hh_cond_beta_gap_traub::handles_test_event( GapJunctionEvent&, size_t receptor_type )
476{
477 if ( receptor_type != 0 )
478 {
479 throw UnknownReceptorType( receptor_type, get_name() );
480 }
481 return 0;
482}
483
484inline void
485hh_cond_beta_gap_traub::get_status( Dictionary& d ) const
486{
487 P_.get( d );
488 S_.get( d );
490
491 d[ names::recordables ] = recordablesMap_.get_list();
492
493 d[ names::t_spike ] = get_spiketime_ms();
494}
495
496inline void
497hh_cond_beta_gap_traub::set_status( const Dictionary& d )
498{
499 Parameters_ ptmp = P_; // temporary copy in case of errors
500 ptmp.set( d, this ); // throws if BadProperty
501 State_ stmp = S_; // temporary copy in case of errors
502 stmp.set( d, ptmp, this ); // throws if BadProperty
503
504 // We now know that (ptmp, stmp) are consistent. We do not
505 // write them back to (P_, S_) before we are also sure that
506 // the properties to be set in the parent class are internally
507 // consistent.
509
510 // if we get here, temporaries contain consistent set of properties
511 P_ = ptmp;
512 S_ = stmp;
513
514 pre_run_hook();
515}
516
517} // namespace
518
519
520#endif // HAVE_GSL
521#endif // HH_COND_BETA_GAP_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
Event for gap-junction information.
Definition secondary_event.h:299
Base class for all NEST network objects.
Definition node.h:99
Event for spike information.
Definition event.h:420
Definition nest_time.h:135
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 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
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
Declarations for base class Node.