NEST main@f146f75
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
91.. note::
92
93 Incoming spikes are routed to the excitatory or inhibitory synapse type by the **sign of the
94 connection weight**. A positive weight targets the excitatory synapse type, a negative weight
95 the inhibitory one, and also sets the direction of the post-synaptic current.
96 Spike connections must use the default ``receptor_type`` of 0.
97
98 See :ref:`synapse_selection` for the conventions used by other models.
99
100Parameters
101++++++++++
102
103The following parameters can be set in the status Dictionary.
104
105=========== ====== ===================================================
106**Dynamic state variables**
107-----------------------------------------------------------------------
108V_m mV Membrane potential
109u_bar_plus mV Low-pass filtered Membrane potential
110u_bar_minus mV Low-pass filtered Membrane potential
111u_bar_bar mV Low-pass filtered u_bar_minus
112=========== ====== ===================================================
113
114=========== ====== ===========================================================
115**Membrane Parameters**
116-------------------------------------------------------------------------------
117E_L mV Leak reversal potential
118C_m pF Capacity of the membrane
119t_ref ms Duration of refractory period
120g_L nS Leak conductance
121tau_syn_ex ms Rise time of the excitatory postsynaptic current
122 (alpha function)
123tau_syn_in ms Rise time of the inhibitory postsynaptic current
124 (alpha function)
125E_Na mV Sodium reversal potential
126g_Na nS Sodium peak conductance
127E_K mV Potassium reversal potential
128g_K nS Potassium peak conductance
129Act_m real Activation variable m
130Inact_h real Inactivation variable h
131Act_n real Activation variable n
132I_e pA External input current
133=========== ====== ===========================================================
134
135============= ======= =======================================================
136**Clopath rule parameters**
137-----------------------------------------------------------------------------
138A_LTD 1/mV Amplitude of depression
139A_LTP 1/mV^2 Amplitude of facilitation
140theta_plus mV Threshold for u
141theta_minus mV Threshold for u_bar_[plus/minus]
142A_LTD_const boolean Flag that indicates whether `A_LTD_` should
143 be constant (true, default) or multiplied by
144 u_bar_bar^2 / u_ref_squared (false).
145delay_u_bars real Delay with which u_bar_[plus/minus] are processed
146 to compute the synaptic weights.
147U_ref_squared real Reference value for u_bar_bar_^2.
148============= ======= =======================================================
149
150
151Problems/Todo
152+++++++++++++
153
154- better spike detection
155- initial wavelet/spike at simulation onset
156
157
158References
159++++++++++
160
161.. footbibliography::
162
163Sends
164+++++
165
166SpikeEvent
167
168Receives
169++++++++
170
171SpikeEvent, CurrentEvent, DataLoggingRequest
172
173See also
174++++++++
175
176hh_psc_alpha, clopath_synapse, aeif_psc_delta_clopath
177
178Examples using this model
179+++++++++++++++++++++++++
180
181.. listexamples:: hh_psc_alpha_clopath
182
183EndUserDocs */
184
185void register_hh_psc_alpha_clopath( const std::string& name );
186
187class hh_psc_alpha_clopath : public ClopathArchivingNode
188{
189
190public:
191 hh_psc_alpha_clopath();
192 hh_psc_alpha_clopath( const hh_psc_alpha_clopath& );
193 ~hh_psc_alpha_clopath() override;
194
200 using Node::handle;
201 using Node::handles_test_event;
202
203 size_t send_test_event( Node&, size_t, synindex, bool ) override;
204
205 void handle( SpikeEvent& ) override;
206 void handle( CurrentEvent& ) override;
207 void handle( DataLoggingRequest& ) override;
208
209 size_t handles_test_event( SpikeEvent&, size_t ) override;
210 size_t handles_test_event( CurrentEvent&, size_t ) override;
211 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
212
213 void get_status( Dictionary& ) const override;
214 void set_status( const Dictionary& ) override;
215
216private:
217 void init_buffers_() override;
218 void pre_run_hook() override;
219 void update( Time const&, const long, const long ) override;
220
221 // END Boilerplate function declarations ----------------------------
222
223 // Friends --------------------------------------------------------
224
225 // make dynamics function quasi-member
226 friend int hh_psc_alpha_clopath_dynamics( double, const double*, double*, void* );
227
228 // The next two classes need to be friend to access the State_ class/member
229 friend class RecordablesMap< hh_psc_alpha_clopath >;
230 friend class UniversalDataLogger< hh_psc_alpha_clopath >;
231
232private:
233 // ----------------------------------------------------------------
234
236 struct Parameters_
237 {
238 double t_ref_;
239 double g_Na;
240 double g_K;
241 double g_L;
242 double C_m;
243 double E_Na;
244 double E_K;
245 double E_L;
246 double tau_synE;
247 double tau_synI;
248 double I_e;
249 double tau_u_bar_plus;
250 double tau_u_bar_minus;
251 double tau_u_bar_bar;
252
253 Parameters_();
254
255 void get( Dictionary& ) const;
256 void set( const Dictionary&, Node* node );
257 };
258
259public:
260 // ----------------------------------------------------------------
261
266 struct State_
267 {
274 enum StateVecElems
275 {
276 V_M = 0,
277 HH_M, // 1
278 HH_H, // 2
279 HH_N, // 3
280 DI_EXC, // 4
281 I_EXC, // 5
282 DI_INH, // 6
283 I_INH, // 7
284 U_BAR_PLUS, // 8
285 U_BAR_MINUS, // 9
286 U_BAR_BAR, // 10
287 STATE_VEC_SIZE
288 };
289
290
292 double y_[ STATE_VEC_SIZE ];
293 int r_;
294
295 State_( const Parameters_& );
296 State_( const State_& );
297
298 State_& operator=( const State_& );
299
300 void get( Dictionary& ) const;
301 void set( const Dictionary&, Node* node );
302 };
303
304 // ----------------------------------------------------------------
305
306private:
310 struct Buffers_
311 {
312 Buffers_( hh_psc_alpha_clopath& );
313 Buffers_( const Buffers_&, hh_psc_alpha_clopath& );
314
316 UniversalDataLogger< hh_psc_alpha_clopath > logger_;
317
319 RingBuffer spike_exc_;
320 RingBuffer spike_inh_;
321 RingBuffer currents_;
322
324 gsl_odeiv_step* s_;
325 gsl_odeiv_control* c_;
326 gsl_odeiv_evolve* e_;
327 gsl_odeiv_system sys_;
328
329 // Since IntegrationStep_ is initialized with step_, and the resolution
330 // cannot change after nodes have been created, it is safe to place both
331 // here.
332 double step_;
333 double IntegrationStep_;
334
342 double I_stim_;
343 };
344
345 // ----------------------------------------------------------------
346
350 struct Variables_
351 {
353 double PSCurrInit_E_;
354
356 double PSCurrInit_I_;
357
358 int RefractoryCounts_;
359 };
360
361 // Access functions for UniversalDataLogger -------------------------------
362
364 template < State_::StateVecElems elem >
365 double
366 get_y_elem_() const
367 {
368 return S_.y_[ elem ];
369 }
370
371 // ----------------------------------------------------------------
372
373 Parameters_ P_;
374 State_ S_;
375 Variables_ V_;
376 Buffers_ B_;
377
379 static RecordablesMap< hh_psc_alpha_clopath > recordablesMap_;
380};
381
382
383inline size_t
384hh_psc_alpha_clopath::send_test_event( Node& target, size_t receptor_type, synindex, bool )
385{
387 e.set_sender( *this );
388
389 return target.handles_test_event( e, receptor_type );
390}
391
392
393inline size_t
394hh_psc_alpha_clopath::handles_test_event( SpikeEvent&, size_t receptor_type )
395{
396 if ( receptor_type != 0 )
397 {
398 throw UnknownReceptorType( receptor_type, get_name() );
399 }
400 return 0;
401}
402
403inline size_t
404hh_psc_alpha_clopath::handles_test_event( CurrentEvent&, size_t receptor_type )
405{
406 if ( receptor_type != 0 )
407 {
408 throw UnknownReceptorType( receptor_type, get_name() );
409 }
410 return 0;
411}
412
413inline size_t
414hh_psc_alpha_clopath::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
415{
416 if ( receptor_type != 0 )
417 {
418 throw UnknownReceptorType( receptor_type, get_name() );
419 }
420 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
421}
422
423inline void
424hh_psc_alpha_clopath::get_status( Dictionary& d ) const
425{
426 P_.get( d );
427 S_.get( d );
429
430 d[ names::recordables ] = recordablesMap_.get_list();
431}
432
433inline void
434hh_psc_alpha_clopath::set_status( const Dictionary& d )
435{
436 Parameters_ ptmp = P_; // temporary copy in case of errors
437 ptmp.set( d, this ); // throws if BadProperty
438 State_ stmp = S_; // temporary copy in case of errors
439 stmp.set( d, this ); // throws if BadProperty
440
441 // We now know that (ptmp, stmp) are consistent. We do not
442 // write them back to (P_, S_) before we are also sure that
443 // the properties to be set in the parent class are internally
444 // consistent.
446
447 // if we get here, temporaries contain consistent set of properties
448 P_ = ptmp;
449 S_ = stmp;
450}
451
452} // namespace
453
454#endif // HAVE_GSL
455#endif // HH_PSC_ALPHA_CLOPATH_H
An archiving node which additionally archives parameters and buffers needed for the Clopath plasticit...
Definition clopath_archiving_node.h:45
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
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 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
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