NEST main@caf0ae8
 
Loading...
Searching...
No Matches
ignore_and_fire.h
Go to the documentation of this file.
1/*
2 * ignore_and_fire.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 IGNORE_AND_FIRE_H
24#define IGNORE_AND_FIRE_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 "ring_buffer.h"
33
34namespace nest
35{
36
37/* BeginUserDocs: neuron, integrate-and-fire, current-based
38
39Short description
40+++++++++++++++++
41
42Ignore-and-fire neuron model for generating spikes at fixed intervals irrespective of inputs
43
44Description
45+++++++++++
46
47The ``ignore_and_fire`` neuron is a neuron model generating spikes at a predefined ``rate`` with a constant inter-spike
48interval ("fire"), irrespective of its inputs ("ignore"). In this simplest version of the ``ignore_and_fire`` neuron,
49the inputs from other neurons or devices are not processed at all.
50
51The model's state variable, the ``phase``, describes the time to the next spike relative to the firing period (the
52inverse of the ``rate``). In each update step, the ``phase`` is decreased by a fixed amount. If it hits zero, a spike
53is emitted and the ``phase`` is reset to +1.
54
55To create asynchronous activity for a population of ``ignore_and_fire`` neurons, the firing phases can be randomly
56initialized.
57
58The ``ignore_and_fire`` neuron is primarily used for neuronal-network model verification and validation purposes
59("benchmarking"), in particular, to evaluate the correctness and performance of connectivity generation and inter-neuron
60communication. It permits an easy scaling of the network size and/or connectivity without affecting the output spike
61statistics. The amount of network traffic is predefined by the user, and therefore fully controllable and predictable,
62irrespective of the network size and structure.
63
64.. note::
65
66 The model can easily be extended and equipped with any arbitrary input processing (such as calculating input
67 currents with alpha-function shaped PSC kernels or updating the gating variables in the Hodgkin-Huxley model) or
68 (after-) spike generation dynamics to make it more similar and comparable to other non-ignorant neuron models. In
69 such extended ignore_and_fire models, the spike emission process would still be decoupled from the intrinsic neuron
70 dynamics.
71
72Parameters
73++++++++++
74
75The following parameters can be set in the status dictionary.
76
77================= ========= ======================================================
78**Parameter** **Unit** **Description**
79================= ========= ======================================================
80 ``phase`` Phase (relative time to next spike; 0<phase<=1)
81 ``rate`` 1/s Firing rate
82================= ========= ======================================================
83
84Sends
85+++++
86
87SpikeEvent
88
89Receives
90++++++++
91
92SpikeEvent, CurrentEvent, DataLoggingRequest
93
94Examples using this model
95+++++++++++++++++++++++++
96
97.. listexamples:: ignore_and_fire
98
99EndUserDocs */
100
101
102void register_ignore_and_fire( const std::string& name );
103
105{
106
107public:
110
116 using Node::handle;
118
119 size_t send_test_event( Node&, size_t, synindex, bool );
120
121 void handle( SpikeEvent& );
122 void handle( CurrentEvent& );
123 void handle( DataLoggingRequest& );
124
125 size_t handles_test_event( SpikeEvent&, size_t );
126 size_t handles_test_event( CurrentEvent&, size_t );
127 size_t handles_test_event( DataLoggingRequest&, size_t );
128
129 void get_status( Dictionary& ) const;
130 void set_status( const Dictionary& );
131
132private:
133 void init_buffers_();
134 void pre_run_hook();
135
136 void update( Time const&, const long, const long );
137
138 // The next two classes need to be friends to access the State_ class/member
139 friend class RecordablesMap< ignore_and_fire >;
140 friend class UniversalDataLogger< ignore_and_fire >;
141
142 // ----------------------------------------------------------------
143
148 {
150 double phase_;
151
153 double rate_;
154
155 Parameters_();
156
157 void get( Dictionary& ) const;
158
162 void set( const Dictionary&, Node* node );
163 };
164
165 // ----------------------------------------------------------------
166
170 struct State_
171 {
173
174 State_();
175
176 void get( Dictionary&, const Parameters_& ) const;
177
183 void set( const Dictionary&, const Parameters_&, Node* node );
184 };
185
186 // ----------------------------------------------------------------
187
212
213 // ----------------------------------------------------------------
214
223 // ----------------------------------------------------------------
224
240
241 inline void
243 {
244 V_.firing_period_steps_ = Time( Time::ms( 1. / P_.rate_ * 1000. ) ).get_steps();
245 V_.phase_steps_ = Time( Time::ms( P_.phase_ / P_.rate_ * 1000. ) ).get_steps();
246 }
247};
248
249inline size_t
250ignore_and_fire::send_test_event( Node& target, size_t receptor_type, synindex, bool )
251{
252 SpikeEvent e;
253 e.set_sender( *this );
254 return target.handles_test_event( e, receptor_type );
255}
256
257inline size_t
259{
260 if ( receptor_type != 0 )
261 {
262 throw UnknownReceptorType( receptor_type, get_name() );
263 }
264 return 0;
265}
266
267inline size_t
269{
270 if ( receptor_type != 0 )
271 {
272 throw UnknownReceptorType( receptor_type, get_name() );
273 }
274 return 0;
275}
276
277inline size_t
279{
280 if ( receptor_type != 0 )
281 {
282 throw UnknownReceptorType( receptor_type, get_name() );
283 }
284 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
285}
286
287inline void
289{
290 P_.get( d );
291 S_.get( d, P_ );
293 d[ names::recordables ] = recordablesMap_.get_list();
294}
295
296inline void
298{
299 Parameters_ ptmp = P_; // temporary copy in case of errors
300 ptmp.set( d, this ); // throws if BadProperty
301 State_ stmp = S_; // temporary copy in case of errors
302 stmp.set( d, ptmp, this ); // throws if BadProperty
303
304 // We now know that (ptmp, stmp) are consistent. We do not
305 // write them back to (P_, S_) before we are also sure that
306 // the properties to be set in the parent class are internally
307 // consistent.
309
310 // if we get here, temporaries contain consistent set of properties
311 P_ = ptmp;
312 S_ = stmp;
313
315}
316
317} // namespace
318
319#endif /* #ifndef IGNORE_AND_FIRE_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
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition archiving_node.cpp:220
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition archiving_node.cpp:236
Event for electrical currents.
Definition event.h:569
Request data to be logged/logged data to be sent.
Definition event.h:636
Base class for all NEST network objects.
Definition node.h:99
std::string get_name() const
Return class name.
Definition node.cpp:105
Map names of recordables to data access functions.
Definition recordables_map.h:61
Event for spike information.
Definition event.h:418
Definition nest_time.h:135
long get_steps() const
Definition nest_time.h:504
Exception to be thrown if the specified receptor type does not exist in the node.
Definition exceptions.h:417
Definition ignore_and_fire.h:105
static RecordablesMap< ignore_and_fire > recordablesMap_
Mapping of recordables names to access functions.
Definition ignore_and_fire.h:239
void init_buffers_()
Configure persistent internal data structures.
Definition ignore_and_fire.cpp:154
void pre_run_hook()
Re-calculate dependent parameters of the node.
Definition ignore_and_fire.cpp:164
friend class UniversalDataLogger< ignore_and_fire >
Definition ignore_and_fire.h:140
void get_status(Dictionary &) const
Export properties of the node by setting entries in the status dictionary.
Definition ignore_and_fire.h:288
void calc_initial_variables_()
Definition ignore_and_fire.h:242
void set_status(const Dictionary &)
Change properties of the node according to the entries in the dictionary.
Definition ignore_and_fire.h:297
void handle(SpikeEvent &)
Handle incoming spike events.
Definition ignore_and_fire.cpp:199
size_t handles_test_event(SpikeEvent &, size_t)
Check if the node can handle a particular event and receptor type.
Definition ignore_and_fire.h:258
ignore_and_fire()
Definition ignore_and_fire.cpp:130
void update(Time const &, const long, const long)
Advance the state of the node in time through the given interval.
Definition ignore_and_fire.cpp:175
size_t send_test_event(Node &, size_t, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition ignore_and_fire.h:250
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
Variables_ V_
Definition ignore_and_fire.h:234
State_ S_
Definition ignore_and_fire.h:233
Parameters_ P_
Definition ignore_and_fire.h:232
Buffers_ B_
Definition ignore_and_fire.h:235
const std::string recordables("recordables")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_ignore_and_fire(const std::string &name)
Definition ignore_and_fire.cpp:46
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Definition nest_time.h:255
Buffers of the model.
Definition ignore_and_fire.h:192
@ SYN_EX
Definition ignore_and_fire.h:201
@ NUM_INPUT_CHANNELS
Definition ignore_and_fire.h:203
@ SYN_IN
Definition ignore_and_fire.h:200
@ I0
Definition ignore_and_fire.h:202
MultiChannelInputBuffer< NUM_INPUT_CHANNELS > input_buffer_
buffers and sums up incoming spikes/currents
Definition ignore_and_fire.h:207
UniversalDataLogger< ignore_and_fire > logger_
Logger for all analog data.
Definition ignore_and_fire.h:210
Independent parameters of the model.
Definition ignore_and_fire.h:148
void get(Dictionary &) const
Store current values in dictionary.
Definition ignore_and_fire.cpp:80
double phase_
Phase.
Definition ignore_and_fire.h:150
Parameters_()
Sets default parameter values.
Definition ignore_and_fire.cpp:65
double rate_
Firing rate in spikes/s.
Definition ignore_and_fire.h:153
void set(const Dictionary &, Node *node)
Set values from dictionary.
Definition ignore_and_fire.cpp:87
State variables of the model.
Definition ignore_and_fire.h:171
State_()
Default initialization.
Definition ignore_and_fire.cpp:71
double refr_spikes_buffer_
Definition ignore_and_fire.h:172
void get(Dictionary &, const Parameters_ &) const
Definition ignore_and_fire.cpp:104
void set(const Dictionary &, const Parameters_ &, Node *node)
Set values from dictionary.
Definition ignore_and_fire.cpp:110
Internal variables of the model.
Definition ignore_and_fire.h:219
int phase_steps_
Definition ignore_and_fire.h:220
int firing_period_steps_
Definition ignore_and_fire.h:221