NEST  2.6.0,not_revisioned_source_dir@0
ppd_sup_generator.h
Go to the documentation of this file.
1 /*
2  * ppd_sup_generator.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 ppd_sup_generator_H
24 #define ppd_sup_generator_H
25 
26 #include <vector>
27 #include "nest.h"
28 #include "event.h"
29 #include "node.h"
30 #include "stimulating_device.h"
31 #include "scheduler.h"
32 #include "binomial_randomdev.h"
33 #include "poisson_randomdev.h"
34 #include "connection.h"
35 
36 /*BeginDocumentation
37 Name: ppd_sup_generator - simulate the superimposed spike train of a population of Poisson processes with dead time.
38 Description:
39 
40  The ppd_sup_generator generator simulates the pooled spike train of a
41  population of neurons firing independently with Poisson process with dead
42  time statistics.
43  The rate parameter can also be sine-modulated. The generator does not
44  initialize to equilibrium in this case, initial transients might occur.
45 
46 Parameters:
47  The following parameters appear in the element's status dictionary:
48 
49  rate - mean firing rate of the component processes. (double, var)
50  dead_time - minimal time between two spikes of the component processes. (double, var)
51  n_proc - number of superimposed independent component processes. (long, var)
52  frequency - rate modulation frequency. (double, var)
53  amplitude - relative rate modulation amplitude. (double, var)
54 
55 Note:
56  The generator has been published in Deger, Helias, Boucsein, Rotter (2011)
57  Statistical properties of superimposed stationary spike trains,
58  Journal of Computational Neuroscience.
59  URL: http://www.springerlink.com/content/u75211r381p08301/
60  DOI: 10.1007/s10827-011-0362-8
61 
62 Authors:
63  June 2009, Moritz Deger, Moritz Helias
64 
65 SeeAlso: gamma_sup_generator, poisson_generator_ps, spike_generator, Device, StimulatingDevice
66 */
67 
68 
69 namespace nest{
70 
79  class ppd_sup_generator: public Node
80  {
81 
82  public:
83 
86 
87  bool has_proxies() const {return false;}
88  bool is_off_grid() const {return false;} // does not use off_grid events
89 
94  using Node::event_hook;
95 
97 
98  void get_status(DictionaryDatum &) const;
99  void set_status(const DictionaryDatum &);
100 
101 
102  private:
103  void init_state_(const Node&);
104  void init_buffers_();
105  void calibrate();
106 
116  void update(Time const &, const long_t, const long_t);
117 
123  void event_hook(DSSpikeEvent&);
124 
125  // ------------------------------------------------------------
126 
130  struct Parameters_ {
136 
143  size_t num_targets_;
144 
145  Parameters_();
146 
147  void get(DictionaryDatum&) const;
148  void set(const DictionaryDatum&);
149  };
150 
151  // ------------------------------------------------------------
152 
153 
155 
158  std::vector<ulong_t> occ_refractory_;
160  size_t activate_;
161 
162  public:
163  Age_distribution_(size_t num_age_bins, ulong_t ini_occ_ref, ulong_t ini_occ_act);
164  ulong_t update(double_t hazard_rate, librandom::RngPtr rng);
165 
166  };
167 
168 
169 
170  struct Buffers_ {
175  std::vector<Age_distribution_> age_distributions_;
176 
177  };
178 
179  // ------------------------------------------------------------
180 
181  struct Variables_ {
185 
198 
199  };
200 
201  // ------------------------------------------------------------
202 
207  };
208 
209 inline
211 {
212  device_.enforce_single_syn_type(syn_id);
213 
214  if ( dummy_target )
215  {
216  DSSpikeEvent e;
217  e.set_sender(*this);
218  return target.handles_test_event(e, receptor_type);
219  }
220  else
221  {
222  SpikeEvent e;
223  e.set_sender(*this);
224  const port p = target.handles_test_event(e, receptor_type);
225  if ( p != invalid_port_ and not is_model_prototype() )
226  ++P_.num_targets_; // count number of targets
227  return p;
228  }
229 }
230 
231 inline
233 {
234  P_.get(d);
235  device_.get_status(d);
236 }
237 
238 inline
240 {
241  Parameters_ ptmp = P_; // temporary copy in case of errors
242  ptmp.set(d); // throws if BadProperty
243 
244  // We now know that ptmp is consistent. We do not write it back
245  // to P_ before we are also sure that the properties to be set
246  // in the parent class are internally consistent.
247  device_.set_status(d);
248 
249  // if we get here, temporaries contain consistent set of properties
250  P_ = ptmp;
251 }
252 
253 } // namespace
254 
255 #endif //PPD_SUP_GENERATOR_H
librandom::PoissonRandomDev poisson_dev_
random deviate generator
Definition: ppd_sup_generator.h:157
Definition: ppd_sup_generator.h:181
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
void get_status(DictionaryDatum &) const
Definition: ppd_sup_generator.h:232
bool is_model_prototype() const
Returns true if node is model prototype.
Definition: node.h:795
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
Declarations for base class Node.
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: ppd_sup_generator.h:210
"Callback request event" for use in Device.
Definition: event.h:374
Base class for common properties of Stimulating Devices.
Definition: stimulating_device.h:117
double_t frequency_
rate modulation frequency [Hz]
Definition: ppd_sup_generator.h:134
const rport invalid_port_
Value for invalid connection port number.
Definition: nest.h:160
double_t hazard_step_t_
hazard rate at time t in units of time step
Definition: ppd_sup_generator.h:183
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
void init_state_(const Node &)
Private function to initialize the state of a node to model defaults.
Definition: ppd_sup_generator.cpp:171
Definition: ppd_sup_generator.h:170
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
Definition: ppd_sup_generator.h:154
Parameters_()
Sets default parameter values.
Definition: ppd_sup_generator.cpp:99
Variables_ V_
Definition: ppd_sup_generator.h:205
double_t hazard_step_
base hazard rate in units of time step
Definition: ppd_sup_generator.h:182
ulong_t occ_active_
summed occupation number of ages above dead time
Definition: ppd_sup_generator.h:159
Buffers_ B_
Definition: ppd_sup_generator.h:206
size_t activate_
rotating pointer
Definition: ppd_sup_generator.h:160
ulong_t n_proc_
number of component processes
Definition: ppd_sup_generator.h:133
size_t num_targets_
Number of targets.
Definition: ppd_sup_generator.h:143
Definition: nest_time.h:130
void event_hook(DSSpikeEvent &)
Send out spikes.
Definition: ppd_sup_generator.cpp:244
Generator of the spike output of a population of Poisson processes with dead time.
Definition: ppd_sup_generator.h:79
Age_distribution_(size_t num_age_bins, ulong_t ini_occ_ref, ulong_t ini_occ_act)
initialize age dist
Definition: ppd_sup_generator.cpp:40
double_t omega_
angular velocity of rate modulation [rad/ms]
Definition: ppd_sup_generator.h:184
std::vector< Age_distribution_ > age_distributions_
Age distribution of component Poisson processes with dead time of the superposition.
Definition: ppd_sup_generator.h:175
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
librandom::BinomialRandomDev bino_dev_
random deviate generator
Definition: ppd_sup_generator.h:156
ulong_t update(double_t hazard_rate, librandom::RngPtr rng)
update age dist and generate spikes
Definition: ppd_sup_generator.cpp:51
Class PoissonRandomDev Create Poisson distributed random numbers.
Definition: poisson_randomdev.h:103
double_t t_min_active_
start of generator activity in slice
Definition: ppd_sup_generator.h:196
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: ppd_sup_generator.cpp:178
Store independent parameters of the model.
Definition: ppd_sup_generator.h:130
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
std::vector< ulong_t > occ_refractory_
occupation numbers of ages below dead time
Definition: ppd_sup_generator.h:158
StimulatingDevice< CurrentEvent > device_
Definition: ppd_sup_generator.h:203
Parameters_ P_
Definition: ppd_sup_generator.h:204
double double_t
Double precision floating point numbers.
Definition: nest.h:93
void calibrate()
Re-calculate dependent parameters of the node.
Definition: ppd_sup_generator.cpp:183
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
void set_status(const DictionaryDatum &)
Definition: ppd_sup_generator.h:239
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: ppd_sup_generator.cpp:112
bool has_proxies() const
Returns true if the node has proxies on remote threads.
Definition: ppd_sup_generator.h:87
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
bool is_off_grid() const
Returns true if the node if it sends/receives -grid events This is used to discriminate between diffe...
Definition: ppd_sup_generator.h:88
Default types used by the NEST kernel.
void update(Time const &, const long_t, const long_t)
Update state.
Definition: ppd_sup_generator.cpp:214
Event for spike information.
Definition: event.h:320
double_t amplitude_
rate modulation amplitude [Hz]
Definition: ppd_sup_generator.h:135
Base class for all NEST network objects.
Definition: node.h:96
ppd_sup_generator()
Definition: ppd_sup_generator.cpp:154
Class BinomialRNG.
Definition: binomial_randomdev.h:85
double_t dead_time_
dead time [ms]
Definition: ppd_sup_generator.h:132
double_t t_max_active_
end of generator activity in slice
Definition: ppd_sup_generator.h:197
virtual void event_hook(DSSpikeEvent &)
Modify Event object parameters during event delivery.
Definition: node.cpp:301
const Name p("p")
current release probability (Tsodyks2_connection)
Definition: nest_names.h:218
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: ppd_sup_generator.cpp:122
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
double_t rate_
process rate [Hz]
Definition: ppd_sup_generator.h:131
unsigned long ulong_t
Unsigned long_t.
Definition: nest.h:98