NEST main@caf0ae8
 
Loading...
Searching...
No Matches
iaf_psc_alpha_multisynapse.h
Go to the documentation of this file.
1/*
2 * iaf_psc_alpha_multisynapse.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 IAF_PSC_ALPHA_MULTISYNAPSE_H
24#define IAF_PSC_ALPHA_MULTISYNAPSE_H
25
26// Generated includes:
27#include <sstream>
28
29// Includes from nestkernel:
30#include "archiving_node.h"
31#include "connection.h"
32#include "event.h"
33#include "nest_types.h"
34#include "recordables_map.h"
35#include "ring_buffer.h"
37
38namespace nest
39{
40
41/* BeginUserDocs: neuron, integrate-and-fire, current-based, hard threshold
42
43Short description
44+++++++++++++++++
45
46Leaky integrate-and-fire neuron model with multiple ports
47
48Description
49+++++++++++
50
51``iaf_psc_alpha_multisynapse`` is a direct extension of ``iaf_psc_alpha``.
52On the postsynaptic side, there can be arbitrarily many synaptic
53time constants (``iaf_psc_alpha`` has exactly two: ``tau_syn_ex`` and ``tau_syn_in``).
54
55This can be reached by specifying separate receptor ports, each for
56a different time constant. The port number has to match the respective
57``receptor_type`` in the connectors.
58
59.. note::
60
61 If ``tau_m`` is very close to ``tau_syn_ex`` or ``tau_syn_in``, the model
62 will numerically behave as if ``tau_m`` is equal to ``tau_syn_ex`` or
63 ``tau_syn_in``, respectively, to avoid numerical instabilities.
64
65 For implementation details see the
66 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
67
68Sends
69+++++
70
71SpikeEvent
72
73Receives
74++++++++
75
76SpikeEvent, CurrentEvent, DataLoggingRequest
77
78See also
79++++++++
80
81iaf_psc_alpha, iaf_psc_delta, iaf_psc_exp, iaf_cond_exp, iaf_psc_exp_multisynapse
82
83Examples using this model
84+++++++++++++++++++++++++
85
86.. listexamples:: iaf_psc_alpha_multisynapse
87
88EndUserDocs */
89
90void register_iaf_psc_alpha_multisynapse( const std::string& name );
91
93{
94
95public:
98
104 using Node::handle;
106
107 size_t send_test_event( Node&, size_t, synindex, bool ) override;
108
109 void handle( SpikeEvent& ) override;
110 void handle( CurrentEvent& ) override;
111 void handle( DataLoggingRequest& ) override;
112
113 size_t handles_test_event( SpikeEvent&, size_t ) override;
114 size_t handles_test_event( CurrentEvent&, size_t ) override;
115 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
116
117 void get_status( Dictionary& ) const override;
118 void set_status( const Dictionary& ) override;
119
120private:
121 void init_buffers_() override;
122 void pre_run_hook() override;
123
124 void update( Time const&, const long, const long ) override;
125
126 // The next two classes need to be friends to access the State_ class/member
128 friend class DynamicUniversalDataLogger< iaf_psc_alpha_multisynapse >;
130
131 // ----------------------------------------------------------------
132
137 {
139 double Tau_;
140
142 double C_;
143
146
148 double E_L_;
149
151 double I_e_;
152
154 double V_reset_;
155
158 double Theta_;
159
163
165 std::vector< double > tau_syn_;
166
167 // boolean flag which indicates whether the neuron has connections
169
170 size_t n_receptors_() const;
171
172 Parameters_();
173
174 void get( Dictionary& ) const;
175
179 double set( const Dictionary&, Node* node );
180 }; // Parameters_
181
182 // ----------------------------------------------------------------
183
187 struct State_
188 {
202 {
203 V_M = 0,
204 I, // 1
205 I_SYN // 2
206 };
207
208 static const size_t NUMBER_OF_FIXED_STATES_ELEMENTS = I_SYN; // V_M, I
209 static const size_t NUM_STATE_ELEMENTS_PER_RECEPTOR = 1; // I_SYN
210
211 double I_const_;
212 std::vector< double > y1_syn_;
213 std::vector< double > y2_syn_;
215 double V_m_;
216
218
219 State_();
220
221 void get( Dictionary&, const Parameters_& ) const;
222
228 void set( const Dictionary&, const Parameters_&, const double, Node* );
229 }; // State_
230
231 // ----------------------------------------------------------------
232
248
249 // ----------------------------------------------------------------
250
255 {
256 std::vector< double > PSCInitialValues_;
258
259 std::vector< double > P11_syn_;
260 std::vector< double > P21_syn_;
261 std::vector< double > P22_syn_;
262 std::vector< double > P31_syn_;
263 std::vector< double > P32_syn_;
264
265 double P30_;
266 double P33_;
267
269
270 }; // Variables
271
272 // Data members -----------------------------------------------------------
273
288
289 // Data Access Functor getter
291 inline double
292 get_state_element( size_t elem )
293 {
294 if ( elem == State_::V_M )
295 {
296 return S_.V_m_ + P_.E_L_;
297 }
298 else if ( elem == State_::I )
299 {
300 return std::accumulate( S_.y2_syn_.begin(), S_.y2_syn_.end(), 0.0 );
301 }
302 else
303 {
305 }
306 };
307
308 // Utility function that inserts the synaptic conductances to the
309 // recordables map
310
311 std::string get_i_syn_name( size_t elem );
312 void insert_current_recordables( size_t first = 0 );
313};
314
315inline size_t
320
321inline size_t
322iaf_psc_alpha_multisynapse::send_test_event( Node& target, size_t receptor_type, synindex, bool )
323{
324 SpikeEvent e;
325 e.set_sender( *this );
326
327 return target.handles_test_event( e, receptor_type );
328}
329
330inline size_t
332{
333 if ( receptor_type != 0 )
334 {
335 throw UnknownReceptorType( receptor_type, get_name() );
336 }
337 return 0;
338}
339
340inline size_t
342{
343 if ( receptor_type != 0 )
344 {
345 throw UnknownReceptorType( receptor_type, get_name() );
346 }
347 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
348}
349
350inline void
352{
353 P_.get( d );
354 S_.get( d, P_ );
356
357 d[ names::recordables ] = recordablesMap_.get_list();
358}
359
360} // namespace
361
362#endif /* #ifndef IAF_PSC_ALPHA_MULTISYNAPSE_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
Event for electrical currents.
Definition event.h:569
Class that reads out state vector elements, used by UniversalDataLogger.
Definition recordables_map.h:136
Request data to be logged/logged data to be sent.
Definition event.h:636
Map names of recordables to DataAccessFunctors.
Definition recordables_map.h:170
Base class for all NEST network objects.
Definition node.h:99
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 iaf_psc_alpha_multisynapse.h:93
std::string get_i_syn_name(size_t elem)
Definition iaf_psc_alpha_multisynapse.cpp:65
iaf_psc_alpha_multisynapse()
Definition iaf_psc_alpha_multisynapse.cpp:249
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition iaf_psc_alpha_multisynapse.h:280
DataAccessFunctor< iaf_psc_alpha_multisynapse > get_data_access_functor(size_t elem)
Definition iaf_psc_alpha_multisynapse.cpp:84
double get_state_element(size_t elem)
Definition iaf_psc_alpha_multisynapse.h:292
State_ S_
Definition iaf_psc_alpha_multisynapse.h:281
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition iaf_psc_alpha_multisynapse.cpp:390
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition iaf_psc_alpha_multisynapse.cpp:283
void init_buffers_() override
Configure persistent internal data structures.
Definition iaf_psc_alpha_multisynapse.cpp:272
Variables_ V_
Definition iaf_psc_alpha_multisynapse.h:282
DynamicRecordablesMap< iaf_psc_alpha_multisynapse > recordablesMap_
Mapping of recordables names to access functions.
Definition iaf_psc_alpha_multisynapse.h:287
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition iaf_psc_alpha_multisynapse.cpp:378
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition iaf_psc_alpha_multisynapse.cpp:323
Buffers_ B_
Definition iaf_psc_alpha_multisynapse.h:283
size_t send_test_event(Node &, size_t, synindex, bool) override
Send an event to the receiving_node passed as an argument.
Definition iaf_psc_alpha_multisynapse.h:322
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition iaf_psc_alpha_multisynapse.cpp:417
void insert_current_recordables(size_t first=0)
Definition iaf_psc_alpha_multisynapse.cpp:73
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_alpha_multisynapse.h:351
friend class DynamicUniversalDataLogger< iaf_psc_alpha_multisynapse >
Definition iaf_psc_alpha_multisynapse.h:128
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 recordables("recordables")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_iaf_psc_alpha_multisynapse(const std::string &name)
Definition iaf_psc_alpha_multisynapse.cpp:45
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition iaf_psc_alpha_multisynapse.h:237
RingBuffer currents_
Definition iaf_psc_alpha_multisynapse.h:243
DynamicUniversalDataLogger< iaf_psc_alpha_multisynapse > logger_
Logger for all analog data.
Definition iaf_psc_alpha_multisynapse.h:246
std::vector< RingBuffer > spikes_
buffers and sums up incoming spikes/currents
Definition iaf_psc_alpha_multisynapse.h:242
Independent parameters of the model.
Definition iaf_psc_alpha_multisynapse.h:137
double Theta_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha_multisynapse.h:158
bool has_connections_
Definition iaf_psc_alpha_multisynapse.h:168
size_t n_receptors_() const
Returns the size of tau_syn_.
Definition iaf_psc_alpha_multisynapse.h:316
double LowerBound_
Lower bound, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_alpha_multisynapse.h:162
double V_reset_
Reset value of the membrane potential.
Definition iaf_psc_alpha_multisynapse.h:154
std::vector< double > tau_syn_
Time constants of synaptic currents in ms.
Definition iaf_psc_alpha_multisynapse.h:165
double refractory_time_
Refractory period in ms.
Definition iaf_psc_alpha_multisynapse.h:145
double I_e_
External current in pA.
Definition iaf_psc_alpha_multisynapse.h:151
double Tau_
Membrane time constant in ms.
Definition iaf_psc_alpha_multisynapse.h:139
double E_L_
Resting potential in mV.
Definition iaf_psc_alpha_multisynapse.h:148
double set(const Dictionary &, Node *node)
Set values from dictionary.
Definition iaf_psc_alpha_multisynapse.cpp:137
double C_
Membrane capacitance in pF.
Definition iaf_psc_alpha_multisynapse.h:142
void get(Dictionary &) const
Store current values in dictionary.
Definition iaf_psc_alpha_multisynapse.cpp:121
Parameters_()
Sets default parameter values.
Definition iaf_psc_alpha_multisynapse.cpp:93
State variables of the model.
Definition iaf_psc_alpha_multisynapse.h:188
std::vector< double > y2_syn_
Definition iaf_psc_alpha_multisynapse.h:213
void set(const Dictionary &, const Parameters_ &, const double, Node *)
Set values from dictionary.
Definition iaf_psc_alpha_multisynapse.cpp:220
State_()
Default initialization.
Definition iaf_psc_alpha_multisynapse.cpp:107
static const size_t NUMBER_OF_FIXED_STATES_ELEMENTS
Definition iaf_psc_alpha_multisynapse.h:208
void get(Dictionary &, const Parameters_ &) const
Definition iaf_psc_alpha_multisynapse.cpp:214
std::vector< double > y1_syn_
Definition iaf_psc_alpha_multisynapse.h:212
StateVecElems
Enumeration identifying recordable state elements.
Definition iaf_psc_alpha_multisynapse.h:202
@ I
Definition iaf_psc_alpha_multisynapse.h:204
@ I_SYN
Definition iaf_psc_alpha_multisynapse.h:205
@ V_M
Definition iaf_psc_alpha_multisynapse.h:203
double I_const_
Constant current.
Definition iaf_psc_alpha_multisynapse.h:211
double V_m_
This is the membrane potential RELATIVE TO RESTING POTENTIAL.
Definition iaf_psc_alpha_multisynapse.h:215
int refractory_steps_
Number of refractory steps remaining.
Definition iaf_psc_alpha_multisynapse.h:217
static const size_t NUM_STATE_ELEMENTS_PER_RECEPTOR
Definition iaf_psc_alpha_multisynapse.h:209
Internal variables of the model.
Definition iaf_psc_alpha_multisynapse.h:255
std::vector< double > P32_syn_
Definition iaf_psc_alpha_multisynapse.h:263
unsigned int receptor_types_size_
Definition iaf_psc_alpha_multisynapse.h:268
std::vector< double > P21_syn_
Definition iaf_psc_alpha_multisynapse.h:260
double P33_
Definition iaf_psc_alpha_multisynapse.h:266
std::vector< double > PSCInitialValues_
Definition iaf_psc_alpha_multisynapse.h:256
std::vector< double > P11_syn_
Definition iaf_psc_alpha_multisynapse.h:259
std::vector< double > P22_syn_
Definition iaf_psc_alpha_multisynapse.h:261
double P30_
Definition iaf_psc_alpha_multisynapse.h:265
std::vector< double > P31_syn_
Definition iaf_psc_alpha_multisynapse.h:262
int RefractoryCounts_
Definition iaf_psc_alpha_multisynapse.h:257