NEST main@f146f75
Loading...
Searching...
No Matches
iaf_chxk_2008.h
Go to the documentation of this file.
1/*
2 * iaf_chxk_2008.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 IAF_CHXK_2008_H
24#define IAF_CHXK_2008_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
36// Includes from nestkernel:
37#include "archiving_node.h"
38#include "connection.h"
39#include "event.h"
40#include "nest_types.h"
41#include "recordables_map.h"
42#include "ring_buffer.h"
44
45namespace nest
46{
47
48/* BeginUserDocs: neuron, integrate-and-fire, conductance-based, precise, hard threshold
49
50Short description
51+++++++++++++++++
52
53Conductance-based leaky integrate-and-fire neuron model supporting
54precise spike times used in Casti et al. 2008
55
56Description
57+++++++++++
58
59``iaf_chxk_2008`` is an implementation of a spiking neuron using IAF dynamics with
60conductance-based synapses :footcite:p:`Casti2008`. A spike is emitted when the membrane potential
61is crossed from below. After a spike, an afterhyperpolarizing (AHP) conductance
62is activated which repolarizes the neuron over time. Membrane potential is not
63reset explicitly and the model also has no explicit refractory time.
64
65The AHP conductance and excitatory and inhibitory synaptic input conductances
66follow alpha-function time courses as in the ``iaf_cond_alpha`` model.
67
68.. note::
69 In accordance with the original Fortran implementation of the model used
70 in :footcite:p:`Casti2008`, the activation time point for the AHP following a spike is
71 determined by linear interpolation within the time step during which the
72 threshold was crossed.
73
74 ``iaf_chxk_2008`` neurons therefore emit spikes with precise spike time
75 information, but they ignore precise spike times when handling synaptic
76 input.
77
78.. note::
79 In the original Fortran implementation underlying :footcite:p:`Casti2008`, all previous AHP
80 activation was discarded when a new spike occurred, leading to reduced AHP
81 currents in particular during periods of high spiking activity. Set
82 ``ahp_bug`` to ``true`` to obtain this behavior in the model.
83
84.. note::
85
86 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
87 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
88 the inhibitory one. Only the absolute value of the weight sets the conductance
89 amplitude. Spike connections must use the default ``receptor_type`` of 0.
90
91 See :ref:`synapse_selection` for the conventions used by other models.
92
93Parameters
94++++++++++
95
96The following parameters can be set in the status Dictionary.
97
98=========== ======= ===========================================================
99 V_m mV Membrane potential
100 E_L mV Leak reversal potential
101 C_m pF Capacity of the membrane
102 V_th mV Spike threshold
103 E_ex mV Excitatory reversal potential
104 E_in mV Inhibitory reversal potential
105 g_L nS Leak conductance
106 tau_syn_ex ms Rise time of the excitatory synaptic conductance
107 (alpha function)
108 tau_syn_in ms Rise time of the inhibitory synaptic conductance
109 (alpha function)
110 I_e pA Constant input current
111 tau_ahp ms Afterhyperpolarization (AHP) time constant
112 E_ahp mV AHP potential
113 g_ahp nS AHP conductance
114 ahp_bug boolean Defaults to false. If true, behaves like original
115 model implementation
116=========== ======= ===========================================================
117
118References
119++++++++++
120
121.. footbibliography::
122
123Sends
124+++++
125
126SpikeEvent
127
128Receives
129++++++++
130
131SpikeEvent, CurrentEvent
132
133See also
134++++++++
135
136iaf_cond_alpha
137
138Examples using this model
139+++++++++++++++++++++++++
140
141.. listexamples:: iaf_chxk_2008
142
143EndUserDocs */
144
155extern "C" int iaf_chxk_2008_dynamics( double, const double*, double*, void* );
156
157void register_iaf_chxk_2008( const std::string& name );
158
159class iaf_chxk_2008 : public ArchivingNode
160{
161
162 // Boilerplate function declarations --------------------------------
163
164public:
165 iaf_chxk_2008();
166 iaf_chxk_2008( const iaf_chxk_2008& );
167 ~iaf_chxk_2008() override;
168
174 using Node::handle;
175 using Node::handles_test_event;
176
177 size_t send_test_event( Node&, size_t, synindex, bool ) override;
178
179 bool
180 is_off_grid() const override
181 {
182 return true;
183 }
184
185 size_t handles_test_event( SpikeEvent&, size_t ) override;
186 size_t handles_test_event( CurrentEvent&, size_t ) override;
187 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
188
189 void handle( SpikeEvent& ) override;
190 void handle( CurrentEvent& ) override;
191 void handle( DataLoggingRequest& ) override;
192
193 void get_status( Dictionary& ) const override;
194 void set_status( const Dictionary& ) override;
195
196private:
197 void init_buffers_() override;
198 void pre_run_hook() override;
199 void update( Time const&, const long, const long ) override;
200
201 // END Boilerplate function declarations ----------------------------
202
203 // Friends --------------------------------------------------------
204
205 // make dynamics function quasi-member
206 friend int iaf_chxk_2008_dynamics( double, const double*, double*, void* );
207
208 // The next two classes need to be friends to access the State_ class/member
209 friend class RecordablesMap< iaf_chxk_2008 >;
210 friend class UniversalDataLogger< iaf_chxk_2008 >;
211
212private:
213 // Parameters class -------------------------------------------------
214
216 struct Parameters_
217 {
218 double V_th;
219 double g_L;
220 double C_m;
221 double E_ex;
222 double E_in;
223 double E_L;
224 double tau_synE;
225 double tau_synI;
226 double I_e;
227 double tau_ahp;
228 double g_ahp;
229 double E_ahp;
230 bool ahp_bug;
232
233 Parameters_();
234
235 void get( Dictionary& ) const;
236 void set( const Dictionary&, Node* node );
237 };
238
239 // State variables class --------------------------------------------
240
250public:
251 struct State_
252 {
254 enum StateVecElems
255 {
256 V_M = 0,
257 DG_EXC,
258 G_EXC,
259 DG_INH,
260 G_INH,
261 DG_AHP,
262 G_AHP,
263 STATE_VEC_SIZE
264 };
265
267 double y[ STATE_VEC_SIZE ];
268
270 int r;
271
272 State_( const Parameters_& );
273 State_( const State_& );
274
275 State_& operator=( const State_& );
276
277 void get( Dictionary& ) const;
278
283 void set( const Dictionary&, const Parameters_&, Node* );
284 };
285
286private:
287 // Buffers class --------------------------------------------------------
288
295 struct Buffers_
296 {
297 Buffers_( iaf_chxk_2008& );
298 Buffers_( const Buffers_&, iaf_chxk_2008& );
299
301 UniversalDataLogger< iaf_chxk_2008 > logger_;
302
304 RingBuffer spike_exc_;
305 RingBuffer spike_inh_;
306 RingBuffer currents_;
307
308 /* GSL ODE stuff */
309 gsl_odeiv_step* s_;
310 gsl_odeiv_control* c_;
311 gsl_odeiv_evolve* e_;
312 gsl_odeiv_system sys_;
313
314 // Since IntegrationStep_ is initialized with step_, and the resolution
315 // cannot change after nodes have been created, it is safe to place both
316 // here.
317 double step_;
318 double IntegrationStep_;
319
327 double I_stim_;
328 };
329
330 // Variables class -------------------------------------------------------
331
336 struct Variables_
337 {
342 double PSConInit_E;
343
348 double PSConInit_I;
349
354 double PSConInit_AHP;
355 };
356
357 // Access functions for UniversalDataLogger -------------------------------
358
360 template < State_::StateVecElems elem >
361 double
362 get_y_elem_() const
363 {
364 return S_.y[ elem ];
365 }
366
368 double
369 get_r_() const
370 {
371 return Time::get_resolution().get_ms() * S_.r;
372 }
373
374 double
375 get_I_syn_exc_() const
376 {
377 return S_.y[ State_::G_EXC ] * ( S_.y[ State_::V_M ] - P_.E_ex );
378 }
379 double
380 get_I_syn_inh_() const
381 {
382 return S_.y[ State_::G_INH ] * ( S_.y[ State_::V_M ] - P_.E_in );
383 }
384 double
385 get_I_ahp_() const
386 {
387 return S_.y[ State_::G_AHP ] * ( S_.y[ State_::V_M ] - P_.E_ahp );
388 }
389
390
391 // Data members -----------------------------------------------------------
392
393 // keep the order of these lines, seems to give best performance
394 Parameters_ P_;
395 State_ S_;
396 Variables_ V_;
397 Buffers_ B_;
398
400 static RecordablesMap< iaf_chxk_2008 > recordablesMap_;
401};
402
403
404// Boilerplate inline function definitions ----------------------------------
405
406inline size_t
407iaf_chxk_2008::send_test_event( Node& target, size_t receptor_type, synindex, bool )
408{
410 e.set_sender( *this );
411
412 return target.handles_test_event( e, receptor_type );
413}
414
415inline size_t
416iaf_chxk_2008::handles_test_event( SpikeEvent&, size_t receptor_type )
417{
418 if ( receptor_type != 0 )
419 {
420 throw UnknownReceptorType( receptor_type, get_name() );
421 }
422 return 0;
423}
424
425inline size_t
426iaf_chxk_2008::handles_test_event( CurrentEvent&, size_t receptor_type )
427{
428 if ( receptor_type != 0 )
429 {
430 throw UnknownReceptorType( receptor_type, get_name() );
431 }
432 return 0;
433}
434
435inline size_t
436iaf_chxk_2008::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
437{
438 if ( receptor_type != 0 )
439 {
440 throw UnknownReceptorType( receptor_type, get_name() );
441 }
442 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
443}
444
445inline void
446iaf_chxk_2008::get_status( Dictionary& d ) const
447{
448 P_.get( d );
449 S_.get( d );
451
452 d[ names::recordables ] = recordablesMap_.get_list();
453}
454
455inline void
456iaf_chxk_2008::set_status( const Dictionary& d )
457{
458 Parameters_ ptmp = P_; // temporary copy in case of errors
459 ptmp.set( d, this ); // throws if BadProperty
460 State_ stmp = S_; // temporary copy in case of errors
461 stmp.set( d, ptmp, this ); // throws if BadProperty
462
463 // We now know that (ptmp, stmp) are consistent. We do not
464 // write them back to (P_, S_) before we are also sure that
465 // the properties to be set in the parent class are internally
466 // consistent.
468
469 // if we get here, temporaries contain consistent set of properties
470 P_ = ptmp;
471 S_ = stmp;
472}
473
474} // namespace
475
476
477#endif // HAVE_GSL
478#endif // IAF_CHXK_2008_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 E_L("E_L")
const std::string ahp_bug("ahp_bug")
const std::string I_e("I_e")
const std::string recordables("recordables")
const std::string g_ahp("g_ahp")
const std::string C_m("C_m")
const std::string d("d")
const std::string V_th("V_th")
const std::string y("y")
const std::string E_in("E_in")
const std::string target("target")
const std::string E_ahp("E_ahp")
const std::string tau_ahp("tau_ahp")
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