NEST main@caf0ae8
 
Loading...
Searching...
No Matches
pulsepacket_generator.h
Go to the documentation of this file.
1/*
2 * pulsepacket_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 PULSEPACKET_GENERATOR_H
24#define PULSEPACKET_GENERATOR_H
25
26// C++ includes:
27#include <deque>
28#include <vector>
29
30// Includes from nestkernel:
31#include "connection.h"
32#include "event.h"
33#include "nest_types.h"
34#include "node.h"
35#include "random_generators.h"
36#include "stimulation_device.h"
37
38namespace nest
39{
40
41/* BeginUserDocs: device, generator
42
43Short description
44+++++++++++++++++
45
46Generate sequence of Gaussian pulse packets
47
48Description
49+++++++++++
50
51The ``pulsepacket_generator`` produces a spike train contains Gaussian pulse
52packets centered about given times. A Gaussian pulse packet is a given
53number of spikes with normal distributed random displacements from the center
54time of the pulse. It resembles the output of synfire groups of neurons.
55
56- All targets receive identical spike trains.
57- New pulse packets are generated when activity or ``sdev`` are changed.
58- Gaussian pulse are independently generated for each given
59 pulse-center time.
60- Both standard deviation and number of spikes may be set at any time.
61 Pulses are then re-generated with the new values.
62
63.. include:: ../models/stimulation_device.rst
64
65pulse_times
66 List of times of the centers of pulses in ms.
67
68activity
69 Number of spikes per pulse. Default: ``0``.
70
71sdev
72 Standard deviation of spike times in each pulse in ms. Default: ``0.0``.
73
74Setting parameters from a stimulation backend
75~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76
77The parameters in this stimulation device can be updated with input
78coming from a stimulation backend. The data structure used for the
79update holds one value for each of the parameters mentioned above.
80The indexing is as follows:
81
82 0. activity
83 1. sdev
84 2. pulse_times
85
86Sends
87+++++
88
89SpikeEvent
90
91See also
92++++++++
93
94spike_generator
95
96Examples using this model
97+++++++++++++++++++++++++
98
99.. listexamples:: pulsepacket_generator
100
101EndUserDocs */
102
103void register_pulsepacket_generator( const std::string& name );
104
106{
107
108public:
111
112 // behaves like normal node, since it must provide identical
113 // output to all targets
114
115 size_t send_test_event( Node&, size_t, synindex, bool ) override;
116
117 void get_status( Dictionary& ) const override;
118 void set_status( const Dictionary& ) override;
119
120 StimulationDevice::Type get_type() const override;
121 void set_data_from_stimulation_backend( std::vector< double >& input_param ) override;
122
123private:
124 void init_state_() override;
125 void init_buffers_() override;
126 void pre_run_hook() override;
127
128 void update( Time const&, const long, const long ) override;
129
130 struct Buffers_;
131
132 // ------------------------------------------------------------
133
135 {
136 std::vector< double > pulse_times_;
137 long a_;
138 double sdev_;
139
141
142 Parameters_();
143
144 void get( Dictionary& ) const;
145
151 void set( const Dictionary&, pulsepacket_generator&, Node* );
152 };
153
154 // ------------------------------------------------------------
155
156 struct Buffers_
157 {
158 std::deque< long > spiketimes_;
159 };
160
161 // ------------------------------------------------------------
162
181
182 // ------------------------------------------------------------
183
187};
188
189inline size_t
190pulsepacket_generator::send_test_event( Node& target, size_t receptor_type, synindex syn_id, bool )
191{
193
194 SpikeEvent e;
195 e.set_sender( *this );
196
197 return target.handles_test_event( e, receptor_type );
198}
199
200inline void
206
207inline void
209{
210 Parameters_ ptmp = P_; // temporary copy in case of errors
211 ptmp.set( d, *this, this ); // throws if BadProperty
212
213 // We now know that ptmp is consistent. We do not write it back
214 // to P_ before we are also sure that the properties to be set
215 // in the parent class are internally consistent.
217
218 // if we get here, temporaries contain consistent set of properties
219 P_ = ptmp;
220}
221
227
228} // namespace nest
229
230#endif
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Base class for all NEST network objects.
Definition node.h:99
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
@ CURRENT_GENERATOR
Definition stimulation_device.h:188
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 pulsepacket_generator.h:106
void init_buffers_() override
Configure persistent internal data structures.
Definition pulsepacket_generator.cpp:129
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition pulsepacket_generator.cpp:135
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition pulsepacket_generator.h:190
StimulationDevice::Type get_type() const override
Definition pulsepacket_generator.h:223
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition pulsepacket_generator.h:208
Buffers_ B_
Definition pulsepacket_generator.h:185
void set_data_from_stimulation_backend(std::vector< double > &input_param) override
Definition pulsepacket_generator.cpp:238
pulsepacket_generator()
Definition pulsepacket_generator.cpp:106
void init_state_() override
Configure state variables depending on runtime information.
Definition pulsepacket_generator.cpp:123
Parameters_ P_
Definition pulsepacket_generator.h:184
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition pulsepacket_generator.h:201
Variables_ V_
Definition pulsepacket_generator.h:186
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition pulsepacket_generator.cpp:170
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_pulsepacket_generator(const std::string &name)
Definition pulsepacket_generator.cpp:42
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Declarations for base class Node.
Definition pulsepacket_generator.h:157
std::deque< long > spiketimes_
Definition pulsepacket_generator.h:158
Definition pulsepacket_generator.h:135
double sdev_
standard deviation of the packet
Definition pulsepacket_generator.h:138
Parameters_()
Sets default parameter values.
Definition pulsepacket_generator.cpp:51
std::vector< double > pulse_times_
times of pulses
Definition pulsepacket_generator.h:136
double sdev_tolerance_
Definition pulsepacket_generator.h:140
void set(const Dictionary &, pulsepacket_generator &, Node *)
Set values from dictionary.
Definition pulsepacket_generator.cpp:79
void get(Dictionary &) const
Store current values in dictionary.
Definition pulsepacket_generator.cpp:71
long a_
number of pulses in a packet
Definition pulsepacket_generator.h:137
Definition pulsepacket_generator.h:164
size_t stop_center_idx_
Definition pulsepacket_generator.h:176
double tolerance
Definition pulsepacket_generator.h:177
Variables_()
Definition pulsepacket_generator.cpp:59
normal_distribution normal_dist_
normal distribution
Definition pulsepacket_generator.h:165
size_t start_center_idx_
Indices into sorted vector of sorted pulse-center times (P_.pulse_times_).
Definition pulsepacket_generator.h:175