NEST main@caf0ae8
 
Loading...
Searching...
No Matches
stimulation_device.h
Go to the documentation of this file.
1/*
2 * stimulation_device.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 STIMULATION_DEVICE_H
24#define STIMULATION_DEVICE_H
25
26// Includes from nestkernel:
27#include "device.h"
28#include "device_node.h"
29#include "nest_types.h"
30
31// Includes from libnestutil:
32#include "compose.hpp"
33
34// From standard library:
35#include <string>
36
37namespace nest
38{
39
40/* BeginUserDocs: NOINDEX
41
42Short description
43+++++++++++++++++
44
45Stimulation device
46
47Description
48+++++++++++
49
50All stimulation devices share the parameters ``start`` and ``stop``,
51which control the stimulation period. The property ``origin`` is a
52global offset that shifts the stimulation period. All three values are
53set as times in ms.
54
55- For spike-emitting devices, only spikes with times `t` that fulfill
56 :math:`\mathrm{start} < t \leq \mathrm{stop}` are emitted. Spikes
57 that have timestamp of :math:`t = \mathrm{start}` are not emitted.
58
59- For current-emitting devices, the current is activated and
60 deactivated such that the current first affects the target dynamics
61 during the update step :math:`(\mathrm{start}, \mathrm{start}+h]`,
62 that is, an effect can be recorded at the earliest at time
63 :math:`\mathrm{start}+h`. The last interval during which the current
64 affects the target's dynamics is :math:`(\textrm{stop}-h, \textrm{stop}]`.
65
66The property ``stimulus_source`` defaults to an empty string. It can
67be set to the name of a stimulation backend, in which case it will
68take its parameters from the configured backend instead of from the
69internally stored values. More details on available backends and their
70properties can be found in the :ref:`guide to stimulating the network
71<sec_stimulation_backends>`.
72
73Parameters
74++++++++++
75
76label
77 A string specifying an arbitrary textual label for the device.
78 Stimulation backends might use the label to generate device specific
79 identifiers like filenames and such. Default: ``""``.
80
81origin
82 A positive floating point number used as the reference time in ms
83 for ``start`` and ``stop``. Default: ``0.0``.
84
85start
86 A positive floating point number specifying the activation time in ms,
87 relative to ``origin``. Default: ``0.0``.
88
89stimulus_source
90 A string specifying the name of the stimulation backend from which to
91 get the data for updating the stimulus parameters of the device.
92 By default, the device uses its internally stored parameters for updating
93 the stimulus. Default: ``""``.
94
95stop
96 A floating point number specifying the deactivation time in ms, relative
97 to ``origin``. The value of ``stop`` must be greater than or equal to
98 ``start``. Default: ``infinity``.
99
100EndUserDocs */
101
153class StimulationDevice : public DeviceNode, public Device
154{
155public:
158 ~StimulationDevice() override = default;
159
166 bool is_active( const Time& ) const override;
167 void get_status( Dictionary& d ) const override;
168 void set_status( const Dictionary& ) override;
169
170 bool has_proxies() const override;
171 std::string get_element_type() const override;
172
174 using Device::init_state;
176 using Node::pre_run_hook;
177
178 void pre_run_hook() override;
179
182
193
194 virtual Type
195 get_type() const
196 {
197 throw KernelException( "WORNG TYPE" );
198 };
199 const std::string& get_label() const;
200 virtual void set_data_from_stimulation_backend( std::vector< double >& ) {};
201 void update( Time const&, const long, const long ) override {};
202
203protected:
204 void set_initialized_() final;
205
207 {
208 std::string label_;
209 std::string stimulus_source_;
210
211 Parameters_();
212 Parameters_( const Parameters_& ) = default;
213 Parameters_& operator=( const Parameters_& ) = default;
214 void get( Dictionary& ) const;
215 void set( const Dictionary& );
216 } P_;
217
218private:
227
229};
230
231inline std::string
236
237inline bool
239{
240 return false;
241}
242
243} // namespace nest
244
245#endif /* #ifndef STIMULATION_DEVICE_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Base class for device objects.
Definition device_node.h:36
Class implementing common interface and properties common for all devices.
Definition device.h:60
virtual void pre_run_hook()
Set internal variables before calls to SimulationManager::run()
Definition device.cpp:141
virtual void init_buffers()
Reset buffers.
Definition device.h:76
virtual void init_state()
Reset dynamic state to that of model.
Definition device.h:70
Base class for all Kernel exceptions.
Definition exceptions.h:65
virtual void pre_run_hook()=0
Re-calculate dependent parameters of the node.
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
StimulationDevice()
Definition stimulation_device.cpp:31
bool is_active(const Time &) const override
Determine whether device is active.
Definition stimulation_device.cpp:49
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition stimulation_device.h:201
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition stimulation_device.cpp:75
Type
Device type.
Definition stimulation_device.h:187
@ CURRENT_GENERATOR
Definition stimulation_device.h:188
@ DELAYED_RATE_CONNECTION_GENERATOR
Definition stimulation_device.h:191
@ SPIKE_GENERATOR
Definition stimulation_device.h:189
@ DOUBLE_DATA_GENERATOR
Definition stimulation_device.h:190
const std::string & get_label() const
Definition stimulation_device.cpp:87
virtual void set_data_from_stimulation_backend(std::vector< double > &)
Definition stimulation_device.h:200
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition stimulation_device.cpp:125
bool has_proxies() const override
Returns true if the node has proxies on remote threads.
Definition stimulation_device.h:238
virtual Type get_type() const
Definition stimulation_device.h:195
struct nest::StimulationDevice::Parameters_ P_
Dictionary backend_params_
Definition stimulation_device.h:228
std::string get_element_type() const override
Return the element type of the node.
Definition stimulation_device.h:232
synindex first_syn_id_
Synapse type of the first outgoing connection made by the Device.
Definition stimulation_device.h:226
~StimulationDevice() override=default
void set_initialized_() final
Definition stimulation_device.cpp:81
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
const std::string stimulator("stimulator")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Definition stimulation_device.h:207
std::string stimulus_source_
Origin of the stimulation signal.
Definition stimulation_device.h:209
std::string label_
A user-defined label for symbolic device names.
Definition stimulation_device.h:208
Parameters_ & operator=(const Parameters_ &)=default
Parameters_(const Parameters_ &)=default