NEST main@f146f75
Loading...
Searching...
No Matches
parrot_neuron.h
Go to the documentation of this file.
1/*
2 * parrot_neuron.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 PARROT_NEURON_H
24#define PARROT_NEURON_H
25
26// Includes from nestkernel:
27#include "archiving_node.h"
28#include "connection.h"
29#include "event.h"
31#include "nest_types.h"
32#include "ring_buffer.h"
33
34namespace nest
35{
36
37/* BeginUserDocs: neuron, parrot
38
39Short description
40+++++++++++++++++
41
42Neuron that repeats incoming spikes
43
44Description
45+++++++++++
46
47The parrot neuron simply emits one spike for every incoming spike.
48An important application is to provide identical poisson spike
49trains to a group of neurons. The ``poisson_generator`` sends a different
50spike train to each of its target neurons. By connecting one
51``poisson_generator`` to a ``parrot_neuron`` and then that ``parrot_neuron`` to
52a group of neurons, all target neurons will receive the same poisson
53spike train.
54
55Please note that weights of connections *to* the ``parrot_neuron``
56are ignored, while weights on connections *from* the ``parrot_neuron``
57to the target are handled as usual. Delays are honored on both
58incoming and outgoing connections.
59
60Only spikes arriving on connections to port 0 will be repeated.
61Connections onto port 1 will be accepted, but spikes incoming
62through port 1 will be ignored. This allows setting exact pre-
63and postsynaptic spike times for STDP protocols by connecting
64two parrot neurons spiking at desired times by, for example, a
65``stdp_synapse`` onto port 1 on the postsynaptic parrot neuron.
66
67The ``parrot_neuron`` can be the target of STDP synapses with predominantly axonal delays, e.g.,
68``stdp_pl_synapse_hom_ax_delay``. Since the weights of connections *to* the ``parrot_neuron`` are ignored, the weight
69corrections caused by such synapses have no effect on its spiking.
70
71Parameters
72++++++++++
73
74The following parameters can be set in the status dictionary.
75
76============================= ==== ================== =================================
77Parameter Unit Default Description
78============================= ==== ================== =================================
79``flush_event_send_interval`` ms maximum value Interval since previous event
80 representable by after which a flush event is sent
81 ``double`` type in
82 C++
83============================= ==== ================== =================================
84
85Receives
86++++++++
87
88SpikeEvent
89
90Sends
91+++++
92
93SpikeEvent
94
95Examples using this model
96+++++++++++++++++++++++++
97
98.. listexamples:: parrot_neuron
99
100EndUserDocs */
101
102void register_parrot_neuron( const std::string& name );
103
105{
106
107public:
109
115 using Node::handle;
118 using Node::sends_signal;
119
120 size_t send_test_event( Node&, size_t, synindex, bool ) override;
121 SignalType sends_signal() const override;
122 SignalType receives_signal() const override;
123
124 void handle( SpikeEvent& ) override;
125 void handle( WeightCorrectionEvent& ) override;
126 size_t handles_test_event( SpikeEvent&, size_t ) override;
127 size_t handles_test_event( WeightCorrectionEvent&, size_t ) override;
128
129 bool
131 {
132 return true;
133 }
134
135 void get_status( Dictionary& ) const override;
136 void set_status( const Dictionary& ) override;
137
138private:
139 void init_buffers_() override;
140 void
146
147 void update( Time const&, const long, const long ) override;
148
153 struct Buffers_
154 {
156 };
157
159};
160
161inline size_t
162parrot_neuron::send_test_event( Node& target, size_t receptor_type, synindex, bool )
163{
164 SpikeEvent e;
165 e.set_sender( *this );
166
167 return target.handles_test_event( e, receptor_type );
168}
169
170inline size_t
172{
173 // Allow connections to port 0 (spikes to be repeated)
174 // and port 1 (spikes to be ignored).
175 if ( receptor_type == 0 or receptor_type == 1 )
176 {
177 return receptor_type;
178 }
179 else
180 {
181 throw UnknownReceptorType( receptor_type, get_name() );
182 }
183}
184
185inline size_t
187{
188 // Allow connections to port 0 (spikes to be repeated)
189 // and port 1 (spikes to be ignored).
190 if ( receptor_type == 0 or receptor_type == 1 )
191 {
192 return receptor_type;
193 }
194 else
195 {
196 throw UnknownReceptorType( receptor_type, get_name() );
197 }
198}
199
200inline SignalType
202{
203 return ALL;
204}
205
206inline SignalType
208{
209 return ALL;
210}
211
212} // namespace
213
214#endif // PARROT_NEURON_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
ArchivingNode()
Definition archiving_node.cpp:37
void pre_run_hook_()
Definition axonal_delay_archiving_node.cpp:44
void pre_run_hook()
Re-calculates dependent parameters.
Definition flush_event_mechanism.cpp:50
FlushEventMechanism()
Default constructor.
Definition flush_event_mechanism.cpp:35
Base class for all NEST network objects.
Definition node.h:99
virtual SignalType receives_signal() const
Definition node.h:988
virtual SignalType sends_signal() const
Definition node.h:977
std::string get_name() const
Return class name.
Definition node.cpp:105
Buffer Layout.
Definition ring_buffer.h:83
Event for spike information.
Definition event.h:420
Definition nest_time.h:135
Exception to be thrown if the specified receptor type does not exist in the node.
Definition exceptions.h:417
Definition event.h:457
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition parrot_neuron.cpp:103
SignalType sends_signal() const override
Definition parrot_neuron.h:201
bool supports_axonal_delay_corrections() const override
Whether this model can be the target of a synapse with predominantly axonal delay.
Definition parrot_neuron.h:130
void init_buffers_() override
Configure persistent internal data structures.
Definition parrot_neuron.cpp:52
SignalType receives_signal() const override
Definition parrot_neuron.h:207
parrot_neuron()
Definition parrot_neuron.cpp:45
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition parrot_neuron.h:171
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition parrot_neuron.h:162
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition parrot_neuron.cpp:59
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition parrot_neuron.cpp:96
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition parrot_neuron.h:141
Buffers_ B_
Definition parrot_neuron.h:158
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition parrot_neuron.cpp:89
virtual size_t handles_test_event(SpikeEvent &, size_t receptor_type)
Check if the node can handle a particular event and receptor type.
Definition node.cpp:282
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition node.cpp:271
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_parrot_neuron(const std::string &name)
Definition parrot_neuron.cpp:39
SignalType
enum type of signal conveyed by spike events of a node.
Definition nest_types.h:171
@ ALL
Definition nest_types.h:175
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:121
Buffers and accumulates the number of incoming spikes per time step; RingBuffer stores doubles; for n...
Definition parrot_neuron.h:154
RingBuffer n_spikes_
Definition parrot_neuron.h:155