NEST main@caf0ae8
 
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
67Parameters
68++++++++++
69
70The following parameters can be set in the status dictionary.
71
72============================= ==== ================== =================================
73Parameter Unit Default Description
74============================= ==== ================== =================================
75``flush_event_send_interval`` ms maximum value Interval since previous event
76 representable by after which a flush event is sent
77 ``double`` type in
78 C++
79============================= ==== ================== =================================
80
81Receives
82++++++++
83
84SpikeEvent
85
86Sends
87+++++
88
89SpikeEvent
90
91Examples using this model
92+++++++++++++++++++++++++
93
94.. listexamples:: parrot_neuron
95
96EndUserDocs */
97
98void register_parrot_neuron( const std::string& name );
99
101{
102
103public:
105
111 using Node::handle;
114 using Node::sends_signal;
115
116 size_t send_test_event( Node&, size_t, synindex, bool ) override;
117 SignalType sends_signal() const override;
118 SignalType receives_signal() const override;
119
120 void handle( SpikeEvent& ) override;
121 size_t handles_test_event( SpikeEvent&, size_t ) override;
122
123 void get_status( Dictionary& ) const override;
124 void set_status( const Dictionary& ) override;
125
126private:
127 void init_buffers_() override;
128 void
129 pre_run_hook() override
130 {
132 }
133
134 void update( Time const&, const long, const long ) override;
135
140 struct Buffers_
141 {
143 };
144
146};
147
148inline size_t
149parrot_neuron::send_test_event( Node& target, size_t receptor_type, synindex, bool )
150{
151 SpikeEvent e;
152 e.set_sender( *this );
153
154 return target.handles_test_event( e, receptor_type );
155}
156
157inline size_t
159{
160 // Allow connections to port 0 (spikes to be repeated)
161 // and port 1 (spikes to be ignored).
162 if ( receptor_type == 0 or receptor_type == 1 )
163 {
164 return receptor_type;
165 }
166 else
167 {
168 throw UnknownReceptorType( receptor_type, get_name() );
169 }
170}
171
172inline SignalType
174{
175 return ALL;
176}
177
178inline SignalType
180{
181 return ALL;
182}
183
184} // namespace
185
186#endif // PARROT_NEURON_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
A node which archives spike history for the purposes of spike-timing dependent plasticity (STDP)
Definition archiving_node.h:49
Class implementing a flush event mechanism for neuron models.
Definition flush_event_mechanism.h:43
void pre_run_hook()
Re-calculates dependent parameters.
Definition flush_event_mechanism.cpp:50
Base class for all NEST network objects.
Definition node.h:99
virtual SignalType receives_signal() const
Definition node.h:974
virtual SignalType sends_signal() const
Definition node.h:963
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:418
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 parrot_neuron.h:101
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition parrot_neuron.cpp:104
SignalType sends_signal() const override
Definition parrot_neuron.h:173
void init_buffers_() override
Configure persistent internal data structures.
Definition parrot_neuron.cpp:52
SignalType receives_signal() const override
Definition parrot_neuron.h:179
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:158
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:149
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:97
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition parrot_neuron.h:129
Buffers_ B_
Definition parrot_neuron.h:145
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition parrot_neuron.cpp:90
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:271
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition node.cpp:265
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:165
@ ALL
Definition nest_types.h:169
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers and accumulates the number of incoming spikes per time step; RingBuffer stores doubles; for n...
Definition parrot_neuron.h:141
RingBuffer n_spikes_
Definition parrot_neuron.h:142