NEST main@caf0ae8
 
Loading...
Searching...
No Matches
iaf_cond_beta.h
Go to the documentation of this file.
1/*
2 * iaf_cond_beta.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_COND_BETA_H
24#define IAF_COND_BETA_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{
57extern "C" int iaf_cond_beta_dynamics( double, const double*, double*, void* );
58
59/* BeginUserDocs: neuron, integrate-and-fire, conductance-based, hard threshold
60
61Short description
62+++++++++++++++++
63
64Simple conductance based leaky integrate-and-fire neuron model
65
66Description
67+++++++++++
68
69``iaf_cond_beta`` is an implementation of a spiking neuron using IAF dynamics with
70conductance-based synapses. Incoming spike events induce a postsynaptic change
71of conductance modelled by a beta function. The beta function
72is normalized such that an event of weight 1.0 results in a peak conductance of
731 nS at :math:`t = \tau_{rise\_[ex|in]}`.
74
75.. note::
76 Per 2009-04-17, this class has been revised to our newest
77 insights into class design. Please use THIS CLASS as a reference
78 when designing your own models with nonlinear dynamics.
79 One weakness of this class is that it distinguishes between
80 inputs to the two synapses by the sign of the synaptic weight.
81 It would be better to use ``receptor_types``, cf ``iaf_cond_alpha_mc``.
82
83See also :footcite:p:`Meffin2004`, :footcite:p:`Bernander1991`, :footcite:p:`Kuhn2004`, :footcite:p:`Rotter1999`,
84:footcite:p:`Roth2010`.
85
86Parameters
87++++++++++
88
89The following parameters can be set in the status Dictionary.
90
91============= ====== =========================================================
92 V_m mV Membrane potential
93 E_L mV Leak reversal potential
94 C_m pF Capacity of the membrane
95 t_ref ms Duration of refractory period
96 V_th mV Spike threshold
97 V_reset mV Reset potential of the membrane
98 E_ex mV Excitatory reversal potential
99 E_in mV Inhibitory reversal potential
100 g_L nS Leak conductance
101 tau_rise_ex ms Rise time of the excitatory synaptic beta function
102 tau_decay_ex ms Decay time of the excitatory synaptic beta function
103 tau_rise_in ms Rise time of the inhibitory synaptic beta function
104 tau_decay_in ms Decay time of the inhibitory synaptic beta function
105 I_e pA Constant input current
106============= ====== =========================================================
107
108
109Sends
110+++++
111
112SpikeEvent
113
114Receives
115++++++++
116
117SpikeEvent, CurrentEvent, DataLoggingRequest
118
119References
120++++++++++
121
122.. footbibliography::
123
124See also
125++++++++
126
127iaf_cond_exp, iaf_cond_alpha, iaf_cond_alpha_mc
128
129Examples using this model
130+++++++++++++++++++++++++
131
132.. listexamples:: iaf_cond_beta
133
134EndUserDocs */
135
136void register_iaf_cond_beta( const std::string& name );
137
138class iaf_cond_beta : public ArchivingNode
139{
140
141 // Boilerplate function declarations --------------------------------
142
143public:
144 iaf_cond_beta();
145 iaf_cond_beta( const iaf_cond_beta& );
146 ~iaf_cond_beta() override;
147
148 /*
149 * Import all overloaded virtual functions that we
150 * override in this class. For background information,
151 * see http://www.gotw.ca/gotw/005.htm.
152 */
153
154 using Node::handle;
155 using Node::handles_test_event;
156
157 size_t send_test_event( Node& tagret, size_t receptor_type, synindex, bool ) override;
158
159 size_t handles_test_event( SpikeEvent&, size_t ) override;
160 size_t handles_test_event( CurrentEvent&, size_t ) override;
161 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
162
163 void handle( SpikeEvent& ) override;
164 void handle( CurrentEvent& ) override;
165 void handle( DataLoggingRequest& ) override;
166
167 void get_status( Dictionary& ) const override;
168 void set_status( const Dictionary& ) override;
169
170private:
171 void init_buffers_() override;
172 double get_normalisation_factor( double, double );
173 void pre_run_hook() override;
174 void update( Time const&, const long, const long ) override;
175
176 // END Boilerplate function declarations ----------------------------
177
178 // Friends --------------------------------------------------------
179
180 // make dynamics function quasi-member
181 friend int iaf_cond_beta_dynamics( double, const double*, double*, void* );
182
183 // The next two classes need to be friends to access the State_ class/member
184 friend class RecordablesMap< iaf_cond_beta >;
185 friend class UniversalDataLogger< iaf_cond_beta >;
186
187private:
188 // Parameters class -------------------------------------------------
189
191 struct Parameters_
192 {
193 double V_th;
194 double V_reset;
195 double t_ref;
196 double g_L;
197 double C_m;
198 double E_ex;
199 double E_in;
200 double E_L;
201 double tau_rise_ex;
202 double tau_decay_ex;
203 double tau_rise_in;
204 double tau_decay_in;
205 double I_e;
206
207 Parameters_();
208
209 void get( Dictionary& ) const;
210 void set( const Dictionary&, Node* node );
211 };
212
213 // State variables class --------------------------------------------
214
224public:
225 struct State_
226 {
228 enum StateVecElems
229 {
230 V_M = 0,
231 DG_EXC,
232 G_EXC,
233 DG_INH,
234 G_INH,
235 STATE_VEC_SIZE
236 };
237
239 double y[ STATE_VEC_SIZE ];
240
242 int r;
243
244 State_( const Parameters_& );
245 State_( const State_& );
246
247 State_& operator=( const State_& );
248
249 void get( Dictionary& ) const;
250
255 void set( const Dictionary&, const Parameters_&, Node* );
256 };
257
258private:
259 // Buffers class --------------------------------------------------------
260
267 struct Buffers_
268 {
269 Buffers_( iaf_cond_beta& );
270 Buffers_( const Buffers_&, iaf_cond_beta& );
271
273 UniversalDataLogger< iaf_cond_beta > logger_;
274
276 RingBuffer spike_exc_;
277 RingBuffer spike_inh_;
278 RingBuffer currents_;
279
280 /* GSL ODE stuff */
281 gsl_odeiv_step* s_;
282 gsl_odeiv_control* c_;
283 gsl_odeiv_evolve* e_;
284 gsl_odeiv_system sys_;
285
286 // Since IntegrationStep_ is initialized with step_, and the resolution
287 // cannot change after nodes have been created, it is safe to place both
288 // here.
289 double step_;
290 double IntegrationStep_;
291
299 double I_stim_;
300 };
301
302 // Variables class -------------------------------------------------------
303
308 struct Variables_
309 {
314 double PSConInit_E;
315
320 double PSConInit_I;
321
323 int RefractoryCounts;
324 };
325
326 // Access functions for UniversalDataLogger -------------------------------
327
329 template < State_::StateVecElems elem >
330 double
331 get_y_elem_() const
332 {
333 return S_.y[ elem ];
334 }
335
337 double
338 get_r_() const
339 {
340 return Time::get_resolution().get_ms() * S_.r;
341 }
342
343 // Data members -----------------------------------------------------------
344
345 // keep the order of these lines, seems to give best performance
346 Parameters_ P_;
347 State_ S_;
348 Variables_ V_;
349 Buffers_ B_;
350
352 static RecordablesMap< iaf_cond_beta > recordablesMap_;
353};
354
355
356// Boilerplate inline function definitions ----------------------------------
357
358inline size_t
359iaf_cond_beta::send_test_event( Node& target, size_t receptor_type, synindex, bool )
360{
361 SpikeEvent e;
362 e.set_sender( *this );
363 return target.handles_test_event( e, receptor_type );
364}
365
366inline size_t
367iaf_cond_beta::handles_test_event( SpikeEvent&, size_t receptor_type )
368{
369 if ( receptor_type != 0 )
370 {
371 throw UnknownReceptorType( receptor_type, get_name() );
372 }
373 return 0;
374}
375
376inline size_t
377iaf_cond_beta::handles_test_event( CurrentEvent&, size_t receptor_type )
378{
379 if ( receptor_type != 0 )
380 {
381 throw UnknownReceptorType( receptor_type, get_name() );
382 }
383 return 0;
384}
385
386inline size_t
387iaf_cond_beta::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
388{
389 if ( receptor_type != 0 )
390 {
391 throw UnknownReceptorType( receptor_type, get_name() );
392 }
393 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
394}
395
396inline void
397iaf_cond_beta::get_status( Dictionary& d ) const
398{
399 P_.get( d );
400 S_.get( d );
402
403 d[ names::recordables ] = recordablesMap_.get_list();
404}
405
406inline void
407iaf_cond_beta::set_status( const Dictionary& d )
408{
409 Parameters_ ptmp = P_; // temporary copy in case of errors
410 ptmp.set( d, this ); // throws if BadProperty
411 State_ stmp = S_; // temporary copy in case of errors
412 stmp.set( d, ptmp, this ); // throws if BadProperty
413
414 // We now know that (ptmp, stmp) are consistent. We do not
415 // write them back to (P_, S_) before we are also sure that
416 // the properties to be set in the parent class are internally
417 // consistent.
419
420 // if we get here, temporaries contain consistent set of properties
421 P_ = ptmp;
422 S_ = stmp;
423}
424
425} // namespace
426
427#endif // HAVE_GSL
428
429#endif // IAF_COND_BETA_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 t_ref("t_ref")
const std::string E_L("E_L")
const std::string I_e("I_e")
const std::string V_reset("V_reset")
const std::string recordables("recordables")
const std::string C_m("C_m")
const std::string d("d")
const std::string V_th("V_th")
const std::string tau_rise_in("tau_rise_in")
const std::string tau_decay_in("tau_decay_in")
const std::string y("y")
const std::string E_in("E_in")
const std::string tau_decay_ex("tau_decay_ex")
const std::string target("target")
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