NEST main@caf0ae8
 
Loading...
Searching...
No Matches
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// 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 gamma processes
46
47Description
48+++++++++++
49
50The ``gamma_sup_generator`` generator simulates the pooled spike train of a
51population of neurons firing independently with gamma process statistics.
52
53.. include:: ../models/stimulation_device.rst
54
55rate
56 Mean firing rate of the component processes, default: 0 spikes/s
57
58gamma_shape
59 Shape parameter of component gamma processes, default: 1
60
61n_proc
62 Number of superimposed independent component processes, default: 1
63
64
65See also :footcite:p:`Deger2011`.
66
67Set parameters from a stimulation backend
68~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
70The parameters in this stimulation device can be updated with input
71coming from a stimulation backend. The data structure used for the
72update holds one value for each of the parameters mentioned above.
73The indexing is as follows:
74
75 0. rate
76 1. gamma_shape
77 2. n_proc
78
79References
80++++++++++
81
82.. footbibliography::
83
84See also
85++++++++
86
87ppd_sup_generator, poisson_generator_ps, spike_generator
88
89Examples using this model
90+++++++++++++++++++++++++
91
92.. listexamples:: gamma_sup_generator
93
94EndUserDocs */
95
96void register_gamma_sup_generator( const std::string& name );
97
99{
100
101public:
104
105 bool is_off_grid() const override;
106
107 using Node::event_hook;
108
109 size_t send_test_event( Node&, size_t, synindex, bool ) override;
110
111 void get_status( Dictionary& ) const override;
112 void set_status( const Dictionary& ) override;
113
114 StimulationDevice::Type get_type() const override;
115 void set_data_from_stimulation_backend( std::vector< double >& input_param ) override;
116
117private:
118 void init_state_() override;
119 void init_buffers_() override;
120 void pre_run_hook() override;
121
131 void update( Time const&, const long, const long ) override;
132
138 void event_hook( DSSpikeEvent& ) override;
139
140 // ------------------------------------------------------------
141
146 {
147 double rate_;
149 long n_proc_;
150
158
159 Parameters_();
160
161 void get( Dictionary& ) const;
162 void set( const Dictionary&, Node* node );
163 };
164
165 // ------------------------------------------------------------
166
168 {
171 std::vector< unsigned long > occ_;
172
173 public:
174 Internal_states_( size_t num_bins,
175 unsigned long ini_occ_ref,
176 unsigned long ini_occ_act );
177 unsigned long update( double transition_prob, RngPtr rng );
178 };
179
180
181 struct Buffers_
182 {
187 std::vector< Internal_states_ > internal_states_;
188 };
189
190 // ------------------------------------------------------------
191
193 {
196
210 };
211
212 // ------------------------------------------------------------
213
217};
218
219inline size_t
220gamma_sup_generator::send_test_event( Node& target, size_t receptor_type, synindex syn_id, bool dummy_target )
221{
223
224 if ( dummy_target )
225 {
226 DSSpikeEvent e;
227 e.set_sender( *this );
228 return target.handles_test_event( e, receptor_type );
229 }
230 else
231 {
232 SpikeEvent e;
233 e.set_sender( *this );
234 const size_t p = target.handles_test_event( e, receptor_type );
235 if ( p != invalid_port )
236 {
237 // count number of targets
239 }
240 return p;
241 }
242}
243
244inline void
250
251inline void
253{
254 Parameters_ ptmp = P_; // temporary copy in case of errors
255 ptmp.set( d, this ); // throws if BadProperty
256
257 // We now know that ptmp is consistent. We do not write it back
258 // to P_ before we are also sure that the properties to be set
259 // in the parent class are internally consistent.
261
262 // if we get here, temporaries contain consistent set of properties
263 P_ = ptmp;
264}
265
266inline bool
268{
269 return false;
270}
271
277
278} // namespace
279
280#endif
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
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 gamma_sup_generator.h:168
std::vector< unsigned long > occ_
occupation numbers of internal states
Definition gamma_sup_generator.h:171
binomial_distribution bino_dist_
binomial distribution
Definition gamma_sup_generator.h:169
unsigned long update(double transition_prob, RngPtr rng)
update age dist and generate spikes
Definition gamma_sup_generator.cpp:63
poisson_distribution poisson_dist_
poisson distribution
Definition gamma_sup_generator.h:170
Definition gamma_sup_generator.h:99
StimulationDevice::Type get_type() const override
Definition gamma_sup_generator.h:273
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition gamma_sup_generator.h:252
bool is_off_grid() const override
Returns true if the node sends/receives off-grid events.
Definition gamma_sup_generator.h:267
Variables_ V_
Definition gamma_sup_generator.h:215
Buffers_ B_
Definition gamma_sup_generator.h:216
void event_hook(DSSpikeEvent &) override
Send out spikes.
Definition gamma_sup_generator.cpp:253
void init_state_() override
Configure state variables depending on runtime information.
Definition gamma_sup_generator.cpp:193
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition gamma_sup_generator.h:245
void update(Time const &, const long, const long) override
Update state.
Definition gamma_sup_generator.cpp:230
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition gamma_sup_generator.cpp:205
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition gamma_sup_generator.h:220
gamma_sup_generator()
Definition gamma_sup_generator.cpp:175
Parameters_ P_
Definition gamma_sup_generator.h:214
void init_buffers_() override
Configure persistent internal data structures.
Definition gamma_sup_generator.cpp:199
void set_data_from_stimulation_backend(std::vector< double > &input_param) override
Definition gamma_sup_generator.cpp:277
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_gamma_sup_generator(const std::string &name)
Definition gamma_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 gamma_sup_generator.h:182
std::vector< Internal_states_ > internal_states_
Occupation numbers of the internal states of the generator.
Definition gamma_sup_generator.h:187
Store independent parameters of the model.
Definition gamma_sup_generator.h:146
long gamma_shape_
gamma shape parameter [1]
Definition gamma_sup_generator.h:148
Parameters_()
Sets default parameter values.
Definition gamma_sup_generator.cpp:128
long n_proc_
number of component processes
Definition gamma_sup_generator.h:149
double rate_
rate of component gamma process [Hz]
Definition gamma_sup_generator.h:147
void set(const Dictionary &, Node *node)
Set values from dictionary.
Definition gamma_sup_generator.cpp:149
size_t num_targets_
Number of targets.
Definition gamma_sup_generator.h:157
void get(Dictionary &) const
Store current values in dictionary.
Definition gamma_sup_generator.cpp:141
Definition gamma_sup_generator.h:193
double transition_prob_
transition probabililty to go to next internal state
Definition gamma_sup_generator.h:194
double t_min_active_
start of generator activity in slice
Definition gamma_sup_generator.h:207
double t_max_active_
end of generator activity in slice
Definition gamma_sup_generator.h:208