NEST  2.6.0,not_revisioned_source_dir@0
gamma_sup_generator.h
Go to the documentation of this file.
1 /*
2  * gamma_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 GAMMA_SUP_GENERATOR_H
24 #define GAMMA_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: gamma_sup_generator - simulate the superimposed spike train of a population of gamma process.
38 Description:
39 
40  The gamma_sup_generator generator simulates the pooled spike train of a
41  population of neurons firing independently with gamma process statistics.
42 
43 Parameters:
44  The following parameters appear in the element's status dictionary:
45 
46  rate - mean firing rate of the component processes. (double, var)
47  gamma_shape - shape paramter of component gamma processes. (long, var)
48  n_proc - number of superimposed independent component processes. (long, var)
49 
50 Note:
51  The generator has been published in Deger, Helias, Boucsein, Rotter (2011)
52  Statistical properties of superimposed stationary spike trains,
53  Journal of Computational Neuroscience.
54  URL: http://www.springerlink.com/content/u75211r381p08301/
55  DOI: 10.1007/s10827-011-0362-8
56 
57 Author:
58  Jan 2011, Moritz Deger
59 
60 SeeAlso: ppd_sup_generator, poisson_generator_ps, spike_generator, Device, StimulatingDevice
61 */
62 
63 namespace nest{
64 
74  class gamma_sup_generator: public Node
75  {
76 
77  public:
78 
81 
82  bool has_proxies() const {return false;}
83  bool is_off_grid() const {return false;} // does not use off_grid events
84 
85  using Node::event_hook;
86 
88 
89  void get_status(DictionaryDatum &) const;
90  void set_status(const DictionaryDatum &);
91 
92  private:
93  void init_state_(const Node&);
94  void init_buffers_();
95  void calibrate();
96 
106  void update(Time const &, const long_t, const long_t);
107 
113  void event_hook(DSSpikeEvent&);
114 
115  // ------------------------------------------------------------
116 
120  struct Parameters_ {
124 
131  size_t num_targets_;
132 
133  Parameters_();
134 
135  void get(DictionaryDatum&) const;
136  void set(const DictionaryDatum&);
137  };
138 
139  // ------------------------------------------------------------
140 
142 
145  std::vector<ulong_t> occ_;
146 
147  public:
148  Internal_states_(size_t num_bins, ulong_t ini_occ_ref, ulong_t ini_occ_act);
149  ulong_t update(double_t transition_prob, librandom::RngPtr rng);
150 
151  };
152 
153 
154  struct Buffers_ {
159  std::vector<Internal_states_> internal_states_;
160 
161  };
162 
163  // ------------------------------------------------------------
164 
165  struct Variables_ {
167 
180 
181  };
182 
183  // ------------------------------------------------------------
184 
189  };
190 
191 inline
193 {
194  device_.enforce_single_syn_type(syn_id);
195 
196  if ( dummy_target )
197  {
198  DSSpikeEvent e;
199  e.set_sender(*this);
200  return target.handles_test_event(e, receptor_type);
201  }
202  else
203  {
204  SpikeEvent e;
205  e.set_sender(*this);
206  const port p = target.handles_test_event(e, receptor_type);
207 
208  if (p != invalid_port_)
209  ++P_.num_targets_; // count number of targets
210  return p;
211  }
212 }
213 
214 inline
216 {
217  P_.get(d);
218  device_.get_status(d);
219 }
220 
221 inline
223 {
224  Parameters_ ptmp = P_; // temporary copy in case of errors
225  ptmp.set(d); // throws if BadProperty
226 
227  // We now know that ptmp is consistent. We do not write it back
228  // to P_ before we are also sure that the properties to be set
229  // in the parent class are internally consistent.
230  device_.set_status(d);
231 
232  // if we get here, temporaries contain consistent set of properties
233  P_ = ptmp;
234 }
235 
236 } // namespace
237 
238 #endif
double_t rate_
rate of component gamma process [Hz]
Definition: gamma_sup_generator.h:121
bool is_off_grid() const
Returns true if the node if it sends/receives -grid events This is used to discriminate between diffe...
Definition: gamma_sup_generator.h:83
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
void event_hook(DSSpikeEvent &)
Send out spikes.
Definition: gamma_sup_generator.cpp:224
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
Declarations for base class Node.
ulong_t gamma_shape_
gamma shape parameter [1]
Definition: gamma_sup_generator.h:122
Internal_states_(size_t num_bins, ulong_t ini_occ_ref, ulong_t ini_occ_act)
initialize occupation numbers
Definition: gamma_sup_generator.cpp:38
"Callback request event" for use in Device.
Definition: event.h:374
Base class for common properties of Stimulating Devices.
Definition: stimulating_device.h:117
const rport invalid_port_
Value for invalid connection port number.
Definition: nest.h:160
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: gamma_sup_generator.cpp:173
Definition: gamma_sup_generator.h:154
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: gamma_sup_generator.cpp:126
std::vector< Internal_states_ > internal_states_
Occupation numbers of the internal states of the generator.
Definition: gamma_sup_generator.h:159
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
ulong_t update(double_t transition_prob, librandom::RngPtr rng)
update age dist and generate spikes
Definition: gamma_sup_generator.cpp:48
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: gamma_sup_generator.cpp:119
void init_state_(const Node &)
Private function to initialize the state of a node to model defaults.
Definition: gamma_sup_generator.cpp:166
librandom::PoissonRandomDev poisson_dev_
random deviate generator
Definition: gamma_sup_generator.h:144
Definition: gamma_sup_generator.h:165
void get_status(DictionaryDatum &) const
Definition: gamma_sup_generator.h:215
void set_status(const DictionaryDatum &)
Definition: gamma_sup_generator.h:222
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
Variables_ V_
Definition: gamma_sup_generator.h:187
gamma_sup_generator()
Definition: gamma_sup_generator.cpp:149
StimulatingDevice< CurrentEvent > device_
Definition: gamma_sup_generator.h:185
void update(Time const &, const long_t, const long_t)
Update state.
Definition: gamma_sup_generator.cpp:203
double_t t_max_active_
end of generator activity in slice
Definition: gamma_sup_generator.h:179
std::vector< ulong_t > occ_
occupation numbers of internal states
Definition: gamma_sup_generator.h:145
Definition: nest_time.h:130
double_t transition_prob_
transition probabililty to go to next internal state
Definition: gamma_sup_generator.h:166
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
Class PoissonRandomDev Create Poisson distributed random numbers.
Definition: poisson_randomdev.h:103
Buffers_ B_
Definition: gamma_sup_generator.h:188
ulong_t n_proc_
number of component processes
Definition: gamma_sup_generator.h:123
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
double double_t
Double precision floating point numbers.
Definition: nest.h:93
size_t num_targets_
Number of targets.
Definition: gamma_sup_generator.h:131
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
Definition: gamma_sup_generator.h:141
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
Store independent parameters of the model.
Definition: gamma_sup_generator.h:120
Default types used by the NEST kernel.
Event for spike information.
Definition: event.h:320
Base class for all NEST network objects.
Definition: node.h:96
Class BinomialRNG.
Definition: binomial_randomdev.h:85
Generator of the spike output of a population of gamma processes with integer shape parameter...
Definition: gamma_sup_generator.h:74
Parameters_ P_
Definition: gamma_sup_generator.h:186
double_t t_min_active_
start of generator activity in slice
Definition: gamma_sup_generator.h:178
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
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: gamma_sup_generator.h:192
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
Parameters_()
Sets default parameter values.
Definition: gamma_sup_generator.cpp:108
void calibrate()
Re-calculate dependent parameters of the node.
Definition: gamma_sup_generator.cpp:178
bool has_proxies() const
Returns true if the node has proxies on remote threads.
Definition: gamma_sup_generator.h:82
librandom::BinomialRandomDev bino_dev_
random deviate generator
Definition: gamma_sup_generator.h:143
unsigned long ulong_t
Unsigned long_t.
Definition: nest.h:98