NEST main@caf0ae8
 
Loading...
Searching...
No Matches
iaf_psc_exp_multisynapse.h
Go to the documentation of this file.
1/*
2 * iaf_psc_exp_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_EXP_MULTISYNAPSE_H
24#define IAF_PSC_EXP_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, hard threshold
42
43Short description
44+++++++++++++++++
45
46Leaky integrate-and-fire neuron model with multiple ports
47
48Description
49+++++++++++
50
51``iaf_psc_exp_multisynapse`` is a direct extension of iaf_psc_exp.
52On the postsynaptic side, there can be arbitrarily many synaptic
53time constants (``iaf_psc_exp`` 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
62 If ``tau_m`` is very close to ``tau_syn_ex`` or ``tau_syn_in``, the model
63 will numerically behave as if ``tau_m`` is equal to ``tau_syn_ex`` or
64 ``tau_syn_in``, respectively, to avoid numerical instabilities.
65
66 For implementation details see the
67 `IAF Integration Singularity notebook <../model_details/IAF_Integration_Singularity.ipynb>`_.
68
69For conversion between postsynaptic potentials (PSPs) and PSCs,
70please refer to the ``postsynaptic_potential_to_current`` function in
71`PyNEST Microcircuit: Helper Functions
72<https://github.com/INM-6/microcircuit-PD14-model/blob/main/PyNEST/src/microcircuit/helpers.py>`_.
73
74Sends
75+++++
76
77SpikeEvent
78
79Receives
80++++++++
81
82SpikeEvent, CurrentEvent, DataLoggingRequest
83
84See also
85++++++++
86
87iaf_psc_alpha, iaf_psc_delta, iaf_psc_exp, iaf_cond_exp, iaf_psc_alpha_multisynapse
88
89Examples using this model
90+++++++++++++++++++++++++
91
92.. listexamples:: iaf_psc_exp_multisynapse
93
94EndUserDocs */
95
96void register_iaf_psc_exp_multisynapse( const std::string& name );
97
99{
100
101public:
104
110 using Node::handle;
112
113 size_t send_test_event( Node&, size_t, synindex, bool ) override;
114
115 void handle( SpikeEvent& ) override;
116 void handle( CurrentEvent& ) override;
117 void handle( DataLoggingRequest& ) override;
118
119 size_t handles_test_event( SpikeEvent&, size_t ) override;
120 size_t handles_test_event( CurrentEvent&, size_t ) override;
121 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
122
123 void get_status( Dictionary& ) const override;
124 void set_status( const Dictionary& ) override;
125
126private:
127 void init_buffers_() override;
128 void pre_run_hook() override;
129
130 void update( Time const&, const long, const long ) override;
131
132 // The next two classes need to be friends to access the State_ class/member
134 friend class DynamicUniversalDataLogger< iaf_psc_exp_multisynapse >;
136
137 // ----------------------------------------------------------------
138
143 {
145 double Tau_;
146
148 double C_;
149
152
154 double E_L_;
155
157 double I_e_;
158
160 double V_reset_;
161
164 double Theta_;
165
167 std::vector< double > tau_syn_;
168
169 // boolean flag which indicates whether the neuron has connections
171
172 size_t n_receptors_() const;
173
174 Parameters_();
175
176 void get( Dictionary& ) const;
177
181 double set( const Dictionary&, Node* node );
182 }; // Parameters_
183
184 // ----------------------------------------------------------------
185
189 struct State_
190 {
204 {
205 V_M = 0,
206 I, // 1
207 I_SYN // 2
208 };
209
210 static const size_t NUMBER_OF_FIXED_STATES_ELEMENTS = I_SYN; // V_M, I
211 static const size_t NUM_STATE_ELEMENTS_PER_RECEPTOR = 1; // I_SYN
212
213 double I_const_;
214 std::vector< double > i_syn_;
215 double V_m_;
216
219
220 State_();
221
222 void get( Dictionary&, const Parameters_& ) const;
223
229 void set( const Dictionary&, const Parameters_&, const double, Node* );
230 }; // State_
231
232 // ----------------------------------------------------------------
233
249
250 // ----------------------------------------------------------------
251
256 {
262 // double PSCInitialValue_;
263
264 // time evolution operator
265 std::vector< double > P11_syn_;
266 std::vector< double > P21_syn_;
267 double P20_;
268 double P22_;
269
271
273
274 }; // Variables
275
290
291 // Data Access Functor getter
293 inline double
294 get_state_element( size_t elem )
295 {
296 if ( elem == State_::V_M )
297 {
298 return S_.V_m_ + P_.E_L_;
299 }
300 else if ( elem == State_::I )
301 {
302 return std::accumulate( S_.i_syn_.begin(), S_.i_syn_.end(), 0.0 );
303 }
304 else
305 {
307 }
308 };
309
310 // Utility function that inserts the synaptic conductances to the
311 // recordables map
312
313 std::string get_i_syn_name( size_t elem );
314 void insert_current_recordables( size_t first = 0 );
315};
316
317inline size_t
322
323inline size_t
324iaf_psc_exp_multisynapse::send_test_event( Node& target, size_t receptor_type, synindex, bool )
325{
326 SpikeEvent e;
327 e.set_sender( *this );
328
329 return target.handles_test_event( e, receptor_type );
330}
331
332inline size_t
334{
335 if ( receptor_type != 0 )
336 {
337 throw UnknownReceptorType( receptor_type, get_name() );
338 }
339 return 0;
340}
341
342inline size_t
344{
345 if ( receptor_type != 0 )
346 {
347 throw UnknownReceptorType( receptor_type, get_name() );
348 }
349 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
350}
351
352inline void
354{
355 P_.get( d );
356 S_.get( d, P_ );
358
359 d[ names::recordables ] = recordablesMap_.get_list();
360}
361
362} // namespace
363
364#endif /* #ifndef IAF_PSC_EXP_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_exp_multisynapse.h:99
void pre_run_hook() override
Re-calculate dependent parameters of the node.
Definition iaf_psc_exp_multisynapse.cpp:270
void init_buffers_() override
Configure persistent internal data structures.
Definition iaf_psc_exp_multisynapse.cpp:259
State_ S_
Definition iaf_psc_exp_multisynapse.h:283
DataAccessFunctor< iaf_psc_exp_multisynapse > get_data_access_functor(size_t elem)
Definition iaf_psc_exp_multisynapse.cpp:81
friend class DynamicUniversalDataLogger< iaf_psc_exp_multisynapse >
Definition iaf_psc_exp_multisynapse.h:134
void handle(SpikeEvent &) override
Handle incoming spike events.
Definition iaf_psc_exp_multisynapse.cpp:359
Buffers_ B_
Definition iaf_psc_exp_multisynapse.h:285
Variables_ V_
Definition iaf_psc_exp_multisynapse.h:284
double get_state_element(size_t elem)
Definition iaf_psc_exp_multisynapse.h:294
void set_status(const Dictionary &) override
Change properties of the node according to the entries in the dictionary.
Definition iaf_psc_exp_multisynapse.cpp:386
DynamicRecordablesMap< iaf_psc_exp_multisynapse > recordablesMap_
Mapping of recordables names to access functions.
Definition iaf_psc_exp_multisynapse.h:289
std::string get_i_syn_name(size_t elem)
Definition iaf_psc_exp_multisynapse.cpp:62
void get_status(Dictionary &) const override
Export properties of the node by setting entries in the status dictionary.
Definition iaf_psc_exp_multisynapse.h:353
iaf_psc_exp_multisynapse()
Definition iaf_psc_exp_multisynapse.cpp:236
Parameters_ P_
Instances of private data structures for the different types of data pertaining to the model.
Definition iaf_psc_exp_multisynapse.h:282
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_exp_multisynapse.h:324
void update(Time const &, const long, const long) override
Advance the state of the node in time through the given interval.
Definition iaf_psc_exp_multisynapse.cpp:300
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition iaf_psc_exp_multisynapse.cpp:347
void insert_current_recordables(size_t first=0)
Definition iaf_psc_exp_multisynapse.cpp:70
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_exp_multisynapse(const std::string &name)
Definition iaf_psc_exp_multisynapse.cpp:42
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Buffers of the model.
Definition iaf_psc_exp_multisynapse.h:238
DynamicUniversalDataLogger< iaf_psc_exp_multisynapse > logger_
Logger for all analog data.
Definition iaf_psc_exp_multisynapse.h:247
std::vector< RingBuffer > spikes_
buffers and sums up incoming spikes/currents
Definition iaf_psc_exp_multisynapse.h:243
RingBuffer currents_
Definition iaf_psc_exp_multisynapse.h:244
Independent parameters of the model.
Definition iaf_psc_exp_multisynapse.h:143
double Tau_
Membrane time constant in ms.
Definition iaf_psc_exp_multisynapse.h:145
double refractory_time_
Refractory period in ms.
Definition iaf_psc_exp_multisynapse.h:151
std::vector< double > tau_syn_
Time constants of synaptic currents in ms.
Definition iaf_psc_exp_multisynapse.h:167
Parameters_()
Sets default parameter values.
Definition iaf_psc_exp_multisynapse.cpp:90
double Theta_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition iaf_psc_exp_multisynapse.h:164
double V_reset_
Reset value of the membrane potential.
Definition iaf_psc_exp_multisynapse.h:160
double set(const Dictionary &, Node *node)
Set values from dictionary.
Definition iaf_psc_exp_multisynapse.cpp:131
double I_e_
External current in pA.
Definition iaf_psc_exp_multisynapse.h:157
double C_
Membrane capacitance in pF.
Definition iaf_psc_exp_multisynapse.h:148
bool has_connections_
Definition iaf_psc_exp_multisynapse.h:170
double E_L_
Resting potential in mV.
Definition iaf_psc_exp_multisynapse.h:154
size_t n_receptors_() const
Returns the size of tau_syn_.
Definition iaf_psc_exp_multisynapse.h:318
void get(Dictionary &) const
Store current values in dictionary.
Definition iaf_psc_exp_multisynapse.cpp:116
State variables of the model.
Definition iaf_psc_exp_multisynapse.h:190
double I_const_
synaptic dc input current, variable 0
Definition iaf_psc_exp_multisynapse.h:213
double V_m_
membrane potential, variable 2
Definition iaf_psc_exp_multisynapse.h:215
State_()
Default initialization.
Definition iaf_psc_exp_multisynapse.cpp:103
int refractory_steps_
absolute refractory counter (no membrane potential propagation)
Definition iaf_psc_exp_multisynapse.h:218
StateVecElems
Enumeration identifying recordable state elements.
Definition iaf_psc_exp_multisynapse.h:204
@ V_M
Definition iaf_psc_exp_multisynapse.h:205
@ I
Definition iaf_psc_exp_multisynapse.h:206
@ I_SYN
Definition iaf_psc_exp_multisynapse.h:207
void set(const Dictionary &, const Parameters_ &, const double, Node *)
Set values from dictionary.
Definition iaf_psc_exp_multisynapse.cpp:207
static const size_t NUM_STATE_ELEMENTS_PER_RECEPTOR
Definition iaf_psc_exp_multisynapse.h:211
static const size_t NUMBER_OF_FIXED_STATES_ELEMENTS
Definition iaf_psc_exp_multisynapse.h:210
std::vector< double > i_syn_
Definition iaf_psc_exp_multisynapse.h:214
void get(Dictionary &, const Parameters_ &) const
Definition iaf_psc_exp_multisynapse.cpp:201
Internal variables of the model.
Definition iaf_psc_exp_multisynapse.h:256
unsigned int receptor_types_size_
Definition iaf_psc_exp_multisynapse.h:272
double P22_
Definition iaf_psc_exp_multisynapse.h:268
int RefractoryCounts_
Definition iaf_psc_exp_multisynapse.h:270
std::vector< double > P11_syn_
Amplitude of the synaptic current.
Definition iaf_psc_exp_multisynapse.h:265
double P20_
Definition iaf_psc_exp_multisynapse.h:267
std::vector< double > P21_syn_
Definition iaf_psc_exp_multisynapse.h:266