NEST main@caf0ae8
 
Loading...
Searching...
No Matches
pp_psc_delta.h
Go to the documentation of this file.
1/*
2 * pp_psc_delta.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 PP_PSC_DELTA_H
24#define PP_PSC_DELTA_H
25
26// Includes from nestkernel:
27#include "archiving_node.h"
28#include "connection.h"
29#include "event.h"
30#include "nest_types.h"
31#include "random_generators.h"
32#include "ring_buffer.h"
34
35namespace nest
36{
37
38/* BeginUserDocs: neuron, point process, current-based, adaptation, stochastic
39
40Short description
41+++++++++++++++++
42
43Point process neuron with leaky integration of delta-shaped PSCs
44
45Description
46+++++++++++
47
48``pp_psc_delta`` is an implementation of a leaky integrator, where the potential
49jumps on each spike arrival. It produces spike stochastically, and supports
50spike-frequency adaptation, and other optional features.
51
52Spikes are generated randomly according to the current value of the
53transfer function which operates on the membrane potential. Spike
54generation is followed by an optional dead time. Setting with_reset to
55true will reset the membrane potential after each spike.
56
57The transfer function can be chosen to be linear, exponential or a sum of
58both by adjusting three parameters:
59
60.. math::
61
62 rate = Rect[ c_1 \cdot V' + c_2 \cdot \exp(c_3 * V') ],
63
64where the effective potential :math:`V' = V_m - E_{sfa}` and :math:`E_{sfa}`
65is called the adaptive threshold. Here Rect means rectifier:
66:math:`Rect(x) = {x \text{ if } x>=0, 0 \text{ else}}` (this is necessary
67because
68negative rates are not possible).
69
70By setting c_3 = 0, c_2 can be used as an offset spike rate for an otherwise
71linear rate model.
72
73The dead time enables to include refractoriness. If dead time is 0, the
74number of spikes in one time step might exceed one and is drawn from the
75Poisson distribution accordingly. Otherwise, the probability for a spike
76is given by :math:`1 - \exp(-rate \cdot h)`, where h is the simulation time step. If
77dead_time is smaller than the simulation resolution (time step), it is
78internally set to the resolution.
79
80Note that, even if non-refractory neurons are to be modeled, a small value
81of dead_time, like ``dead_time=1e-8``, might be the value of choice since it
82uses faster uniform random numbers than ``dead_time=0``, which draws Poisson
83numbers. Only for very large spike rates (> 1 spike/time_step) this will
84cause errors.
85
86The model can optionally include an adaptive firing threshold.
87If the neuron spikes, the threshold increases and the membrane potential
88will take longer to reach it.
89Here this is implemented by subtracting the value of the adaptive threshold
90E_sfa from the membrane potential ``V_m`` before passing the potential to the
91transfer function, see also above. ``E_sfa`` jumps by ``q_sfa`` when the neuron
92fires a spike, and decays exponentially with the time constant tau_sfa
93after (see :footcite:p:`Jolivet2006` or :footcite:p:`Pozzorini2013`). Thus, the ``E_sfa`` corresponds to the convolution
94of the neuron's spike train with an exponential kernel. This adaptation kernel may also be chosen as the sum of n
95exponential kernels. To use this feature,`` ``q_sfa and ``tau_sfa`` have to be given as a list of n values each.
96
97The firing of ``pp_psc_delta`` is usually not a renewal process. For example,
98its firing may depend on its past spikes if it has non-zero adaptation terms
99(q_sfa). But if so, it will depend on all its previous spikes, not just the
100last one -- so it is not a renewal process model. However, if ``with_reset``
101is True, and all adaptation terms (``q_sfa``) are 0, then it will reset
102("forget") its membrane potential each time a spike is emitted, which makes
103it a renewal process model (where ``rate`` above is its hazard function,
104also known as conditional intensity).
105
106``pp_psc_delta`` may also be called a spike-response model with escape-noise :footcite:p:`Gerstner2014`
107(for vanishing, non-random dead_time). If ``c_1>0`` and ``c_2==0``, the rate is a
108convolution of the inputs with exponential filters -- which is a model known
109as a Hawkes point process (see :footcite:p:`Grytskyy2013`). If instead ``c_1==0``, then ``pp_psc_delta`` is
110a point process generalized linear model (with the canonical link function,
111and exponential input filters) (see [5,6]_).
112
113This model has been adapted from ``iaf_psc_delta``. The default parameters are
114set to the mean values given in :footcite:p:`Jolivet2006`, which have been matched to spike-train
115recordings. Due to the many features of ``pp_psc_delta`` and its versatility,
116parameters should be set carefully and consciously.
117
118See also :footcite:p:`Cardanobile2010`, :footcite:p:`Deger2014`.
119
120Parameters
121++++++++++
122
123The following parameters can be set in the status dictionary.
124
125
126================= ======= ===================================================
127 V_m mV Membrane potential
128 C_m pF Capacitance of the membrane
129 tau_m ms Membrane time constant
130 q_sfa mV Adaptive threshold jump
131 tau_sfa ms Adaptive threshold time constant
132 dead_time ms Duration of the dead time
133 dead_time_random boolean Should a random dead time be drawn after each
134 spike?
135 dead_time_shape integer Shape parameter of dead time gamma distribution
136 t_ref_remaining ms Remaining dead time at simulation start
137 with_reset boolean Should the membrane potential be reset after a
138 spike?
139 I_e pA Constant input current
140 c_1 Hz/mV Slope of linear part of transfer function in
141 Hz/mV
142 c_2 Hz Prefactor of exponential part of transfer function
143 c_3 1/mV Coefficient of exponential non-linearity of
144 transfer function
145================= ======= ===================================================
146
147
148References
149++++++++++
150
151.. footbibliography::
152
153Sends
154+++++
155
156SpikeEvent
157
158Receives
159++++++++
160
161SpikeEvent, CurrentEvent, DataLoggingRequest
162
163See also
164++++++++
165
166iaf_psc_delta, iaf_psc_alpha, iaf_psc_exp, iaf_psc_delta_ps
167
168Examples using this model
169+++++++++++++++++++++++++
170
171.. listexamples:: pp_psc_delta
172
173EndUserDocs */
174
175void register_pp_psc_delta( const std::string& name );
176
178{
179
180public:
181 pp_psc_delta();
182 pp_psc_delta( const pp_psc_delta& );
183
189 using Node::handle;
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
203 void get_status( Dictionary& ) const override;
204 void set_status( const Dictionary& ) override;
205
206private:
207 void init_state_() override;
208 void init_buffers_() override;
209 void pre_run_hook() override;
210
211 void update( Time const&, const long, const long ) override;
212
213 // The next two classes need to be friends to access the State_ class/member
214 friend class RecordablesMap< pp_psc_delta >;
215 friend class UniversalDataLogger< pp_psc_delta >;
216
217 // ----------------------------------------------------------------
218
223 {
225 double tau_m_;
226
228 double c_m_;
229
232
235
238
241
244 std::vector< double > tau_sfa_;
245
247 std::vector< double > q_sfa_;
248
251
253 double c_1_;
254
256 double c_2_;
257
259 double c_3_;
260
262 double I_e_;
263
266
267 Parameters_();
268
269 void get( Dictionary& ) const;
270 void set( const Dictionary&, Node* node );
271 };
272
273 // ----------------------------------------------------------------
274
278 struct State_
279 {
280 double y0_;
282 double y3_;
283 double q_;
284
286 std::vector< double > q_elems_;
287
288 int r_;
289
291
292 State_();
293
294 void get( Dictionary&, const Parameters_& ) const;
295 void set( const Dictionary&, const Parameters_&, Node* );
296 };
297
298 // ----------------------------------------------------------------
299
315
316 // ----------------------------------------------------------------
317
322 {
323
324 double P30_;
325 double P33_;
326
327 std::vector< double > Q33_;
328
329 double h_;
330 double dt_rate_;
331
335
337 };
338
339 // Access functions for UniversalDataLogger -----------------------
340
342 double
343 get_V_m_() const
344 {
345 return S_.y3_;
346 }
347
349 double
351 {
352 return S_.q_;
353 }
354
355 // ----------------------------------------------------------------
356
371};
372
373inline size_t
374pp_psc_delta::send_test_event( Node& target, size_t receptor_type, synindex, bool )
375{
376 SpikeEvent e;
377 e.set_sender( *this );
378
379 return target.handles_test_event( e, receptor_type );
380}
381
382
383inline size_t
385{
386 if ( receptor_type != 0 )
387 {
388 throw UnknownReceptorType( receptor_type, get_name() );
389 }
390 return 0;
391}
392
393inline size_t
395{
396 if ( receptor_type != 0 )
397 {
398 throw UnknownReceptorType( receptor_type, get_name() );
399 }
400 return 0;
401}
402
403inline size_t
405{
406 if ( receptor_type != 0 )
407 {
408 throw UnknownReceptorType( receptor_type, get_name() );
409 }
410 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
411}
412
413inline void
415{
416 P_.get( d );
417 S_.get( d, P_ );
419 d[ names::recordables ] = recordablesMap_.get_list();
420}
421
422inline void
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, ptmp, 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 /* #ifndef PP_PSC_DELTA_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
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: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
Base class for RNG engine wrappers.
Definition random_generators.h:67
Event for electrical currents.
Definition event.h:569
Request data to be logged/logged data to be sent.
Definition event.h:636
Base class for all NEST network objects.
Definition node.h:99
std::string get_name() const
Return class name.
Definition node.cpp:105
Map names of recordables to data access functions.
Definition recordables_map.h:61
Buffer Layout.
Definition ring_buffer.h:83
Event for spike information.
Definition event.h:418
Definition nest_time.h:135
Exception to be thrown if the specified receptor type does not exist in the node.
Definition exceptions.h:417
Definition pp_psc_delta.h:178
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition pp_psc_delta.h:374
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition pp_psc_delta.h:384
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition pp_psc_delta.cpp:356
pp_psc_delta()
Definition pp_psc_delta.cpp:252
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition pp_psc_delta.h:414
void init_state_() override
Configure state variables depending on runtime information.
Definition pp_psc_delta.cpp:274
Buffers_ B_
Definition pp_psc_delta.h:366
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition pp_psc_delta.cpp:460
double get_V_m_() const
Read out the real membrane potential.
Definition pp_psc_delta.h:343
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition pp_psc_delta.cpp:289
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition pp_psc_delta.h:363
void init_buffers_() override
Configure persistent internal data structures.
Definition pp_psc_delta.cpp:280
Variables_ V_
Definition pp_psc_delta.h:365
State_ S_
Definition pp_psc_delta.h:364
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition pp_psc_delta.h:423
friend class UniversalDataLogger< pp_psc_delta >
Definition pp_psc_delta.h:215
double get_E_sfa_() const
Read out the adaptive threshold potential.
Definition pp_psc_delta.h:350
static RecordablesMap< pp_psc_delta > recordablesMap_
Mapping of recordables names to access functions.
Definition pp_psc_delta.h:370
virtual size_t handles_test_event(SpikeEvent &, size_t receptor_type)
Check if the node can handle a particular event and receptor type.
Definition node.cpp:271
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition node.cpp:265
const std::string recordables("recordables")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_pp_psc_delta(const std::string &name)
Definition pp_psc_delta.cpp:46
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition pp_psc_delta.h:304
RingBuffer spikes_
buffers and sums up incoming spikes/currents
Definition pp_psc_delta.h:309
RingBuffer currents_
Definition pp_psc_delta.h:310
UniversalDataLogger< pp_psc_delta > logger_
Logger for all analog data.
Definition pp_psc_delta.h:313
Independent parameters of the model.
Definition pp_psc_delta.h:223
bool dead_time_random_
Do we use random dead time?
Definition pp_psc_delta.h:234
void set(const Dictionary &, Node *node)
Set values from dictionary.
Definition pp_psc_delta.cpp:143
bool with_reset_
Do we reset the membrane potential after each spike?
Definition pp_psc_delta.h:240
double c_3_
Coefficient of exponential non-linearity of transfer function.
Definition pp_psc_delta.h:259
double c_2_
Prefactor of exponential part of transfer function.
Definition pp_psc_delta.h:256
double c_m_
Membrane capacitance in pF.
Definition pp_psc_delta.h:228
double dead_time_
Dead time in ms.
Definition pp_psc_delta.h:231
double tau_m_
Membrane time constant in ms.
Definition pp_psc_delta.h:225
double c_1_
Slope of the linear part of transfer function.
Definition pp_psc_delta.h:253
std::vector< double > q_sfa_
Adaptive threshold jump in mV (for multi adaptation version).
Definition pp_psc_delta.h:247
double I_e_
External DC current.
Definition pp_psc_delta.h:262
bool multi_param_
indicates multi parameter adaptation model
Definition pp_psc_delta.h:250
Parameters_()
Sets default parameter values.
Definition pp_psc_delta.cpp:72
std::vector< double > tau_sfa_
List of adaptive threshold time constant in ms (for multi adaptation version).
Definition pp_psc_delta.h:244
void get(Dictionary &) const
Store current values in dictionary.
Definition pp_psc_delta.cpp:107
long dead_time_shape_
Shape parameter of random dead time gamma distribution.
Definition pp_psc_delta.h:237
double t_ref_remaining_
Dead time from simulation start.
Definition pp_psc_delta.h:265
State variables of the model.
Definition pp_psc_delta.h:279
void set(const Dictionary &, const Parameters_ &, Node *)
Definition pp_psc_delta.cpp:230
double y0_
This is piecewise constant external current.
Definition pp_psc_delta.h:280
bool initialized_
it is true if the vectors are initialized
Definition pp_psc_delta.h:290
State_()
Default initialization.
Definition pp_psc_delta.cpp:92
void get(Dictionary &, const Parameters_ &) const
Definition pp_psc_delta.cpp:223
double y3_
This is the membrane potential RELATIVE TO RESTING POTENTIAL.
Definition pp_psc_delta.h:282
std::vector< double > q_elems_
Vector of adaptation parameters. by Hesam.
Definition pp_psc_delta.h:286
double q_
This is the change of the 'threshold' due to adaptation.
Definition pp_psc_delta.h:283
int r_
Number of refractory steps remaining.
Definition pp_psc_delta.h:288
Internal variables of the model.
Definition pp_psc_delta.h:322
double P33_
Definition pp_psc_delta.h:325
int DeadTimeCounts_
Definition pp_psc_delta.h:336
double h_
simulation time step in ms
Definition pp_psc_delta.h:329
RngPtr rng_
random number generator of my own thread
Definition pp_psc_delta.h:332
double dt_rate_
rate parameter of dead time distribution
Definition pp_psc_delta.h:330
double P30_
Definition pp_psc_delta.h:324
std::vector< double > Q33_
Definition pp_psc_delta.h:327
poisson_distribution poisson_dist_
poisson distribution
Definition pp_psc_delta.h:334
gamma_distribution gamma_dist_
gamma distribution
Definition pp_psc_delta.h:333