NEST main@caf0ae8
 
Loading...
Searching...
No Matches
poisson_generator.h
Go to the documentation of this file.
1/*
2 * poisson_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 POISSON_GENERATOR_H
24#define POISSON_GENERATOR_H
25
26// Includes from nestkernel:
27#include "connection.h"
28#include "device_node.h"
29#include "event.h"
30#include "nest_types.h"
31#include "random_generators.h"
32#include "stimulation_device.h"
33
34namespace nest
35{
36
37/* BeginUserDocs: device, generator
38
39Short description
40+++++++++++++++++
41
42Generate spikes with Poisson process statistics
43
44Description
45+++++++++++
46
47The ``poisson_generator`` simulates a neuron that is firing with Poisson
48statistics, that is, exponentially distributed interspike intervals. It will
49generate a `unique` spike train for each of its targets. If you do not want
50this behavior and need the same spike train for all targets, you have to use a
51``parrot_neuron`` between the poisson generator and the targets.
52
53.. include:: ../models/stimulation_device.rst
54
55rate
56 Mean firing rate (spikes/s)
57
58Set parameters from a stimulation backend
59~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60
61The parameters in this stimulation device can be updated with input
62coming from a stimulation backend. The data structure used for the
63update holds one value for each of the parameters mentioned above.
64The indexing is as follows:
65
66 0. rate
67
68Sends
69+++++
70
71SpikeEvent
72
73See also
74++++++++
75
76poisson_generator_ps
77
78Examples using this model
79+++++++++++++++++++++++++
80
81.. listexamples:: poisson_generator
82
83EndUserDocs */
84
85void register_poisson_generator( const std::string& name );
86
88{
89
90public:
97
103 using Node::event_hook;
104
105 size_t send_test_event( Node&, size_t, synindex, bool ) override;
106
107 void get_status( Dictionary& ) const override;
108 void set_status( const Dictionary& ) override;
109
110 StimulationDevice::Type get_type() const override;
111 void set_data_from_stimulation_backend( std::vector< double >& input_param ) override;
112
113private:
114 void init_state_() override;
115 void init_buffers_() override;
116 void pre_run_hook() override;
117
118 void update( Time const&, const long, const long ) override;
119 void event_hook( DSSpikeEvent& ) override;
120
121 // ------------------------------------------------------------
122
127 {
128 double rate_;
129
130 Parameters_();
131
132 void get( Dictionary& ) const;
133 void set( const Dictionary&, Node* node );
134 };
135
136 // ------------------------------------------------------------
137
142
143 // ------------------------------------------------------------
144
147};
148
149inline size_t
150poisson_generator::send_test_event( Node& target, size_t receptor_type, synindex syn_id, bool dummy_target )
151{
153
154 if ( dummy_target )
155 {
156 DSSpikeEvent e;
157 e.set_sender( *this );
158 return target.handles_test_event( e, receptor_type );
159 }
160 else
161 {
162 SpikeEvent e;
163 e.set_sender( *this );
164 return target.handles_test_event( e, receptor_type );
165 }
166}
167
168inline void
174
175inline void
177{
178 Parameters_ ptmp = P_; // temporary copy in case of errors
179 ptmp.set( d, this ); // throws if BadProperty
180
181 // We now know that ptmp is consistent. We do not write it back
182 // to P_ before we are also sure that the properties to be set
183 // in the parent class are internally consistent.
185
186 // if we get here, temporaries contain consistent set of properties
187 P_ = ptmp;
188}
189
195
196} // namespace nest
197
198#endif
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
"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 poisson_generator.h:88
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition poisson_generator.cpp:108
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition poisson_generator.h:176
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition poisson_generator.cpp:123
void init_buffers_() override
Configure persistent internal data structures.
Definition poisson_generator.cpp:102
StimulationDevice::Type get_type() const override
Definition poisson_generator.h:191
poisson_generator()
The generator is threaded, so the RNG to use is determined at run-time, depending on thread.
Definition poisson_generator.cpp:78
void init_state_() override
Configure state variables depending on runtime information.
Definition poisson_generator.cpp:96
Parameters_ P_
Definition poisson_generator.h:145
Variables_ V_
Definition poisson_generator.h:146
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition poisson_generator.h:150
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition poisson_generator.h:169
void set_data_from_stimulation_backend(std::vector< double > &input_param) override
Definition poisson_generator.cpp:159
void event_hook(DSSpikeEvent &) override
Modify Event object parameters during event delivery.
Definition poisson_generator.cpp:143
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_poisson_generator(const std::string &name)
Definition poisson_generator.cpp:38
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Store independent parameters of the model.
Definition poisson_generator.h:127
void set(const Dictionary &, Node *node)
Set values from dictionary.
Definition poisson_generator.cpp:64
void get(Dictionary &) const
Store current values in dictionary.
Definition poisson_generator.cpp:58
Parameters_()
Sets default parameter values.
Definition poisson_generator.cpp:47
double rate_
process rate in Hz
Definition poisson_generator.h:128
Definition poisson_generator.h:139
poisson_distribution poisson_dist_
poisson distribution
Definition poisson_generator.h:140