NEST  2.6.0,not_revisioned_source_dir@0
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 #include "config.h"
27 
28 #ifdef HAVE_GSL
29 
30 #include "nest.h"
31 #include "event.h"
32 #include "archiving_node.h"
33 #include "ring_buffer.h"
34 #include "connection.h"
35 #include "universal_data_logger.h"
36 #include "recordables_map.h"
37 
38 #include <gsl/gsl_errno.h>
39 #include <gsl/gsl_matrix.h>
40 #include <gsl/gsl_odeiv.h>
41 
42 /* BeginDocumentation
43 Name: iaf_cond_exp_sfa_rr - Simple conductance based leaky integrate-and-fire neuron model.
44 
45 Description:
46 iaf_cond_exp_sfa_rr is an iaf_cond_exp_sfa_rr i.e. an implementation of a
47 spiking neuron using IAF dynamics with conductance-based synapses,
48 with additional spike-frequency adaptation and relative refractory
49 mechanisms as described in Dayan+Abbott, 2001, page 166.
50 
51 As for the iaf_cond_exp_sfa_rr, Incoming spike events induce a post-synaptic
52 change of conductance modelled by an exponential function. The
53 exponential function is normalised such that an event of weight 1.0
54 results in a peak current of 1 nS.
55 
56 Outgoing spike events induce a change of the adaptation and relative
57 refractory conductances by q_sfa and q_rr, respectively. Otherwise
58 these conductances decay exponentially with time constants tau_sfa
59 and tau_rr, respectively.
60 
61 Parameters:
62 The following parameters can be set in the status dictionary.
63 
64 V_m double - Membrane potential in mV
65 E_L double - Leak reversal potential in mV.
66 C_m double - Capacity of the membrane in pF
67 t_ref double - Duration of refractory period in ms.
68 V_th double - Spike threshold in mV.
69 V_reset double - Reset potential of the membrane in mV.
70 E_ex double - Excitatory reversal potential in mV.
71 E_in double - Inhibitory reversal potential in mV.
72 g_L double - Leak conductance in nS;
73 tau_syn_ex double - Time constant of the excitatory synaptic exponential function in ms.
74 tau_syn_in double - Time constant of the inhibitory synaptic exponential function in ms.
75 q_sfa double - Outgoing spike activated quantal spike-frequency adaptation conductance increase in nS.
76 q_rr double - Outgoing spike activated quantal relative refractory conductance increase in nS.
77 tau_sfa double - Time constant of spike-frequency adaptation in ms.
78 tau_rr double - Time constant of the relative refractory mechanism in ms.
79 E_sfa double - spike-frequency adaptation conductance reversal potential in mV.
80 E_rr double - relative refractory mechanism conductance reversal potential in mV.
81 I_e double - an external stimulus current in pA.
82 
83 Sends: SpikeEvent
84 
85 Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
86 
87 
88 References:
89 
90 Meffin, H., Burkitt, A. N., & Grayden, D. B. (2004). An analytical
91 model for the large, fluctuating synaptic conductance state typical of
92 neocortical neurons in vivo. J. Comput. Neurosci., 16, 159-175.
93 
94 Dayan, P. and Abbott, L. F. (2001). Theoretical Neuroscience, MIT
95 Press (p166)
96 
97 Author: Sven Schrader, Eilif Muller
98 
99 SeeAlso: iaf_cond_exp_sfa_rr, aeif_cond_alpha, iaf_psc_delta, iaf_psc_exp, iaf_cond_alpha
100 */
101 
102 namespace nest {
103 
104  using std::vector;
105 
116  extern "C"
117  int iaf_cond_exp_sfa_rr_dynamics(double, const double*, double*, void*);
118 
120  {
121 
122  public:
123 
127 
132  using Node::handle;
134 
136 
137  void handle(SpikeEvent &);
138  void handle(CurrentEvent &);
139  void handle(DataLoggingRequest &);
140 
144 
145  void get_status(DictionaryDatum &) const;
146  void set_status(const DictionaryDatum &);
147 
148  private:
149  void init_state_(const Node& proto);
150  void init_buffers_();
151  void calibrate();
152  void update(Time const &, const long_t, const long_t);
153 
154  // END Boilerplate function declarations ----------------------------
155 
156  // Friends --------------------------------------------------------
157 
158  // make dynamics function quasi-member
159  friend int iaf_cond_exp_sfa_rr_dynamics(double, const double*, double*, void*);
160 
161  // The next two classes need to be friends to access the State_ class/member
163  friend class UniversalDataLogger<iaf_cond_exp_sfa_rr>;
164 
165  private:
166 
167  // ----------------------------------------------------------------
168 
170  struct Parameters_ {
188 
189  Parameters_();
190 
191  void get(DictionaryDatum&) const;
192  void set(const DictionaryDatum&);
193  };
194 
195  public:
196  // ----------------------------------------------------------------
197 
203  struct State_ {
204 
207  {
208  V_M = 0,
214  };
215 
218 
219  State_(const Parameters_&);
220  State_(const State_&);
221  State_& operator=(const State_&);
222 
223  void get(DictionaryDatum&) const;
224  void set(const DictionaryDatum&, const Parameters_&);
225  };
226 
227  private:
228  // ----------------------------------------------------------------
229 
233  struct Buffers_ {
236 
239 
244 
246  gsl_odeiv_step* s_;
247  gsl_odeiv_control* c_;
248  gsl_odeiv_evolve* e_;
249  gsl_odeiv_system sys_;
250 
251  // IntergrationStep_ should be reset with the neuron on ResetNetwork,
252  // but remain unchanged during calibration. Since it is initialized with
253  // step_, and the resolution cannot change after nodes have been created,
254  // it is safe to place both here.
257 
265  double I_stim_;
266  };
267 
268  // ----------------------------------------------------------------
269 
273  struct Variables_ {
275  };
276 
277  // Access functions for UniversalDataLogger -------------------------------
278 
280  template <State_::StateVecElems elem>
281  double_t get_y_elem_() const { return S_.y_[elem]; }
282 
283  // ----------------------------------------------------------------
284 
289 
292  };
293 
294 
295  inline
297 {
298  SpikeEvent e;
299  e.set_sender(*this);
300  return target.handles_test_event(e, receptor_type);
301 }
302 
303 inline
305 {
306  if (receptor_type != 0)
307  throw UnknownReceptorType(receptor_type, get_name());
308  return 0;
309 }
310 
311 inline
313 {
314  if (receptor_type != 0)
315  throw UnknownReceptorType(receptor_type, get_name());
316  return 0;
317 }
318 
319 inline
322 {
323  if (receptor_type != 0)
324  throw UnknownReceptorType(receptor_type, get_name());
325  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
326 }
327 
328 
329  inline
331  {
332  P_.get(d);
333  S_.get(d);
335 
336  (*d)[names::recordables] = recordablesMap_.get_list();
337  }
338 
339  inline
341  {
342  Parameters_ ptmp = P_; // temporary copy in case of errors
343  ptmp.set(d); // throws if BadProperty
344  State_ stmp = S_; // temporary copy in case of errors
345  stmp.set(d, ptmp); // throws if BadProperty
346 
347  // We now know that (ptmp, stmp) are consistent. We do not
348  // write them back to (P_, S_) before we are also sure that
349  // the properties to be set in the parent class are internally
350  // consistent.
352 
353  // if we get here, temporaries contain consistent set of properties
354  P_ = ptmp;
355  S_ = stmp;
356  }
357 
358 } // namespace
359 
360 #endif //HAVE_GSL
361 #endif //IAF_COND_EXP_SFA_RR_H
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_cond_exp_sfa_rr.cpp:290
int int_t
Integer number with at least 16 bit.
Definition: nest.h:95
Definition of Archiving_Node which is capable of recording and managing a spike history.
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_cond_exp_sfa_rr.cpp:157
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
State_ S_
Definition: iaf_cond_exp_sfa_rr.h:286
double_t I_e
Constant Current in pA.
Definition: iaf_cond_exp_sfa_rr.h:181
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
iaf_cond_exp_sfa_rr()
Definition: iaf_cond_exp_sfa_rr.cpp:261
UniversalDataLogger< iaf_cond_exp_sfa_rr > logger_
Logger for all analog data.
Definition: iaf_cond_exp_sfa_rr.h:238
~iaf_cond_exp_sfa_rr()
Definition: iaf_cond_exp_sfa_rr.cpp:278
double_t E_sfa
spike-frequency adaptation (sfa) reversal Potential in mV
Definition: iaf_cond_exp_sfa_rr.h:184
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
Buffers_ B_
Definition: iaf_cond_exp_sfa_rr.h:288
Definition: iaf_cond_exp_sfa_rr.h:209
int_t RefractoryCounts_
Definition: iaf_cond_exp_sfa_rr.h:274
double_t V_th_
Threshold Potential in mV.
Definition: iaf_cond_exp_sfa_rr.h:171
gsl_odeiv_system sys_
struct describing system
Definition: iaf_cond_exp_sfa_rr.h:249
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_cond_exp_sfa_rr.cpp:415
Definition: iaf_cond_exp_sfa_rr.h:119
gsl_odeiv_step * s_
GSL ODE stuff.
Definition: iaf_cond_exp_sfa_rr.h:246
Internal variables of the model.
Definition: iaf_cond_exp_sfa_rr.h:273
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: iaf_cond_exp_sfa_rr.cpp:179
double_t E_rr
relative refractory (rr) reversal Potential in mV
Definition: iaf_cond_exp_sfa_rr.h:185
Event for electrical currents.
Definition: event.h:420
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
double_t C_m
Membrane Capacitance in pF.
Definition: iaf_cond_exp_sfa_rr.h:175
Definition: iaf_cond_exp_sfa_rr.h:208
Definition: iaf_cond_exp_sfa_rr.h:213
void set_status(const DictionaryDatum &)
Definition: iaf_cond_exp_sfa_rr.h:340
double_t tau_synE
Synaptic Time Constant Excitatory Synapse in ms.
Definition: iaf_cond_exp_sfa_rr.h:179
static RecordablesMap< iaf_cond_exp_sfa_rr > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_cond_exp_sfa_rr.h:291
Parameters_ P_
Definition: iaf_cond_exp_sfa_rr.h:285
int iaf_cond_exp_sfa_rr_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
Definition: iaf_cond_exp_sfa_rr.h:211
double_t V_reset_
Reset Potential in mV.
Definition: iaf_cond_exp_sfa_rr.h:172
Definition: iaf_cond_exp_sfa_rr.h:210
double IntegrationStep_
current integration time step, updated by GSL
Definition: iaf_cond_exp_sfa_rr.h:256
double_t E_L
Leak reversal Potential (aka resting potential) in mV.
Definition: iaf_cond_exp_sfa_rr.h:178
Map names of recordables to data access functions.
Definition: recordables_map.h:58
State_ & operator=(const State_ &)
Definition: iaf_cond_exp_sfa_rr.cpp:143
Definition: nest_time.h:130
std::string get_name() const
Return class name.
Definition: node.cpp:83
State variables of the model.
Definition: iaf_cond_exp_sfa_rr.h:203
friend int iaf_cond_exp_sfa_rr_dynamics(double, const double *, double *, void *)
Function computing right-hand side of ODE for GSL solver.
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
Independent parameters.
Definition: iaf_cond_exp_sfa_rr.h:170
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_cond_exp_sfa_rr.cpp:333
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
Buffers of the model.
Definition: iaf_cond_exp_sfa_rr.h:233
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
double_t tau_rr
relative refractory (rr) time constant
Definition: iaf_cond_exp_sfa_rr.h:183
double_t y_[STATE_VEC_SIZE]
neuron state, must be C-array for GSL solver
Definition: iaf_cond_exp_sfa_rr.h:216
double_t tau_synI
Synaptic Time Constant for Inhibitory Synapse in ms.
Definition: iaf_cond_exp_sfa_rr.h:180
gsl_odeiv_control * c_
adaptive stepsize control function
Definition: iaf_cond_exp_sfa_rr.h:247
Variables_ V_
Definition: iaf_cond_exp_sfa_rr.h:287
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
double I_stim_
Input current injected by CurrentEvent.
Definition: iaf_cond_exp_sfa_rr.h:265
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
double_t E_ex
Excitatory reversal Potential in mV.
Definition: iaf_cond_exp_sfa_rr.h:176
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_cond_exp_sfa_rr.h:304
double double_t
Double precision floating point numbers.
Definition: nest.h:93
virtual port handles_test_event(SpikeEvent &, rport receptor_type)
Check if the node can handle a particular event and receptor type.
Definition: node.cpp:203
Request data to be logged/logged data to be sent.
Definition: event.h:486
double_t E_in
Inhibitory reversal Potential in mV.
Definition: iaf_cond_exp_sfa_rr.h:177
Parameters_()
Sets default parameter values.
Definition: iaf_cond_exp_sfa_rr.cpp:107
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
double_t q_rr
relative refractory (rr) quantal conductance increase in nS
Definition: iaf_cond_exp_sfa_rr.h:187
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_cond_exp_sfa_rr.h:296
RingBuffer currents_
Definition: iaf_cond_exp_sfa_rr.h:243
RingBuffer spike_exc_
buffers and sums up incoming spikes/currents
Definition: iaf_cond_exp_sfa_rr.h:241
void set(const DictionaryDatum &, const Parameters_ &)
Definition: iaf_cond_exp_sfa_rr.cpp:228
Definition: iaf_cond_exp_sfa_rr.h:212
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
Event for spike information.
Definition: event.h:320
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: iaf_cond_exp_sfa_rr.cpp:345
RingBuffer spike_inh_
Definition: iaf_cond_exp_sfa_rr.h:242
double_t q_sfa
spike-frequency adaptation (sfa) quantal conductance increase in nS
Definition: iaf_cond_exp_sfa_rr.h:186
void get_status(DictionaryDatum &) const
Definition: iaf_cond_exp_sfa_rr.h:330
Base class for all NEST network objects.
Definition: node.h:96
int_t r_
number of refractory steps remaining
Definition: iaf_cond_exp_sfa_rr.h:217
double_t t_ref_
Refractory period in ms.
Definition: iaf_cond_exp_sfa_rr.h:173
friend class UniversalDataLogger< iaf_cond_exp_sfa_rr >
Definition: iaf_cond_exp_sfa_rr.h:163
gsl_odeiv_evolve * e_
evolution function
Definition: iaf_cond_exp_sfa_rr.h:248
double_t step_
step size in ms
Definition: iaf_cond_exp_sfa_rr.h:255
double_t g_L
Leak Conductance in nS.
Definition: iaf_cond_exp_sfa_rr.h:174
State_(const Parameters_ &)
Default initialization.
Definition: iaf_cond_exp_sfa_rr.cpp:128
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
StateVecElems
Symbolic indices to the elements of the state vector y.
Definition: iaf_cond_exp_sfa_rr.h:206
const double e
Definition: numerics.cpp:62
double_t get_y_elem_() const
Read out state vector elements, used by UniversalDataLogger.
Definition: iaf_cond_exp_sfa_rr.h:281
Buffers_(iaf_cond_exp_sfa_rr &)
Sets buffer pointers to 0.
Definition: iaf_cond_exp_sfa_rr.cpp:237
double_t tau_sfa
spike-frequency adaptation (sfa) time constant
Definition: iaf_cond_exp_sfa_rr.h:182
Buffer Layout.
Definition: ring_buffer.h:77
void get(DictionaryDatum &) const
Definition: iaf_cond_exp_sfa_rr.cpp:218
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_cond_exp_sfa_rr.cpp:296