NEST main@caf0ae8
 
Loading...
Searching...
No Matches
siegert_neuron.h
Go to the documentation of this file.
1/*
2 * siegert_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 SIEGERT_NEURON_H
24#define SIEGERT_NEURON_H
25
26#include "config.h"
27
28#ifdef HAVE_GSL
29
30// C includes:
31#include <gsl/gsl_integration.h>
32#include <gsl/gsl_sf_dawson.h>
33#include <gsl/gsl_sf_erf.h>
34
35// Includes from nestkernel:
36#include "archiving_node.h"
37#include "connection.h"
38#include "event.h"
39#include "nest_types.h"
40#include "node.h"
41#include "recordables_map.h"
42#include "ring_buffer.h"
44
45namespace nest
46{
47
48/* BeginUserDocs: neuron, rate
49
50Short description
51+++++++++++++++++
52
53model for mean-field analysis of spiking networks
54
55Description
56+++++++++++
57
58``siegert_neuron`` is an implementation of a rate model with the
59non-linearity given by the gain function of the
60leaky-integrate-and-fire neuron with delta or exponentially decaying
61synapses :footcite:p:`Fourcaud2002` and :footcite:p:`Schuecker2015` (their eq. 25). The model can be used for a
62mean-field analysis of spiking networks. A constant mean input can be
63provided to create neurons with a target rate, e.g. to model a constant
64external input.
65
66The model supports connections to other rate models with zero
67delay, and uses the secondary_event concept introduced with the
68gap-junction framework.
69
70For details on the numerical solution of the Siegert integral, you can
71check out the `Siegert_neuron_integration
72<../model_details/siegert_neuron_integration.ipynb>`_
73notebook in the NEST source code.
74
75See also :footcite:p:`Hahne2017`, :footcite:p:`Hahne2015`.
76
77Parameters
78++++++++++
79
80The following parameters can be set in the status Dictionary.
81
82===== ====== ==============================
83 rate 1/s Rate (1/s)
84 tau ms Time constant
85 mean 1/s Additional constant input
86===== ====== ==============================
87
88The following parameters can be set in the status directory and are
89used in the evaluation of the gain function. Parameters as in
90iaf_psc_exp/delta.
91
92========= ====== ================================================
93 tau_m ms Membrane time constant
94 tau_syn ms Time constant of postsynaptic currents
95 t_ref ms Duration of refractory period
96 theta mV Threshold relative to resting potential
97 V_reset mV Reset relative to resting potential
98========= ====== ================================================
99
100References
101++++++++++
102
103.. footbibliography::
104
105Sends
106+++++
107
108DiffusionConnectionEvent
109
110Receives
111++++++++
112
113DiffusionConnectionEvent, DataLoggingRequest
114
115See also
116++++++++
117
118diffusion_connection
119
120
121Examples using this model
122+++++++++++++++++++++++++
123
124.. listexamples:: siegert_neuron
125
126EndUserDocs */
127
128void register_siegert_neuron( const std::string& name );
129
130class siegert_neuron : public ArchivingNode
131{
132
133public:
134 typedef Node base;
135
136 siegert_neuron();
137 siegert_neuron( const siegert_neuron& );
138
139 ~siegert_neuron() override;
140
146 using Node::handle;
147 using Node::handles_test_event;
148 using Node::sends_secondary_event;
149
150 void handle( DiffusionConnectionEvent& ) override;
151 void handle( DataLoggingRequest& ) override;
152
153 size_t handles_test_event( DiffusionConnectionEvent&, size_t ) override;
154 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
155
156 void
157 sends_secondary_event( DiffusionConnectionEvent& ) override
158 {
159 }
160
161 void get_status( Dictionary& ) const override;
162 void set_status( const Dictionary& ) override;
163
164private:
165 void init_buffers_() override;
166 void pre_run_hook() override;
167
171 bool update_( Time const&, const long, const long, const bool );
172
173 void update( Time const&, const long, const long ) override;
174 bool wfr_update( Time const&, const long, const long ) override;
175
176 // siegert function
177 double siegert( double, double );
178
179 // The next two classes need to be friends to access the State_ class/member
180 friend class RecordablesMap< siegert_neuron >;
181 friend class UniversalDataLogger< siegert_neuron >;
182
183 // ----------------------------------------------------------------
184
188 struct Parameters_
189 {
191 double tau_;
192
194 double tau_m_;
195
197 double tau_syn_;
198
200 double t_ref_;
201
203 double mean_;
204
206 double theta_;
207
209 double V_reset_;
210
211 Parameters_();
212
213 void get( Dictionary& ) const;
214
215 void set( const Dictionary&, Node* node );
216 };
217
218 // ----------------------------------------------------------------
219
223 struct State_
224 {
225 double r_;
226
227 State_();
228
229 void get( Dictionary& ) const;
230 void set( const Dictionary&, Node* node );
231 };
232
233 // ----------------------------------------------------------------
234
238 struct Buffers_
239 {
240 Buffers_( siegert_neuron& );
241 Buffers_( const Buffers_&, siegert_neuron& );
242
243 std::vector< double > drift_input_;
244 std::vector< double > diffusion_input_;
245 // received by DiffusionConnection
246 std::vector< double > last_y_values;
247 UniversalDataLogger< siegert_neuron > logger_;
248 };
249
250 // ----------------------------------------------------------------
251
255 struct Variables_
256 {
257
258 // propagators
259 double P1_;
260 double P2_;
261 };
262
264 double
265 get_rate_() const
266 {
267 return S_.r_;
268 }
269
270 // ----------------------------------------------------------------
271
272 Parameters_ P_;
273 State_ S_;
274 Variables_ V_;
275 Buffers_ B_;
276
277 gsl_integration_workspace* gsl_w_;
278
280 static RecordablesMap< siegert_neuron > recordablesMap_;
281};
282
283inline void
284siegert_neuron::update( Time const& origin, const long from, const long to )
285{
286 update_( origin, from, to, false );
287}
288
289inline bool
290siegert_neuron::wfr_update( Time const& origin, const long from, const long to )
291{
292 State_ old_state = S_; // save state before wfr update
293 const bool wfr_tol_exceeded = update_( origin, from, to, true );
294 S_ = old_state; // restore old state
295
296 return not wfr_tol_exceeded;
297}
298
299inline size_t
300siegert_neuron::handles_test_event( DiffusionConnectionEvent&, size_t receptor_type )
301{
302 if ( receptor_type == 0 )
303 {
304 return 0;
305 }
306 else if ( receptor_type == 1 )
307 {
308 return 1;
309 }
310 else
311 {
312 throw UnknownReceptorType( receptor_type, get_name() );
313 }
314}
315
316inline size_t
317siegert_neuron::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
318{
319 if ( receptor_type != 0 )
320 {
321 throw UnknownReceptorType( receptor_type, get_name() );
322 }
323 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
324}
325
326inline void
327siegert_neuron::get_status( Dictionary& d ) const
328{
329 P_.get( d );
330 S_.get( d );
332 d[ names::recordables ] = recordablesMap_.get_list();
333}
334
335inline void
336siegert_neuron::set_status( const Dictionary& d )
337{
338 Parameters_ ptmp = P_; // temporary copy in case of errors
339 ptmp.set( d, this ); // throws if BadProperty
340 State_ stmp = S_; // temporary copy in case of errors
341 stmp.set( d, this ); // throws if BadProperty
342
343 // We now know that (ptmp, stmp) are consistent. We do not
344 // write them back to (P_, S_) before we are also sure that
345 // the properties to be set in the parent class are internally
346 // consistent.
348
349 // if we get here, temporaries contain consistent set of properties
350 P_ = ptmp;
351 S_ = stmp;
352}
353
354} // namespace
355
356#endif // HAVE_GSL
357#endif // SIEGERT_NEURON_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
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
const std::string recordables("recordables")
const std::string d("d")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
Declarations for base class Node.