NEST main@caf0ae8
 
Loading...
Searching...
No Matches
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// C++ includes:
27#include <vector>
28
29// Includes from nestkernel:
30#include "connection.h"
31#include "device_node.h"
32#include "event.h"
33#include "nest_types.h"
34#include "random_generators.h"
35#include "stimulation_device.h"
36
37namespace nest
38{
39
40/* BeginUserDocs: device, generator
41
42Short description
43+++++++++++++++++
44
45Simulate the superimposed spike train of a population of Poisson
46processes with dead time
47
48Description
49+++++++++++
50
51The ``ppd_sup_generator`` generator simulates the pooled spike train of a
52population of neurons firing independently with Poisson process with dead
53time statistics.
54The rate parameter can also be sine-modulated. The generator does not
55initialize to equilibrium in this case, initial transients might occur.
56
57.. include:: ../models/stimulation_device.rst
58
59rate
60 Mean firing rate of the component processes, default: 0 spikes/s
61
62dead_time
63 Minimal time between two spikes of the component processes, default: 0 ms
64
65n_proc
66 Number of superimposed independent component processes, default: 1
67
68frequency
69 Rate modulation frequency, default: 0 Hz
70
71relative_amplitude
72 Relative rate modulation amplitude, default: 0
73
74See also :footcite:p:`Deger2011`.
75
76Set parameters from a stimulation backend
77~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78
79The parameters in this stimulation device can be updated with input
80coming from a stimulation backend. The data structure used for the
81update holds one value for each of the parameters mentioned above.
82The indexing is as follows:
83
84 0. dead_time
85 1. rate
86 2. n_proc
87 3. frequency
88 4. relative_amplitude
89
90References
91++++++++++
92
93.. footbibliography::
94
95See also
96++++++++
97
98gamma_sup_generator, poisson_generator_ps, spike_generator
99
100Examples using this model
101+++++++++++++++++++++++++
102
103.. listexamples:: ppd_sup_generator
104
105EndUserDocs */
106
107void register_ppd_sup_generator( const std::string& name );
108
110{
111
112public:
115
116 bool is_off_grid() const override;
117
123 using Node::event_hook;
124
125 size_t send_test_event( Node&, size_t, synindex, bool ) override;
126
127 void get_status( Dictionary& ) const override;
128 void set_status( const Dictionary& ) override;
129
130 StimulationDevice::Type get_type() const override;
131 void set_data_from_stimulation_backend( std::vector< double >& input_param ) override;
132
133private:
134 void init_state_() override;
135 void init_buffers_() override;
136 void pre_run_hook() override;
137
147 void update( Time const&, const long, const long ) override;
148
154 void event_hook( DSSpikeEvent& ) override;
155
156 // ------------------------------------------------------------
157
162 {
163 double rate_;
164 double dead_time_;
165 unsigned long n_proc_;
166 double frequency_;
167 double amplitude_;
168
176
177 Parameters_();
178
179 void get( Dictionary& ) const;
180 void set( const Dictionary&, Node* node );
181 };
182
183 // ------------------------------------------------------------
184
185
187 {
190 std::vector< unsigned long > occ_refractory_;
191 unsigned long occ_active_;
192 size_t activate_;
193
194 public:
196 Age_distribution_( size_t num_age_bins, unsigned long ini_occ_ref, unsigned long ini_occ_act );
197
199 unsigned long update( double hazard_rate, RngPtr rng );
200 };
201
202
203 struct Buffers_
204 {
210 std::vector< Age_distribution_ > age_distributions_;
211 };
212
213 // ------------------------------------------------------------
214
216 {
219 double omega_;
220
234 };
235
236 // ------------------------------------------------------------
237
241};
242
243inline size_t
244ppd_sup_generator::send_test_event( Node& target, size_t receptor_type, synindex syn_id, bool dummy_target )
245{
247
248 if ( dummy_target )
249 {
250 DSSpikeEvent e;
251 e.set_sender( *this );
252 return target.handles_test_event( e, receptor_type );
253 }
254 else
255 {
256 SpikeEvent e;
257 e.set_sender( *this );
258 const size_t p = target.handles_test_event( e, receptor_type );
259 if ( p != invalid_port and not is_model_prototype() )
260 {
261 ++P_.num_targets_; // count number of targets
262 }
263 return p;
264 }
265}
266
267inline void
273
274inline void
276{
277 Parameters_ ptmp = P_; // temporary copy in case of errors
278 ptmp.set( d, this ); // throws if BadProperty
279
280 // We now know that ptmp is consistent. We do not write it back
281 // to P_ before we are also sure that the properties to be set
282 // in the parent class are internally consistent.
284
285 // if we get here, temporaries contain consistent set of properties
286 P_ = ptmp;
287}
288
289inline bool
291{
292 return false;
293}
294
300
301} // namespace
302
303#endif // PPD_SUP_GENERATOR_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Base class for RNG engine wrappers.
Definition random_generators.h:67
"Callback request event" for use in Device.
Definition event.h:521
Base class for all NEST network objects.
Definition node.h:99
virtual void event_hook(DSSpikeEvent &)
Modify Event object parameters during event delivery.
Definition node.cpp:586
bool is_model_prototype() const
Returns true if node is model prototype.
Definition node.h:1226
Event for spike information.
Definition event.h:418
Base class for common properties of StimulationDevices.
Definition stimulation_device.h:154
void enforce_single_syn_type(synindex)
Throws IllegalConnection if synapse id differs from initial synapse id.
Definition stimulation_device.cpp:62
Type
Device type.
Definition stimulation_device.h:187
@ SPIKE_GENERATOR
Definition stimulation_device.h:189
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition stimulation_device.cpp:125
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition stimulation_device.cpp:168
Definition nest_time.h:135
Definition ppd_sup_generator.h:187
unsigned long update(double hazard_rate, RngPtr rng)
update age dist and generate spikes
Definition ppd_sup_generator.cpp:64
std::vector< unsigned long > occ_refractory_
occupation numbers of ages below dead time
Definition ppd_sup_generator.h:190
size_t activate_
rotating pointer
Definition ppd_sup_generator.h:192
poisson_distribution poisson_dist_
poisson distribution
Definition ppd_sup_generator.h:189
unsigned long occ_active_
summed occupation number of ages above dead time
Definition ppd_sup_generator.h:191
binomial_distribution bino_dist_
binomial distribution
Definition ppd_sup_generator.h:188
Definition ppd_sup_generator.h:110
void set_data_from_stimulation_backend(std::vector< double > &input_param) override
Definition ppd_sup_generator.cpp:295
Variables_ V_
Definition ppd_sup_generator.h:239
Parameters_ P_
Definition ppd_sup_generator.h:238
StimulationDevice::Type get_type() const override
Definition ppd_sup_generator.h:296
Buffers_ B_
Definition ppd_sup_generator.h:240
bool is_off_grid() const override
Returns true if the node sends/receives off-grid events.
Definition ppd_sup_generator.h:290
void event_hook(DSSpikeEvent &) override
Send out spikes.
Definition ppd_sup_generator.cpp:270
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition ppd_sup_generator.h:244
void init_buffers_() override
Configure persistent internal data structures.
Definition ppd_sup_generator.cpp:199
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition ppd_sup_generator.h:268
ppd_sup_generator()
Definition ppd_sup_generator.cpp:175
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition ppd_sup_generator.cpp:205
void init_state_() override
Configure state variables depending on runtime information.
Definition ppd_sup_generator.cpp:193
void update(Time const &, const long, const long) override
Update state.
Definition ppd_sup_generator.cpp:236
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition ppd_sup_generator.h:275
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_ppd_sup_generator(const std::string &name)
Definition ppd_sup_generator.cpp:41
constexpr size_t invalid_port
Value for invalid connection port number.
Definition nest_types.h:141
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Definition ppd_sup_generator.h:204
std::vector< Age_distribution_ > age_distributions_
Age distribution of component Poisson processes with dead time of the superposition.
Definition ppd_sup_generator.h:210
Store independent parameters of the model.
Definition ppd_sup_generator.h:162
Parameters_()
Sets default parameter values.
Definition ppd_sup_generator.cpp:111
double amplitude_
rate modulation amplitude [Hz]
Definition ppd_sup_generator.h:167
double rate_
process rate [Hz]
Definition ppd_sup_generator.h:163
double frequency_
rate modulation frequency [Hz]
Definition ppd_sup_generator.h:166
void get(Dictionary &) const
Store current values in dictionary.
Definition ppd_sup_generator.cpp:126
double dead_time_
dead time [ms]
Definition ppd_sup_generator.h:164
unsigned long n_proc_
number of component processes
Definition ppd_sup_generator.h:165
void set(const Dictionary &, Node *node)
Set values from dictionary.
Definition ppd_sup_generator.cpp:136
size_t num_targets_
Number of targets.
Definition ppd_sup_generator.h:175
Definition ppd_sup_generator.h:216
double hazard_step_
base hazard rate in units of time step
Definition ppd_sup_generator.h:217
double t_min_active_
start of generator activity in slice
Definition ppd_sup_generator.h:231
double omega_
angular velocity of rate modulation [rad/ms]
Definition ppd_sup_generator.h:219
double hazard_step_t_
hazard rate at time t in units of time step
Definition ppd_sup_generator.h:218
double t_max_active_
end of generator activity in slice
Definition ppd_sup_generator.h:232