NEST main@caf0ae8
 
Loading...
Searching...
No Matches
hh_psc_alpha_clopath.h
Go to the documentation of this file.
1/*
2 * hh_psc_alpha_clopath.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 HH_PSC_ALPHA_CLOPATH_H
24#define HH_PSC_ALPHA_CLOPATH_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#include <gsl/gsl_sf_exp.h>
36
37// Includes from nestkernel:
39#include "connection.h"
40#include "event.h"
41#include "nest_types.h"
42#include "recordables_map.h"
43#include "ring_buffer.h"
45
46namespace nest
47{
58extern "C" int hh_psc_alpha_clopath_dynamics( double, const double*, double*, void* );
59
60/* BeginUserDocs: neuron, Hodgkin-Huxley, current-based, Clopath plasticity, soft threshold
61
62Short description
63+++++++++++++++++
64
65Hodgkin-Huxley neuron model with support for Clopath plasticity
66
67Description
68+++++++++++
69
70``hh_psc_alpha_clopath`` is an implementation of a spiking neuron using the
71Hodgkin-Huxley formalism and that is capable of connecting to a Clopath
72synapse.
73
74(1) Postsynaptic currents
75Incoming spike events induce a postsynaptic change of current modelled
76by an alpha function. The alpha function is normalized such that an event of
77weight 1.0 results in a peak current of 1 pA.
78
79
80(2) Spike Detection
81Spike detection is done by a combined threshold-and-local-maximum search: if
82there is a local maximum above a certain threshold of the membrane potential,
83it is considered a spike.
84
85See also :footcite:p:`Gerstner2002`, :footcite:p:`Dayan2001`, :footcite:p:`Hodgkin1952`, :footcite:p:`Clopath2010a`,
86:footcite:p:`Clopath2010b`, :footcite:p:`Torben-Nielsen2010`.
87
88For details on asynchronicity in spike and firing events with Hodgkin Huxley models
89see :ref:`here <hh_details>`.
90
91Parameters
92++++++++++
93
94The following parameters can be set in the status Dictionary.
95
96=========== ====== ===================================================
97**Dynamic state variables**
98-----------------------------------------------------------------------
99V_m mV Membrane potential
100u_bar_plus mV Low-pass filtered Membrane potential
101u_bar_minus mV Low-pass filtered Membrane potential
102u_bar_bar mV Low-pass filtered u_bar_minus
103=========== ====== ===================================================
104
105=========== ====== ===========================================================
106**Membrane Parameters**
107-------------------------------------------------------------------------------
108E_L mV Leak reversal potential
109C_m pF Capacity of the membrane
110t_ref ms Duration of refractory period
111g_L nS Leak conductance
112tau_ex ms Rise time of the excitatory synaptic alpha function
113tau_in ms Rise time of the inhibitory synaptic alpha function
114E_Na mV Sodium reversal potential
115g_Na nS Sodium peak conductance
116E_K mV Potassium reversal potential
117g_K nS Potassium peak conductance
118Act_m real Activation variable m
119Inact_h real Inactivation variable h
120Act_n real Activation variable n
121I_e pA External input current
122=========== ====== ===========================================================
123
124============= ======= =======================================================
125**Clopath rule parameters**
126-----------------------------------------------------------------------------
127A_LTD 1/mV Amplitude of depression
128A_LTP 1/mV^2 Amplitude of facilitation
129theta_plus mV Threshold for u
130theta_minus mV Threshold for u_bar_[plus/minus]
131A_LTD_const boolean Flag that indicates whether `A_LTD_` should
132 be constant (true, default) or multiplied by
133 u_bar_bar^2 / u_ref_squared (false).
134delay_u_bars real Delay with which u_bar_[plus/minus] are processed
135 to compute the synaptic weights.
136U_ref_squared real Reference value for u_bar_bar_^2.
137============= ======= =======================================================
138
139
140Problems/Todo
141+++++++++++++
142
143- better spike detection
144- initial wavelet/spike at simulation onset
145
146
147References
148++++++++++
149
150.. footbibliography::
151
152Sends
153+++++
154
155SpikeEvent
156
157Receives
158++++++++
159
160SpikeEvent, CurrentEvent, DataLoggingRequest
161
162See also
163++++++++
164
165hh_psc_alpha, clopath_synapse, aeif_psc_delta_clopath
166
167Examples using this model
168+++++++++++++++++++++++++
169
170.. listexamples:: hh_psc_alpha_clopath
171
172EndUserDocs */
173
174void register_hh_psc_alpha_clopath( const std::string& name );
175
176class hh_psc_alpha_clopath : public ClopathArchivingNode
177{
178
179public:
180 hh_psc_alpha_clopath();
181 hh_psc_alpha_clopath( const hh_psc_alpha_clopath& );
182 ~hh_psc_alpha_clopath() override;
183
189 using Node::handle;
190 using Node::handles_test_event;
191
192 size_t send_test_event( Node&, size_t, synindex, bool ) override;
193
194 void handle( SpikeEvent& ) override;
195 void handle( CurrentEvent& ) override;
196 void handle( DataLoggingRequest& ) override;
197
198 size_t handles_test_event( SpikeEvent&, size_t ) override;
199 size_t handles_test_event( CurrentEvent&, size_t ) override;
200 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
201
202 void get_status( Dictionary& ) const override;
203 void set_status( const Dictionary& ) override;
204
205private:
206 void init_buffers_() override;
207 void pre_run_hook() override;
208 void update( Time const&, const long, const long ) override;
209
210 // END Boilerplate function declarations ----------------------------
211
212 // Friends --------------------------------------------------------
213
214 // make dynamics function quasi-member
215 friend int hh_psc_alpha_clopath_dynamics( double, const double*, double*, void* );
216
217 // The next two classes need to be friend to access the State_ class/member
218 friend class RecordablesMap< hh_psc_alpha_clopath >;
219 friend class UniversalDataLogger< hh_psc_alpha_clopath >;
220
221private:
222 // ----------------------------------------------------------------
223
225 struct Parameters_
226 {
227 double t_ref_;
228 double g_Na;
229 double g_K;
230 double g_L;
231 double C_m;
232 double E_Na;
233 double E_K;
234 double E_L;
235 double tau_synE;
236 double tau_synI;
237 double I_e;
238 double tau_u_bar_plus;
239 double tau_u_bar_minus;
240 double tau_u_bar_bar;
241
242 Parameters_();
243
244 void get( Dictionary& ) const;
245 void set( const Dictionary&, Node* node );
246 };
247
248public:
249 // ----------------------------------------------------------------
250
255 struct State_
256 {
263 enum StateVecElems
264 {
265 V_M = 0,
266 HH_M, // 1
267 HH_H, // 2
268 HH_N, // 3
269 DI_EXC, // 4
270 I_EXC, // 5
271 DI_INH, // 6
272 I_INH, // 7
273 U_BAR_PLUS, // 8
274 U_BAR_MINUS, // 9
275 U_BAR_BAR, // 10
276 STATE_VEC_SIZE
277 };
278
279
281 double y_[ STATE_VEC_SIZE ];
282 int r_;
283
284 State_( const Parameters_& );
285 State_( const State_& );
286
287 State_& operator=( const State_& );
288
289 void get( Dictionary& ) const;
290 void set( const Dictionary&, Node* node );
291 };
292
293 // ----------------------------------------------------------------
294
295private:
299 struct Buffers_
300 {
301 Buffers_( hh_psc_alpha_clopath& );
302 Buffers_( const Buffers_&, hh_psc_alpha_clopath& );
303
305 UniversalDataLogger< hh_psc_alpha_clopath > logger_;
306
308 RingBuffer spike_exc_;
309 RingBuffer spike_inh_;
310 RingBuffer currents_;
311
313 gsl_odeiv_step* s_;
314 gsl_odeiv_control* c_;
315 gsl_odeiv_evolve* e_;
316 gsl_odeiv_system sys_;
317
318 // Since IntegrationStep_ is initialized with step_, and the resolution
319 // cannot change after nodes have been created, it is safe to place both
320 // here.
321 double step_;
322 double IntegrationStep_;
323
331 double I_stim_;
332 };
333
334 // ----------------------------------------------------------------
335
339 struct Variables_
340 {
342 double PSCurrInit_E_;
343
345 double PSCurrInit_I_;
346
347 int RefractoryCounts_;
348 };
349
350 // Access functions for UniversalDataLogger -------------------------------
351
353 template < State_::StateVecElems elem >
354 double
355 get_y_elem_() const
356 {
357 return S_.y_[ elem ];
358 }
359
360 // ----------------------------------------------------------------
361
362 Parameters_ P_;
363 State_ S_;
364 Variables_ V_;
365 Buffers_ B_;
366
368 static RecordablesMap< hh_psc_alpha_clopath > recordablesMap_;
369};
370
371
372inline size_t
373hh_psc_alpha_clopath::send_test_event( Node& target, size_t receptor_type, synindex, bool )
374{
375 SpikeEvent e;
376 e.set_sender( *this );
377
378 return target.handles_test_event( e, receptor_type );
379}
380
381
382inline size_t
383hh_psc_alpha_clopath::handles_test_event( SpikeEvent&, size_t receptor_type )
384{
385 if ( receptor_type != 0 )
386 {
387 throw UnknownReceptorType( receptor_type, get_name() );
388 }
389 return 0;
390}
391
392inline size_t
393hh_psc_alpha_clopath::handles_test_event( CurrentEvent&, size_t receptor_type )
394{
395 if ( receptor_type != 0 )
396 {
397 throw UnknownReceptorType( receptor_type, get_name() );
398 }
399 return 0;
400}
401
402inline size_t
403hh_psc_alpha_clopath::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
404{
405 if ( receptor_type != 0 )
406 {
407 throw UnknownReceptorType( receptor_type, get_name() );
408 }
409 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
410}
411
412inline void
413hh_psc_alpha_clopath::get_status( Dictionary& d ) const
414{
415 P_.get( d );
416 S_.get( d );
418
419 d[ names::recordables ] = recordablesMap_.get_list();
420}
421
422inline void
423hh_psc_alpha_clopath::set_status( const Dictionary& d )
424{
425 Parameters_ ptmp = P_; // temporary copy in case of errors
426 ptmp.set( d, this ); // throws if BadProperty
427 State_ stmp = S_; // temporary copy in case of errors
428 stmp.set( d, this ); // throws if BadProperty
429
430 // We now know that (ptmp, stmp) are consistent. We do not
431 // write them back to (P_, S_) before we are also sure that
432 // the properties to be set in the parent class are internally
433 // consistent.
435
436 // if we get here, temporaries contain consistent set of properties
437 P_ = ptmp;
438 S_ = stmp;
439}
440
441} // namespace
442
443#endif // HAVE_GSL
444#endif // HH_PSC_ALPHA_CLOPATH_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 clopath_archiving_node.cpp:77
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition clopath_archiving_node.cpp:91
const std::string tau_u_bar_plus("tau_u_bar_plus")
const std::string E_L("E_L")
const std::string I_e("I_e")
const std::string E_K("E_K")
const std::string recordables("recordables")
const std::string C_m("C_m")
const std::string d("d")
const std::string g_Na("g_Na")
const std::string E_Na("E_Na")
const std::string g_K("g_K")
const std::string target("target")
const std::string tau_u_bar_minus("tau_u_bar_minus")
const std::string tau_u_bar_bar("tau_u_bar_bar")
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