NEST main@f146f75
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
85.. note::
86
87 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
88 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
89 the inhibitory one. Only the absolute value of the weight sets the conductance
90 amplitude. Spike connections must use the default ``receptor_type`` of 0.
91
92 See :ref:`synapse_selection` for the conventions used by other models.
93
94Parameters
95++++++++++
96
97The following parameters can be set in the status Dictionary.
98
99=========== ====== ===========================================================
100 V_m mV Membrane potential
101 E_L mV Leak reversal potential
102 C_m pF Capacity of the membrane
103 t_ref ms Duration of refractory period
104 V_th mV Spike threshold
105 V_reset mV Reset potential of the membrane
106 E_ex mV Excitatory reversal potential
107 E_in mV Inhibitory reversal potential
108 g_L nS Leak conductance
109 tau_syn_ex ms Exponential decay time constant of excitatory synaptic
110 conductance kernel
111 tau_syn_in ms Exponential decay time constant of inhibitory synaptic
112 conductance kernel
113 q_sfa nS Outgoing spike activated quantal spike-frequency adaptation
114 conductance increase in nS
115 q_rr nS Outgoing spike activated quantal relative refractory
116 conductance increase in nS
117 tau_sfa ms Time constant of spike-frequency adaptation in ms
118 tau_rr ms Time constant of the relative refractory mechanism in ms
119 E_sfa mV Spike-frequency adaptation conductance reversal potential
120 in mV
121 E_rr mV Relative refractory mechanism conductance reversal
122 potential in mV
123 I_e pA Constant input current
124=========== ====== ===========================================================
125
126
127Sends
128+++++
129
130SpikeEvent
131
132Receives
133++++++++
134
135SpikeEvent, CurrentEvent, DataLoggingRequest
136
137References
138++++++++++
139
140.. footbibliography::
141
142See also
143++++++++
144
145aeif_cond_alpha, aeif_cond_exp, iaf_chxk_2008
146
147Examples using this model
148+++++++++++++++++++++++++
149
150.. listexamples:: iaf_cond_exp_sfa_rr
151
152EndUserDocs */
153
154void register_iaf_cond_exp_sfa_rr( const std::string& name );
155
156class iaf_cond_exp_sfa_rr : public ArchivingNode
157{
158
159public:
160 iaf_cond_exp_sfa_rr();
161 iaf_cond_exp_sfa_rr( const iaf_cond_exp_sfa_rr& );
162 ~iaf_cond_exp_sfa_rr() override;
163
169 using Node::handle;
170 using Node::handles_test_event;
171
172 size_t send_test_event( Node&, size_t, synindex, bool ) override;
173
174 void handle( SpikeEvent& ) override;
175 void handle( CurrentEvent& ) override;
176 void handle( DataLoggingRequest& ) override;
177
178 size_t handles_test_event( SpikeEvent&, size_t ) override;
179 size_t handles_test_event( CurrentEvent&, size_t ) override;
180 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
181
182 void get_status( Dictionary& ) const override;
183 void set_status( const Dictionary& ) override;
184
185private:
186 void init_buffers_() override;
187 void pre_run_hook() override;
188 void update( Time const&, const long, const long ) override;
189
190 // END Boilerplate function declarations ----------------------------
191
192 // Friends --------------------------------------------------------
193
194 // make dynamics function quasi-member
195 friend int iaf_cond_exp_sfa_rr_dynamics( double, const double*, double*, void* );
196
197 // The next two classes need to be friends to access the State_ class/member
198 friend class RecordablesMap< iaf_cond_exp_sfa_rr >;
199 friend class UniversalDataLogger< iaf_cond_exp_sfa_rr >;
200
201private:
202 // ----------------------------------------------------------------
203
205 struct Parameters_
206 {
207 double V_th_;
208 double V_reset_;
209 double t_ref_;
210 double g_L;
211 double C_m;
212 double E_ex;
213 double E_in;
214 double E_L;
215 double tau_synE;
216 double tau_synI;
217 double I_e;
218 double tau_sfa;
219 double tau_rr;
220 double E_sfa;
222 double E_rr;
223 double q_sfa;
225 double q_rr;
227
228 Parameters_();
229
230 void get( Dictionary& ) const;
231 void set( const Dictionary&, Node* node );
232 };
233
234public:
235 // ----------------------------------------------------------------
236
241 struct State_
242 {
244 enum StateVecElems
245 {
246 V_M = 0,
247 G_EXC,
248 G_INH,
249 G_SFA,
250 G_RR,
251 STATE_VEC_SIZE
252 };
253
255 double y_[ STATE_VEC_SIZE ];
256 int r_;
257
258 State_( const Parameters_& );
259 State_( const State_& );
260
261 State_& operator=( const State_& );
262
263 void get( Dictionary& ) const;
264 void set( const Dictionary&, const Parameters_&, Node* );
265 };
266
267private:
268 // ----------------------------------------------------------------
269
273 struct Buffers_
274 {
275 Buffers_( iaf_cond_exp_sfa_rr& );
277 Buffers_( const Buffers_&, iaf_cond_exp_sfa_rr& );
278
280 UniversalDataLogger< iaf_cond_exp_sfa_rr > logger_;
281
283 RingBuffer spike_exc_;
284 RingBuffer spike_inh_;
285 RingBuffer currents_;
286
288 gsl_odeiv_step* s_;
289 gsl_odeiv_control* c_;
290 gsl_odeiv_evolve* e_;
291 gsl_odeiv_system sys_;
292
293 // Since IntegrationStep_ is initialized with step_, and the resolution
294 // cannot change after nodes have been created, it is safe to place both
295 // here.
296 double step_;
297 double IntegrationStep_;
298
306 double I_stim_;
307 };
308
309 // ----------------------------------------------------------------
310
314 struct Variables_
315 {
316 int RefractoryCounts_;
317 };
318
319 // Access functions for UniversalDataLogger -------------------------------
320
322 template < State_::StateVecElems elem >
323 double
324 get_y_elem_() const
325 {
326 return S_.y_[ elem ];
327 }
328
329 // ----------------------------------------------------------------
330
331 Parameters_ P_;
332 State_ S_;
333 Variables_ V_;
334 Buffers_ B_;
335
337 static RecordablesMap< iaf_cond_exp_sfa_rr > recordablesMap_;
338};
339
340
341inline size_t
342iaf_cond_exp_sfa_rr::send_test_event( Node& target, size_t receptor_type, synindex, bool )
343{
345 e.set_sender( *this );
346 return target.handles_test_event( e, receptor_type );
347}
348
349inline size_t
350iaf_cond_exp_sfa_rr::handles_test_event( SpikeEvent&, size_t receptor_type )
351{
352 if ( receptor_type != 0 )
353 {
354 throw UnknownReceptorType( receptor_type, get_name() );
355 }
356 return 0;
357}
358
359inline size_t
360iaf_cond_exp_sfa_rr::handles_test_event( CurrentEvent&, size_t receptor_type )
361{
362 if ( receptor_type != 0 )
363 {
364 throw UnknownReceptorType( receptor_type, get_name() );
365 }
366 return 0;
367}
368
369inline size_t
370iaf_cond_exp_sfa_rr::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
371{
372 if ( receptor_type != 0 )
373 {
374 throw UnknownReceptorType( receptor_type, get_name() );
375 }
376 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
377}
378
379
380inline void
381iaf_cond_exp_sfa_rr::get_status( Dictionary& d ) const
382{
383 P_.get( d );
384 S_.get( d );
386
387 d[ names::recordables ] = recordablesMap_.get_list();
388}
389
390inline void
391iaf_cond_exp_sfa_rr::set_status( const Dictionary& d )
392{
393 Parameters_ ptmp = P_; // temporary copy in case of errors
394 ptmp.set( d, this ); // throws if BadProperty
395 State_ stmp = S_; // temporary copy in case of errors
396 stmp.set( d, ptmp, this ); // throws if BadProperty
397
398 // We now know that (ptmp, stmp) are consistent. We do not
399 // write them back to (P_, S_) before we are also sure that
400 // the properties to be set in the parent class are internally
401 // consistent.
403
404 // if we get here, temporaries contain consistent set of properties
405 P_ = ptmp;
406 S_ = stmp;
407}
408
409} // namespace
410
411#endif // HAVE_GSL
412#endif // IAF_COND_EXP_SFA_RR_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_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
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