NEST  2.6.0,not_revisioned_source_dir@0
pp_pop_psc_delta.h
Go to the documentation of this file.
1 /*
2  * pp_pop_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_POP_PSC_DELTA_H
24 #define PP_POP_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 "binomial_randomdev.h"
32 #include "universal_data_logger.h"
33 
34 
35 namespace nest{
36 
37 
38  class Network;
39 
40  /* BeginDocumentation
41  Name: pp_pop_psc_delta - Population of point process neurons with leaky integration of delta-shaped PSCs.
42 
43  Description:
44 
45  pp_pop_psc_delta is an effective model of a population of neurons. The
46  N component neurons are assumed to be spike response models with escape
47  noise, also known as generalized linear models. We follow closely the
48  nomenclature of [1]. The component neurons are a special case of
49  pp_psc_delta (with purely exponential rate function, no reset and no
50  random dead_time). All neurons in the population share the inputs that it
51  receives, and the output is the pooled spike train.
52 
53  The instantaneous firing rate of the N component neurons is defined as
54 
55  rate(t) = rho_0 * exp( (h(t) - eta(t))/delta_u ),
56 
57  where h(t) is the input potential (synaptic delta currents convolved with
58  an exponential kernel with time constant tau_m), eta(t) models the effect
59  of refractoriness and adaptation (the neuron's own spike train convolved with
60  a sum of exponential kernels with time constants taus_eta), and delta_u
61  sets the scale of the voltages.
62 
63  To represent a (homogeneous) population of N inhomogeneous renewal process
64  neurons, we can keep track of the numbers of neurons that fired a certain number
65  of time steps in the past. These neurons will have the same value of the
66  hazard function (instantaneous rate), and we draw a binomial random number
67  for each of these groups. This algorithm is thus very similar to
68  ppd_sup_generator and gamma_sup_generator, see also [2].
69 
70  However, the adapting threshold eta(t) of the neurons generally makes the neurons
71  non-renewal processes. We employ the quasi-renewal approximation
72  [1], to be able to use the above algorithm. For the extension of [1] to
73  coupled populations see [3].
74 
75  In effect, in each simulation time step, a binomial random number for each
76  of the groups of neurons has to be drawn, independent of the number of
77  represented neurons. For large N, it should be much more efficient than
78  simulating N individual pp_psc_delta models.
79 
80  pp_pop_psc_delta emits spike events like other neuron models, but no more
81  than one per time step. If several component neurons spike in the time step,
82  the multiplicity of the spike event is set accordingly. Thus, to monitor
83  its output, the mulitplicity of the spike events has to be taken into account.
84  Alternatively, the internal variable n_events gives the number of spikes
85  emitted in a time step, and can be monitored using a multimeter.
86 
87  A journal article that describes the model and algorithm in detail is
88  in preparation.
89 
90 
91  References:
92 
93  [1] Naud R, Gerstner W (2012) Coding and decoding with adapting neurons:
94  a population approach to the peri-stimulus time histogram.
95  PLoS Compututational Biology 8: e1002711.
96 
97  [2] Deger M, Helias M, Boucsein C, Rotter S (2012) Statistical properties
98  of superimposed stationary spike trains. Journal of Computational
99  Neuroscience 32:3, 443-463.
100 
101  [3] Deger M, Schwalger T, Naud R, Gerstner W (2014) Fluctuations and
102  information filtering in coupled populations of spiking neurons with
103  adaptation. Physical Review E 90:6, 062704.
104 
105 
106  Parameters:
107 
108  The following parameters can be set in the status dictionary.
109 
110 
111  N int - Number of represented neurons.
112  tau_m double - Membrane time constant in ms.
113  C_m double - Specific capacitance of the membrane in pF/mum^2.
114  rho_0 double - Base firing rate in 1/s.
115  delta_u double - Voltage scale parameter in mV.
116  I_e double - Constant input current in pA.
117  taus_eta list of doubles - time constants of post-spike kernel in ms.
118  vals_eta list of doubles - amplitudes of exponentials in post-spike-kernel in mV.
119  len_kernel double - post-spike kernel eta is truncated after max(taus_eta) * len_kernel.
120 
121 
122  The parameters correspond to the ones of pp_psc_delta as follows.
123 
124  c_1 = 0.0
125  c_2 = rho_0
126  c_3 = 1/delta_u
127  q_sfa = vals_eta
128  tau_sfa = taus_eta
129  I_e = I_e
130 
131  dead_time = simulation resolution
132  dead_time_random = False
133  with_reset = False
134  t_ref_remaining = 0.0
135 
136 
137  Sends: SpikeEvent
138 
139  Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
140 
141  Author: May 2014, Setareh, Deger
142  SeeAlso: pp_psc_delta, ppd_sup_generator, gamma_sup_generator
143  */
144 
152  public Archiving_Node
153  {
154 
155  public:
156 
159 
164  using Node::handle;
166 
168 
169  void handle(SpikeEvent &);
170  void handle(CurrentEvent &);
171  void handle(DataLoggingRequest &);
172 
176 
177  void get_status(DictionaryDatum &) const;
178  void set_status(const DictionaryDatum &);
179 
180  private:
181 
182  void init_state_(const Node& proto);
183  void init_buffers_();
184  void calibrate();
185 
186  void update(Time const &, const long_t, const long_t);
187 
188  // The next two classes need to be friends to access the State_ class/member
190  friend class UniversalDataLogger<pp_pop_psc_delta>;
191 
192  // ----------------------------------------------------------------
193 
197  struct Parameters_ {
198 
200  int_t N_; // by Hesam
201 
204 
207 
210 
213 
216 
219 
221  std::vector<double_t> taus_eta_;
222 
224  std::vector<double_t> vals_eta_;
225 
226  Parameters_();
227  void get(DictionaryDatum&) const;
228  void set(const DictionaryDatum&);
229  };
230 
231  // ----------------------------------------------------------------
232 
236  struct State_ {
237 
240 
241  std::vector<int_t> age_occupations_;
242  std::vector<double_t> thetas_ages_;
243  std::vector<int_t> n_spikes_past_;
244  std::vector<int_t> n_spikes_ages_;
245  std::vector<double_t> rhos_ages_;
246 
247  // ring array pointers
250 
251  bool initialized_; // it is true if the vectors are initialized
252 
253  State_();
254 
255  void get(DictionaryDatum&, const Parameters_&) const;
256  void set(const DictionaryDatum&, const Parameters_&);
257  };
258 
259  // ----------------------------------------------------------------
260 
264  struct Buffers_ {
266  Buffers_(const Buffers_ &, pp_pop_psc_delta &);
267 
271 
274  };
275 
276  // ----------------------------------------------------------------
277 
281  struct Variables_ {
282 
283 
286 
288  std::vector<double_t> theta_kernel_;
289  std::vector<double_t> eta_kernel_;
290 
292 
293 
294 
295 
296  librandom::RngPtr rng_; // random number generator of my own thread
297 
298  librandom::BinomialRandomDev binom_dev_; // binomial random generator
299 
300 
302 
303  };
304 
305  // Access functions for UniversalDataLogger -----------------------
306 
308  double_t get_V_m_() const { return S_.h_; } // filtered input
309 
311  double_t get_n_events_() const { return S_.n_spikes_past_[S_.p_n_spikes_past_]; } // number of generated spikes
312 
313  // ----------------------------------------------------------------
314 
330  };
331 
332  inline
334  {
335  SpikeEvent e;
336  e.set_sender(*this);
337 
338  return target.handles_test_event(e, receptor_type);
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_POP_PSC_DELTA_H */
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
Parameters_()
Sets default parameter values.
Definition: pp_pop_psc_delta.cpp:64
void set(const DictionaryDatum &, const Parameters_ &)
Definition: pp_pop_psc_delta.cpp:160
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.
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
std::vector< int_t > n_spikes_past_
Definition: pp_pop_psc_delta.h:243
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
std::vector< int_t > n_spikes_ages_
Definition: pp_pop_psc_delta.h:244
std::vector< double_t > eta_kernel_
Definition: pp_pop_psc_delta.h:289
double_t rho_0_
Definition: pp_pop_psc_delta.h:209
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
int_t DeadTimeCounts_
Definition: pp_pop_psc_delta.h:301
double_t h_
Definition: pp_pop_psc_delta.h:239
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: pp_pop_psc_delta.cpp:283
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
Independent parameters of the model.
Definition: pp_pop_psc_delta.h:197
State_()
Default initialization.
Definition: pp_pop_psc_delta.cpp:77
Variables_ V_
Definition: pp_pop_psc_delta.h:324
double_t tau_m_
Membrane time constant in ms.
Definition: pp_pop_psc_delta.h:203
int_t p_age_occupations_
Definition: pp_pop_psc_delta.h:248
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: pp_pop_psc_delta.cpp:95
void get_status(DictionaryDatum &) const
Definition: pp_pop_psc_delta.h:367
std::vector< double_t > thetas_ages_
Definition: pp_pop_psc_delta.h:242
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: pp_pop_psc_delta.h:342
Map names of recordables to data access functions.
Definition: recordables_map.h:58
double_t c_m_
Membrane capacitance in pF.
Definition: pp_pop_psc_delta.h:206
double_t y0_
Definition: pp_pop_psc_delta.h:238
Definition: nest_time.h:130
Internal variables of the model.
Definition: pp_pop_psc_delta.h:281
void set_status(const DictionaryDatum &)
Definition: pp_pop_psc_delta.h:376
std::string get_name() const
Return class name.
Definition: node.cpp:83
double_t P30_
Definition: pp_pop_psc_delta.h:284
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
librandom::RngPtr rng_
Definition: pp_pop_psc_delta.h:296
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: pp_pop_psc_delta.cpp:386
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
static RecordablesMap< pp_pop_psc_delta > recordablesMap_
Mapping of recordables names to access functions.
Definition: pp_pop_psc_delta.h:329
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
int_t p_n_spikes_past_
Definition: pp_pop_psc_delta.h:249
Parameters_ P_
Definition: pp_pop_psc_delta.h:322
librandom::BinomialRandomDev binom_dev_
Definition: pp_pop_psc_delta.h:298
int_t len_kernel_
Length of kernel.
Definition: pp_pop_psc_delta.h:215
void calibrate()
Re-calculate dependent parameters of the node.
Definition: pp_pop_psc_delta.cpp:213
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
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: pp_pop_psc_delta.cpp:204
std::vector< double_t > theta_kernel_
Definition: pp_pop_psc_delta.h:288
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
Buffers_(pp_pop_psc_delta &)
Definition: pp_pop_psc_delta.cpp:166
double double_t
Double precision floating point numbers.
Definition: nest.h:93
friend class UniversalDataLogger< pp_pop_psc_delta >
Definition: pp_pop_psc_delta.h:190
State_ S_
Definition: pp_pop_psc_delta.h:323
pp_pop_psc_delta()
Definition: pp_pop_psc_delta.cpp:178
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
State variables of the model.
Definition: pp_pop_psc_delta.h:236
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: pp_pop_psc_delta.cpp:198
Request data to be logged/logged data to be sent.
Definition: event.h:486
RingBuffer spikes_
buffers and sums up incoming spikes/currents
Definition: pp_pop_psc_delta.h:269
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
double_t delta_u_
Definition: pp_pop_psc_delta.h:212
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
int_t len_eta_
Definition: pp_pop_psc_delta.h:287
Event for spike information.
Definition: event.h:320
Base class for all NEST network objects.
Definition: node.h:96
int_t N_
Number of neurons in the population.
Definition: pp_pop_psc_delta.h:200
Class BinomialRNG.
Definition: binomial_randomdev.h:85
Population of point process neurons with leaky integration of delta-shaped PSCs.
Definition: pp_pop_psc_delta.h:151
double_t get_V_m_() const
Read out the real membrane potential.
Definition: pp_pop_psc_delta.h:308
Buffers_ B_
Definition: pp_pop_psc_delta.h:325
double_t get_n_events_() const
Read out the adaptive threshold potential.
Definition: pp_pop_psc_delta.h:311
RingBuffer currents_
Definition: pp_pop_psc_delta.h:270
Buffers of the model.
Definition: pp_pop_psc_delta.h:264
void set(const DictionaryDatum &)
Set values from dictionary.
Definition: pp_pop_psc_delta.cpp:112
std::vector< double_t > taus_eta_
Array of time constants.
Definition: pp_pop_psc_delta.h:221
double_t P33_
Definition: pp_pop_psc_delta.h:285
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
double_t h_
simulation time step in ms
Definition: pp_pop_psc_delta.h:291
const double e
Definition: numerics.cpp:62
bool initialized_
Definition: pp_pop_psc_delta.h:251
UniversalDataLogger< pp_pop_psc_delta > logger_
Logger for all analog data.
Definition: pp_pop_psc_delta.h:273
Buffer Layout.
Definition: ring_buffer.h:77
std::vector< double_t > vals_eta_
Definition: pp_pop_psc_delta.h:224
std::vector< int_t > age_occupations_
Definition: pp_pop_psc_delta.h:241
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: pp_pop_psc_delta.h:333
void get(DictionaryDatum &, const Parameters_ &) const
Definition: pp_pop_psc_delta.cpp:153
std::vector< double_t > rhos_ages_
Definition: pp_pop_psc_delta.h:245
double_t I_e_
External DC current.
Definition: pp_pop_psc_delta.h:218