NEST main@caf0ae8
 
Loading...
Searching...
No Matches
iaf_cond_exp_sfa_rr.h
Go to the documentation of this file.
1/*
2 * iaf_cond_exp_sfa_rr.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_EXP_SFA_RR_H
24#define IAF_COND_EXP_SFA_RR_H
25
26// Generated includes:
27#include "config.h"
28
29#ifdef HAVE_GSL
30
31// External 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_exp_sfa_rr_dynamics( double, const double*, double*, void* );
58
59/* BeginUserDocs: neuron, integrate-and-fire, conductance-based, hard threshold
60
61Short description
62+++++++++++++++++
63
64Conductance based leaky integrate-and-fire model with spike-frequency
65adaptation and relative refractory mechanisms
66
67Description
68+++++++++++
69
70``iaf_cond_exp_sfa_rr`` is an implementation of a spiking neuron using
71integrate-and-fire dynamics with conductance-based synapses, with additional
72spike-frequency adaptation and relative refractory mechanisms as described in
73:footcite:p:`Dayan2001`, page 166.
74
75Incoming spike events induce a postsynaptic change of conductance modelled by
76an exponential function. The exponential function is normalized such that an
77event of weight 1.0 results in a peak conductance of 1 nS.
78
79Outgoing spike events induce a change of the adaptation and relative refractory
80conductances by ``q_sfa`` and ``q_rr``, respectively. Otherwise these conductances
81decay exponentially with time constants ``tau_sfa`` and ``tau_rr``, respectively.
82
83See also :footcite:p:`Meffin2004`.
84
85Parameters
86++++++++++
87
88The following parameters can be set in the status Dictionary.
89
90=========== ====== ===========================================================
91 V_m mV Membrane potential
92 E_L mV Leak reversal potential
93 C_m pF Capacity of the membrane
94 t_ref ms Duration of refractory period
95 V_th mV Spike threshold
96 V_reset mV Reset potential of the membrane
97 E_ex mV Excitatory reversal potential
98 E_in mV Inhibitory reversal potential
99 g_L nS Leak conductance
100 tau_syn_ex ms Exponential decay time constant of excitatory synaptic
101 conductance kernel
102 tau_syn_in ms Exponential decay time constant of inhibitory synaptic
103 conductance kernel
104 q_sfa nS Outgoing spike activated quantal spike-frequency adaptation
105 conductance increase in nS
106 q_rr nS Outgoing spike activated quantal relative refractory
107 conductance increase in nS
108 tau_sfa ms Time constant of spike-frequency adaptation in ms
109 tau_rr ms Time constant of the relative refractory mechanism in ms
110 E_sfa mV Spike-frequency adaptation conductance reversal potential
111 in mV
112 E_rr mV Relative refractory mechanism conductance reversal
113 potential in mV
114 I_e pA Constant input current
115=========== ====== ===========================================================
116
117
118Sends
119+++++
120
121SpikeEvent
122
123Receives
124++++++++
125
126SpikeEvent, CurrentEvent, DataLoggingRequest
127
128References
129++++++++++
130
131.. footbibliography::
132
133See also
134++++++++
135
136aeif_cond_alpha, aeif_cond_exp, iaf_chxk_2008
137
138Examples using this model
139+++++++++++++++++++++++++
140
141.. listexamples:: iaf_cond_exp_sfa_rr
142
143EndUserDocs */
144
145void register_iaf_cond_exp_sfa_rr( const std::string& name );
146
147class iaf_cond_exp_sfa_rr : public ArchivingNode
148{
149
150public:
151 iaf_cond_exp_sfa_rr();
152 iaf_cond_exp_sfa_rr( const iaf_cond_exp_sfa_rr& );
153 ~iaf_cond_exp_sfa_rr() override;
154
160 using Node::handle;
161 using Node::handles_test_event;
162
163 size_t send_test_event( Node&, size_t, synindex, bool ) override;
164
165 void handle( SpikeEvent& ) override;
166 void handle( CurrentEvent& ) override;
167 void handle( DataLoggingRequest& ) override;
168
169 size_t handles_test_event( SpikeEvent&, size_t ) override;
170 size_t handles_test_event( CurrentEvent&, size_t ) override;
171 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
172
173 void get_status( Dictionary& ) const override;
174 void set_status( const Dictionary& ) override;
175
176private:
177 void init_buffers_() override;
178 void pre_run_hook() override;
179 void update( Time const&, const long, const long ) override;
180
181 // END Boilerplate function declarations ----------------------------
182
183 // Friends --------------------------------------------------------
184
185 // make dynamics function quasi-member
186 friend int iaf_cond_exp_sfa_rr_dynamics( double, const double*, double*, void* );
187
188 // The next two classes need to be friends to access the State_ class/member
189 friend class RecordablesMap< iaf_cond_exp_sfa_rr >;
190 friend class UniversalDataLogger< iaf_cond_exp_sfa_rr >;
191
192private:
193 // ----------------------------------------------------------------
194
196 struct Parameters_
197 {
198 double V_th_;
199 double V_reset_;
200 double t_ref_;
201 double g_L;
202 double C_m;
203 double E_ex;
204 double E_in;
205 double E_L;
206 double tau_synE;
207 double tau_synI;
208 double I_e;
209 double tau_sfa;
210 double tau_rr;
211 double E_sfa;
213 double E_rr;
214 double q_sfa;
216 double q_rr;
218
219 Parameters_();
220
221 void get( Dictionary& ) const;
222 void set( const Dictionary&, Node* node );
223 };
224
225public:
226 // ----------------------------------------------------------------
227
232 struct State_
233 {
235 enum StateVecElems
236 {
237 V_M = 0,
238 G_EXC,
239 G_INH,
240 G_SFA,
241 G_RR,
242 STATE_VEC_SIZE
243 };
244
246 double y_[ STATE_VEC_SIZE ];
247 int r_;
248
249 State_( const Parameters_& );
250 State_( const State_& );
251
252 State_& operator=( const State_& );
253
254 void get( Dictionary& ) const;
255 void set( const Dictionary&, const Parameters_&, Node* );
256 };
257
258private:
259 // ----------------------------------------------------------------
260
264 struct Buffers_
265 {
266 Buffers_( iaf_cond_exp_sfa_rr& );
268 Buffers_( const Buffers_&, iaf_cond_exp_sfa_rr& );
269
271 UniversalDataLogger< iaf_cond_exp_sfa_rr > logger_;
272
274 RingBuffer spike_exc_;
275 RingBuffer spike_inh_;
276 RingBuffer currents_;
277
279 gsl_odeiv_step* s_;
280 gsl_odeiv_control* c_;
281 gsl_odeiv_evolve* e_;
282 gsl_odeiv_system sys_;
283
284 // Since IntegrationStep_ is initialized with step_, and the resolution
285 // cannot change after nodes have been created, it is safe to place both
286 // here.
287 double step_;
288 double IntegrationStep_;
289
297 double I_stim_;
298 };
299
300 // ----------------------------------------------------------------
301
305 struct Variables_
306 {
307 int RefractoryCounts_;
308 };
309
310 // Access functions for UniversalDataLogger -------------------------------
311
313 template < State_::StateVecElems elem >
314 double
315 get_y_elem_() const
316 {
317 return S_.y_[ elem ];
318 }
319
320 // ----------------------------------------------------------------
321
322 Parameters_ P_;
323 State_ S_;
324 Variables_ V_;
325 Buffers_ B_;
326
328 static RecordablesMap< iaf_cond_exp_sfa_rr > recordablesMap_;
329};
330
331
332inline size_t
333iaf_cond_exp_sfa_rr::send_test_event( Node& target, size_t receptor_type, synindex, bool )
334{
335 SpikeEvent e;
336 e.set_sender( *this );
337 return target.handles_test_event( e, receptor_type );
338}
339
340inline size_t
341iaf_cond_exp_sfa_rr::handles_test_event( SpikeEvent&, size_t receptor_type )
342{
343 if ( receptor_type != 0 )
344 {
345 throw UnknownReceptorType( receptor_type, get_name() );
346 }
347 return 0;
348}
349
350inline size_t
351iaf_cond_exp_sfa_rr::handles_test_event( CurrentEvent&, size_t receptor_type )
352{
353 if ( receptor_type != 0 )
354 {
355 throw UnknownReceptorType( receptor_type, get_name() );
356 }
357 return 0;
358}
359
360inline size_t
361iaf_cond_exp_sfa_rr::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
362{
363 if ( receptor_type != 0 )
364 {
365 throw UnknownReceptorType( receptor_type, get_name() );
366 }
367 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
368}
369
370
371inline void
372iaf_cond_exp_sfa_rr::get_status( Dictionary& d ) const
373{
374 P_.get( d );
375 S_.get( d );
377
378 d[ names::recordables ] = recordablesMap_.get_list();
379}
380
381inline void
382iaf_cond_exp_sfa_rr::set_status( const Dictionary& d )
383{
384 Parameters_ ptmp = P_; // temporary copy in case of errors
385 ptmp.set( d, this ); // throws if BadProperty
386 State_ stmp = S_; // temporary copy in case of errors
387 stmp.set( d, ptmp, this ); // throws if BadProperty
388
389 // We now know that (ptmp, stmp) are consistent. We do not
390 // write them back to (P_, S_) before we are also sure that
391 // the properties to be set in the parent class are internally
392 // consistent.
394
395 // if we get here, temporaries contain consistent set of properties
396 P_ = ptmp;
397 S_ = stmp;
398}
399
400} // namespace
401
402#endif // HAVE_GSL
403#endif // IAF_COND_EXP_SFA_RR_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 E_rr("E_rr")
const std::string E_sfa("E_sfa")
const std::string tau_rr("tau_rr")
const std::string E_L("E_L")
const std::string I_e("I_e")
const std::string recordables("recordables")
const std::string C_m("C_m")
const std::string d("d")
const std::string q_rr("q_rr")
const std::string E_in("E_in")
const std::string q_sfa("q_sfa")
const std::string target("target")
const std::string E_ex("E_ex")
const std::string tau_sfa("tau_sfa")
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