NEST main@caf0ae8
 
Loading...
Searching...
No Matches
spike_recorder.h
Go to the documentation of this file.
1/*
2 * spike_recorder.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 SPIKE_RECORDER_H
24#define SPIKE_RECORDER_H
25
26// C++ includes:
27#include <vector>
28
29// Includes from nestkernel:
30#include "device_node.h"
31#include "event.h"
32#include "exceptions.h"
33#include "nest_types.h"
34#include "recording_device.h"
35
36/* BeginUserDocs: device, recorder, spike
37
38Short description
39+++++++++++++++++
40
41Collecting spikes from neurons
42
43Description
44+++++++++++
45
46The most universal collector device is the ``spike_recorder``, which
47collects and records all *spikes* it receives from neurons that are
48connected to it. Each spike received by the spike recorder is
49immediately handed over to the selected recording backend for further
50processing.
51
52Any node from which spikes are to be recorded, must be connected to
53the spike recorder using the standard ``Connect`` command. The
54connection ``weights`` and ``delays`` are ignored by the spike
55recorder, which means that the spike recorder records the time of
56spike creation rather than that of their arrival.
57
58::
59
60 >>> neurons = nest.Create("iaf_psc_alpha", 5)
61 >>> sr = nest.Create("spike_recorder", params={"record_to":"memory", "time_in_steps": False})
62 >>> nest.Connect(neurons, sr)
63
64Note the call to ``Connect`` will fail if the connection direction is
65reversed (i.e., connecting *sr* to *neurons*).
66
67
68.. include:: ../models/recording_device.rst
69
70See also
71++++++++
72
73Examples using this model
74+++++++++++++++++++++++++
75
76.. listexamples:: spike_recorder
77
78EndUserDocs */
79
80namespace nest
81{
82
87void register_spike_recorder( const std::string& name );
88
90{
91
92public:
95
96 bool
97 has_proxies() const override
98 {
99 return false;
100 }
101
102 bool
103 local_receiver() const override
104 {
105 return true;
106 }
107
108 std::string
109 get_element_type() const override
110 {
111 return names::recorder;
112 }
113
119 using Node::handle;
122
123 void handle( SpikeEvent& ) override;
124
125 size_t handles_test_event( SpikeEvent&, size_t ) override;
126
127 Type get_type() const override;
128 SignalType receives_signal() const override;
129
130 void get_status( Dictionary& ) const override;
131 void set_status( const Dictionary& ) override;
132
133private:
134 void pre_run_hook() override;
135 void update( Time const&, const long, const long ) override;
136};
137
138inline size_t
140{
141 if ( receptor_type != 0 )
142 {
143 throw UnknownReceptorType( receptor_type, get_name() );
144 }
145 return 0;
146}
147
148inline SignalType
150{
151 return ALL;
152}
153
154} // namespace
155
156#endif /* #ifndef SPIKE_RECORDER_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
virtual SignalType receives_signal() const
Definition node.h:974
std::string get_name() const
Return class name.
Definition node.cpp:105
Base class for all recording devices.
Definition recording_device.h:157
Type
Definition recording_device.h:169
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 spike_recorder.h:90
void pre_run_hook() override
Set internal variables before calls to SimulationManager::run()
Definition spike_recorder.cpp:56
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition spike_recorder.cpp:102
bool local_receiver() const override
Returns true if the node only receives events from nodes/devices on the same thread.
Definition spike_recorder.h:103
Type get_type() const override
Definition spike_recorder.cpp:68
spike_recorder()
Definition spike_recorder.cpp:45
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition spike_recorder.cpp:74
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition spike_recorder.cpp:62
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition spike_recorder.cpp:96
SignalType receives_signal() const override
Definition spike_recorder.h:149
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition spike_recorder.h:139
std::string get_element_type() const override
Return the element type of the node.
Definition spike_recorder.h:109
bool has_proxies() const override
Returns true if the node has proxies on remote threads.
Definition spike_recorder.h:97
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
const std::string recorder("recorder")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_spike_recorder(const std::string &name)
Class spike_recorder.
Definition spike_recorder.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