NEST main@caf0ae8
 
Loading...
Searching...
No Matches
parrot_neuron_ps.h
Go to the documentation of this file.
1/*
2 * parrot_neuron_ps.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_PS_H
24#define PARROT_NEURON_PS_H
25
26// Includes from nestkernel:
27#include "archiving_node.h"
28#include "connection.h"
29#include "event.h"
30#include "nest_types.h"
31#include "slice_ring_buffer.h"
32
33namespace nest
34{
35
36/* BeginUserDocs: neuron, parrot, precise
37
38Short description
39+++++++++++++++++
40
41Neuron that repeats incoming spikes - precise spike timing version
42
43Description
44+++++++++++
45
46The parrot neuron simply emits one spike for every incoming spike.
47An important application is to provide identical poisson spike
48trains to a group of neurons. The poisson_generator sends a different
49spike train to each of its target neurons. By connecting one
50poisson_generator to a parrot_neuron and then that parrot_neuron to
51a group of neurons, all target neurons will receive the same poisson
52spike train.
53
54Please note that weights of connections *to* the ``parrot_neuron``
55are ignored, while weights on connections *from* the ``parrot_neuron``
56to the target are handled as usual. Delays are honored on both
57incoming and outgoing connections.
58
59Only spikes arriving on connections to port 0 will be repeated.
60Connections onto port 1 will be accepted, but spikes incoming
61through port 1 will be ignored. This allows setting exact pre-
62and postsynaptic spike times for STDP protocols by connecting
63two parrot neurons spiking at desired times by, e.g., a
64stdp_synapse onto port 1 on the postsynaptic parrot neuron.
65
66Please note that this node is capable of sending precise spike times
67to target nodes (on-grid spike time plus offset).
68
69Receives
70++++++++
71
72SpikeEvent
73
74Sends
75+++++
76
77SpikeEvent
78
79Examples using this model
80+++++++++++++++++++++++++
81
82.. listexamples:: parrot_neuron_ps
83
84EndUserDocs */
85
86void register_parrot_neuron_ps( const std::string& name );
87
89{
90public:
92
98 using Node::handle;
100
101 void handle( SpikeEvent& ) override;
102 size_t send_test_event( Node&, size_t, synindex, bool ) override;
103 size_t handles_test_event( SpikeEvent&, size_t ) override;
104
105 void get_status( Dictionary& ) const override;
106 void set_status( const Dictionary& ) override;
107
108 bool
109 is_off_grid() const override
110 {
111 return true;
112 }
113
114private:
115 void init_buffers_() override;
116
117 void
118 pre_run_hook() override
119 {
120 } // no variables
121
122 void update( Time const&, const long, const long ) override;
123
129
131};
132
133inline size_t
134parrot_neuron_ps::send_test_event( Node& target, size_t receptor_type, synindex, bool )
135{
136 SpikeEvent e;
137 e.set_sender( *this );
138
139 return target.handles_test_event( e, receptor_type );
140}
141
142inline size_t
144{
145 // Allow connections to port 0 (spikes to be repeated)
146 // and port 1 (spikes to be ignored).
147 if ( receptor_type == 0 or receptor_type == 1 )
148 {
149 return receptor_type;
150 }
151 else
152 {
153 throw UnknownReceptorType( receptor_type, get_name() );
154 }
155}
156
157} // namespace
158
159#endif // PARROT_NEURON_PS_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
Base class for all NEST network objects.
Definition node.h:99
std::string get_name() const
Return class name.
Definition node.cpp:105
Queue for all spikes arriving into a neuron.
Definition slice_ring_buffer.h:63
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_ps.h:89
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition parrot_neuron_ps.h:143
bool is_off_grid() const override
Returns true if the node sends/receives off-grid events.
Definition parrot_neuron_ps.h:109
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition parrot_neuron_ps.cpp:58
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition parrot_neuron_ps.cpp:100
parrot_neuron_ps()
Definition parrot_neuron_ps.cpp:44
void init_buffers_() override
Configure persistent internal data structures.
Definition parrot_neuron_ps.cpp:50
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_ps.h:134
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition parrot_neuron_ps.cpp:107
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition parrot_neuron_ps.cpp:94
Buffers_ B_
Definition parrot_neuron_ps.h:130
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition parrot_neuron_ps.h:118
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_ps(const std::string &name)
Definition parrot_neuron_ps.cpp:38
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Queue for incoming events.
Definition parrot_neuron_ps.h:126
SliceRingBuffer events_
Definition parrot_neuron_ps.h:127