NEST  2.6.0,not_revisioned_source_dir@0
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 #include "nest.h"
27 #include "event.h"
28 #include "archiving_node.h"
29 #include "ring_buffer.h"
30 #include "connection.h"
31 #include "poisson_randomdev.h"
32 #include "gamma_randomdev.h"
33 #include "universal_data_logger.h"
34 
35 namespace nest{
36 
37 
38  class Network;
39 
40  /* BeginDocumentation
41  Name: pp_psc_delta - Point process neuron with leaky integration of delta-shaped PSCs.
42 
43  Description:
44 
45  pp_psc_delta is an implementation of a leaky integrator,
46  where the potential jumps on each spike arrival.
47 
48  Spikes are generated randomly according to the current value of the
49  transfer function which operates on the membrane potential. Spike
50  generation is followed by an optional dead time. Setting with_reset to
51  true will reset the membrane potential after each spike.
52 
53  The transfer function can be chosen to be linear, exponential or a sum of
54  both by adjusting three parameters:
55 
56  rate = Rect[ c1 * V' + c2 * exp(c3 * V') ],
57 
58  where the effective potential V' = V_m - E_sfa and E_sfa is called
59  the adaptive threshold.
60 
61  By setting c3 = 0, c2 can be used as an offset spike rate for an otherwise
62  linear rate model.
63 
64  The dead time enables to include refractoriness. If dead time is 0, the
65  number of spikes in one time step might exceed one and is drawn from the
66  Poisson distribution accordingly. Otherwise, the probability for a spike
67  is given by 1 - exp(-rate*h), where h is the simulation time step. If dead_time
68  is smaller than the simulation resolution (time step), it is internally
69  set to the time step.
70 
71  Note that, even if non-refractory neurons are to be modeled, a small value
72  of dead_time, like dead_time=1e-8, might be the value of choice since it
73  uses faster uniform random numbers than dead_time=0, which draws Poisson
74  numbers. Only for very large spike rates (> 1 spike/h) this will cause errors.
75 
76  The model can optionally include something which would be called adaptive
77  threshold in an integrate-and-fire neuron. If the neuron spikes, the
78  threshold increases and the membrane potential will take longer to reach it.
79  Here this is implemented by subtracting the value of the adaptive threshold
80  E_sfa from the membrane potential V_m before passing the potential to the
81  transfer function, see also above. E_sfa jumps by q_sfa when the neuron
82  fires a spike, and decays exponentially with the time constant tau_sfa
83  after (see [2] or [3]). Thus, the E_sfa corresponds to the convolution of the
84  neuron's spike train with an exponential kernel.
85  This adaptation kernel may also be chosen as the sum of n exponential
86  kernels. To use this feature, q_sfa and tau_sfa have to be given as a list
87  of n values each.
88 
89  This model has been adapted from iaf_psc_delta. The default parameters are
90  set to the mean values in [2], which have been matched to spike-train
91  recordings.
92 
93 
94  References:
95 
96  [1] Multiplicatively interacting point processes and applications to neural
97  modeling (2010) Stefano Cardanobile and Stefan Rotter, Journal of
98  Computational Neuroscience
99 
100  [2] Predicting spike timing of neocortical pyramidal neurons by simple
101  threshold models (2006) Jolivet R, Rauch A, Luescher H-R, Gerstner W.
102  J Comput Neurosci 21:35-49
103 
104  [3] Pozzorini C, Naud R, Mensi S, Gerstner W (2013) Temporal whitening by
105  power-law adaptation in neocortical neurons. Nat Neurosci 16: 942-948.
106  (uses a similar model of multi-timescale adaptation)
107 
108  [4] Grytskyy D, Tetzlaff T, Diesmann M and Helias M (2013) A unified view
109  on weakly correlated recurrent networks. Front. Comput. Neurosci. 7:131.
110 
111  [5] Deger M, Schwalger T, Naud R, Gerstner W (2014) Fluctuations and
112  information filtering in coupled populations of spiking neurons with
113  adaptation. Physical Review E 90:6, 062704.
114 
115 
116  Parameters:
117 
118  The following parameters can be set in the status dictionary.
119 
120  V_m double - Membrane potential in mV.
121  C_m double - Specific capacitance of the membrane in pF/mum^2.
122  tau_m double - Membrane time constant in ms.
123  q_sfa double - Adaptive threshold jump in mV.
124  tau_sfa double - Adaptive threshold time constant in ms.
125  dead_time double - Duration of the dead time in ms.
126  dead_time_random bool - Should a random dead time be drawn after each spike?
127  dead_time_shape int - Shape parameter of dead time gamma distribution.
128  t_ref_remaining double Remaining dead time at simulation start.
129  with_reset bool Should the membrane potential be reset after a spike?
130  I_e double - Constant input current in pA.
131  c_1 double - Slope of linear part of transfer function in Hz/mV.
132  c_2 double - Prefactor of exponential part of transfer function in Hz.
133  c_3 double - Coefficient of exponential non-linearity of transfer function in 1/mV.
134 
135 
136  Sends: SpikeEvent
137 
138  Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
139 
140  Author: July 2009, Deger, Helias; January 2011, Zaytsev; May 2014, Setareh
141  SeeAlso: pp_pop_psc_delta, iaf_psc_delta, iaf_psc_alpha, iaf_psc_exp, iaf_neuron, iaf_psc_delta_canon
142  */
143 
148  public Archiving_Node
149  {
150 
151  public:
152 
153  pp_psc_delta();
154  pp_psc_delta(const pp_psc_delta&);
155 
160  using Node::handle;
162 
164 
165  void handle(SpikeEvent &);
166  void handle(CurrentEvent &);
167  void handle(DataLoggingRequest &);
168 
172 
173 
174  void get_status(DictionaryDatum &) const;
175  void set_status(const DictionaryDatum &);
176 
177  private:
178 
179  void init_state_(const Node& proto);
180  void init_buffers_();
181  void calibrate();
182 
183  void update(Time const &, const long_t, const long_t);
184 
185  // The next two classes need to be friends to access the State_ class/member
187  friend class UniversalDataLogger<pp_psc_delta>;
188 
189  // ----------------------------------------------------------------
190 
194  struct Parameters_ {
195 
198 
201 
204 
207 
210 
213 
215  std::vector<double_t> tau_sfa_;
216 
218  std::vector<double_t> q_sfa_;
219 
222 
225 
228 
231 
234 
237 
238  Parameters_();
239 
240  void get(DictionaryDatum&) const;
241  void set(const DictionaryDatum&);
242  };
243 
244  // ----------------------------------------------------------------
245 
249  struct State_ {
253 
254  std::vector<double_t> q_elems_; // Vector of adaptation parameters. by Hesam
255 
257 
258  State_();
259 
260  void get(DictionaryDatum&, const Parameters_&) const;
261  void set(const DictionaryDatum&, const Parameters_&);
262  };
263 
264  // ----------------------------------------------------------------
265 
269  struct Buffers_ {
271  Buffers_(const Buffers_ &, pp_psc_delta &);
272 
276 
279  };
280 
281  // ----------------------------------------------------------------
282 
286  struct Variables_ {
287 
290 
291  std::vector<double_t> Q33_;
292 
295 
296  librandom::RngPtr rng_; // random number generator of my own thread
297  librandom::PoissonRandomDev poisson_dev_; // random deviate generator
298  librandom::GammaRandomDev gamma_dev_; // random deviate generator
299 
301 
302  };
303 
304  // Access functions for UniversalDataLogger -----------------------
305 
307  double_t get_V_m_() const { return S_.y3_; }
308 
310  double_t get_E_sfa_() const { return S_.q_; }
311 
312  // ----------------------------------------------------------------
313 
329  };
330 
331  inline
333 {
334  SpikeEvent e;
335  e.set_sender(*this);
336 
337  return target.handles_test_event(e, receptor_type);
338 }
339 
340 
341 inline
343 {
344  if (receptor_type != 0)
345  throw UnknownReceptorType(receptor_type, get_name());
346  return 0;
347 }
348 
349 inline
351 {
352  if (receptor_type != 0)
353  throw UnknownReceptorType(receptor_type, get_name());
354  return 0;
355 }
356 
357 inline
360 {
361  if (receptor_type != 0)
362  throw UnknownReceptorType(receptor_type, get_name());
363  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
364 }
365 
366 inline
368 {
369  P_.get(d);
370  S_.get(d, P_);
372  (*d)[names::recordables] = recordablesMap_.get_list();
373 }
374 
375 inline
377 {
378  Parameters_ ptmp = P_; // temporary copy in case of errors
379  ptmp.set(d); // throws if BadProperty
380  State_ stmp = S_; // temporary copy in case of errors
381  stmp.set(d, ptmp); // throws if BadProperty
382 
383  // We now know that (ptmp, stmp) are consistent. We do not
384  // write them back to (P_, S_) before we are also sure that
385  // the properties to be set in the parent class are internally
386  // consistent.
388 
389  // if we get here, temporaries contain consistent set of properties
390  P_ = ptmp;
391  S_ = stmp;
392 }
393 
394 } // namespace
395 
396 #endif /* #ifndef PP_PSC_DELTA_H */
Buffers_ B_
Definition: pp_psc_delta.h:324
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
Class GammaRandomDev Create gamma distributed random numbers.
Definition: gamma_randomdev.h:89
double_t t_ref_remaining_
Dead time from simulation start.
Definition: pp_psc_delta.h:236
int int_t
Integer number with at least 16 bit.
Definition: nest.h:95
void calibrate()
Re-calculate dependent parameters of the node.
Definition: pp_psc_delta.cpp:254
Definition of Archiving_Node which is capable of recording and managing a spike history.
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
int_t r_
Number of refractory steps remaining.
Definition: pp_psc_delta.h:256
UniversalDataLogger< pp_psc_delta > logger_
Logger for all analog data.
Definition: pp_psc_delta.h:278
double_t c_m_
Membrane capacitance in pF.
Definition: pp_psc_delta.h:200
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: pp_psc_delta.cpp:239
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: pp_psc_delta.cpp:98
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: pp_psc_delta.h:342
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: pp_psc_delta.cpp:312
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: pp_psc_delta.cpp:410
double_t get_V_m_() const
Read out the real membrane potential.
Definition: pp_psc_delta.h:307
Parameters_()
Sets default parameter values.
Definition: pp_psc_delta.cpp:65
State_ S_
Definition: pp_psc_delta.h:322
librandom::GammaRandomDev gamma_dev_
Definition: pp_psc_delta.h:298
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
double_t tau_m_
Membrane time constant in ms.
Definition: pp_psc_delta.h:197
double_t dt_rate_
rate parameter of dead time distribution
Definition: pp_psc_delta.h:294
Independent parameters of the model.
Definition: pp_psc_delta.h:194
double_t c_1_
Slope of the linear part of transfer function.
Definition: pp_psc_delta.h:224
Parameters_ P_
Definition: pp_psc_delta.h:321
bool with_reset_
Do we reset the membrane potential after each spike?
Definition: pp_psc_delta.h:212
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
State variables of the model.
Definition: pp_psc_delta.h:249
double_t c_2_
Prefactor of exponential part of transfer function.
Definition: pp_psc_delta.h:227
double_t c_3_
Coefficient of exponential non-linearity of transfer function.
Definition: pp_psc_delta.h:230
void get(DictionaryDatum &, const Parameters_ &) const
Definition: pp_psc_delta.cpp:195
Buffers_(pp_psc_delta &)
Definition: pp_psc_delta.cpp:207
bool dead_time_random_
Do we use random dead time?
Definition: pp_psc_delta.h:206
RingBuffer spikes_
buffers and sums up incoming spikes/currents
Definition: pp_psc_delta.h:274
State_()
Default initialization.
Definition: pp_psc_delta.cpp:85
librandom::PoissonRandomDev poisson_dev_
Definition: pp_psc_delta.h:297
Map names of recordables to data access functions.
Definition: recordables_map.h:58
double_t I_e_
External DC current.
Definition: pp_psc_delta.h:233
friend class UniversalDataLogger< pp_psc_delta >
Definition: pp_psc_delta.h:187
Definition: nest_time.h:130
pp_psc_delta()
Definition: pp_psc_delta.cpp:219
std::vector< double_t > Q33_
Definition: pp_psc_delta.h:291
std::string get_name() const
Return class name.
Definition: node.cpp:83
static RecordablesMap< pp_psc_delta > recordablesMap_
Mapping of recordables names to access functions.
Definition: pp_psc_delta.h:328
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
double_t get_E_sfa_() const
Read out the adaptive threshold potential.
Definition: pp_psc_delta.h:310
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
ulong_t dead_time_shape_
Shape parameter of random dead time gamma distribution.
Definition: pp_psc_delta.h:209
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
double_t dead_time_
Dead time in ms.
Definition: pp_psc_delta.h:203
double_t h_
simulation time step in ms
Definition: pp_psc_delta.h:293
Internal variables of the model.
Definition: pp_psc_delta.h:286
void set(const DictionaryDatum &, const Parameters_ &)
Definition: pp_psc_delta.cpp:201
Class PoissonRandomDev Create Poisson distributed random numbers.
Definition: poisson_randomdev.h:103
Point process neuron with leaky integration of delta-shaped PSCs.
Definition: pp_psc_delta.h:147
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: pp_psc_delta.cpp:246
void set_status(const DictionaryDatum &)
Definition: pp_psc_delta.h:376
double_t q_
This is the change of the 'threshold' due to adaptation.
Definition: pp_psc_delta.h:252
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: pp_psc_delta.h:332
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
double_t y3_
This is the membrane potential RELATIVE TO RESTING POTENTIAL.
Definition: pp_psc_delta.h:251
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
double double_t
Double precision floating point numbers.
Definition: nest.h:93
std::vector< double_t > q_sfa_
Adaptive threshold jump in mV (for multi adaptation version).
Definition: pp_psc_delta.h:218
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
Buffers of the model.
Definition: pp_psc_delta.h:269
librandom::RngPtr rng_
Definition: pp_psc_delta.h:296
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
bool multi_param_
indicates multi parameter adaptation model
Definition: pp_psc_delta.h:221
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
RingBuffer currents_
Definition: pp_psc_delta.h:275
Event for spike information.
Definition: event.h:320
void set(const DictionaryDatum &)
Set values from dictionary.
Definition: pp_psc_delta.cpp:136
void get_status(DictionaryDatum &) const
Definition: pp_psc_delta.h:367
Base class for all NEST network objects.
Definition: node.h:96
double_t P33_
Definition: pp_psc_delta.h:289
Variables_ V_
Definition: pp_psc_delta.h:323
std::vector< double_t > tau_sfa_
List of adaptive threshold time constant in ms (for multi adaptation version).
Definition: pp_psc_delta.h:215
int_t DeadTimeCounts_
Definition: pp_psc_delta.h:300
double_t P30_
Definition: pp_psc_delta.h:288
std::vector< double_t > q_elems_
Definition: pp_psc_delta.h:254
double_t y0_
This is piecewise constant external current.
Definition: pp_psc_delta.h:250
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
Buffer Layout.
Definition: ring_buffer.h:77
unsigned long ulong_t
Unsigned long_t.
Definition: nest.h:98