NEST main@caf0ae8
 
Loading...
Searching...
No Matches
diffusion_connection.h
Go to the documentation of this file.
1/*
2 * diffusion_connection.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 DIFFUSION_CONNECTION_H
24#define DIFFUSION_CONNECTION_H
25
26#include "connection.h"
27
28namespace nest
29{
30
31/* BeginUserDocs: synapse, abstract, rate
32
33Short description
34+++++++++++++++++
35
36Synapse type for instantaneous rate connections between neurons of type siegert_neuron
37
38Description
39+++++++++++
40
41``diffusion_connection`` is a connector to create
42instantaneous connections between neurons of type ``siegert_neuron``. The
43connection type is identical to type ``rate_connection_instantaneous``
44for instantaneous rate connections except for the two parameters
45``drift_factor`` and ``diffusion_factor`` substituting the parameter weight.
46
47These two factor origin from the mean-field reduction of networks of
48leaky-integrate-and-fire neurons. In this reduction the input to the
49neurons is characterized by its mean and its variance. The mean is
50obtained by a sum over presynaptic activities (e.g as in eq.28 in
51:footcite:p:`Hahne2017`), where each term of the sum consists of the presynaptic activity
52multiplied with the ``drift_factor``. Similarly, the variance is obtained
53by a sum over presynaptic activities (e.g as in eq.29 in :footcite:p:`Hahne2017`), where
54each term of the sum consists of the presynaptic activity multiplied
55with the ``diffusion_factor``. Note that in general the drift and
56diffusion factors might differ from the ones given in eq. 28 and 29.,
57for example in case of a reduction on the single neuron level or in
58case of distributed in-degrees (see discussion in chapter 5.2 of :footcite:p:`Hahne2017`)
59
60The values of the parameters delay and weight are ignored for
61connections of this type.
62
63Transmits
64+++++++++
65
66DiffusionConnectionEvent
67
68References
69++++++++++
70
71
72.. footbibliography::
73
74See also
75++++++++
76
77siegert_neuron, rate_connection_instantaneous
78
79Examples using this model
80+++++++++++++++++++++++++
81
82.. listexamples:: diffusion_connection
83
84EndUserDocs */
85
86void register_diffusion_connection( const std::string& name );
87
88template < typename targetidentifierT >
89class diffusion_connection : public Connection< targetidentifierT >
90{
91public:
92 // this line determines which common properties to use
95
97
104 , drift_factor_( 1.0 )
105 , diffusion_factor_( 1.0 )
106 {
107 }
108
109 std::unique_ptr< SecondaryEvent > get_secondary_event();
110
111 // Explicitly declare all methods inherited from the dependent base
112 // ConnectionBase.
113 // This avoids explicit name prefixes in all places these functions are used.
114 // Since ConnectionBase depends on the template parameter, they are not
115 // automatically
116 // found in the base class.
120
121 void
122 check_connection( Node& s, Node& t, size_t receptor_type, const CommonPropertiesType& )
123 {
125
126 s.sends_secondary_event( ge );
127 ge.set_sender( s );
128 Connection< targetidentifierT >::target_.set_rport( t.handles_test_event( ge, receptor_type ) );
130 }
131
137 bool
138 send( Event& e, size_t t, const CommonSynapseProperties& )
139 {
140 e.set_drift_factor( drift_factor_ );
141 e.set_diffusion_factor( diffusion_factor_ );
142 e.set_receiver( *get_target( t ) );
143 e.set_rport( get_rport() );
144 e();
145
146 return true;
147 }
148
149 void get_status( Dictionary& d ) const;
150
151 void set_status( const Dictionary& d, ConnectorModel& cm );
152
153 void
154 set_weight( double )
155 {
156 throw BadProperty(
157 "Please use the parameters drift_factor and "
158 "diffusion_factor to specifiy the weights." );
159 }
160
161 void
162 set_delay( double )
163 {
164 throw BadProperty( "diffusion_connection has no delay." );
165 }
166
167private:
168 double weight_;
171};
172
173template < typename targetidentifierT >
175
176template < typename targetidentifierT >
177void
179{
180 ConnectionBase::get_status( d );
181 d[ names::weight ] = weight_;
182 d[ names::drift_factor ] = drift_factor_;
183 d[ names::diffusion_factor ] = diffusion_factor_;
184 d[ names::size_of ] = static_cast< long >( sizeof( *this ) );
185}
186
187template < typename targetidentifierT >
188void
190{
191 // If the delay is set, we throw a BadProperty
192 if ( d.known( names::delay ) )
193 {
194 throw BadProperty( "diffusion_connection has no delay." );
195 }
196 // If the parameter weight is set, we throw a BadProperty
197 if ( d.known( names::weight ) )
198 {
199 throw BadProperty(
200 "Please use the parameters drift_factor and "
201 "diffusion_factor to specifiy the weights." );
202 }
203
204 ConnectionBase::set_status( d, cm );
205 d.update_value( names::drift_factor, drift_factor_ );
206 d.update_value( names::diffusion_factor, diffusion_factor_ );
207}
208
209
210template < typename targetidentifierT >
211std::unique_ptr< SecondaryEvent >
213{
214 return std::make_unique< DiffusionConnectionEvent >();
215}
216
217} // namespace
218
219#endif /* #ifndef DIFFUSION_CONNECTION_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition exceptions.h:680
Class containing the common properties for all connections of a certain type.
Definition common_synapse_properties.h:50
Base class for representing connections.
Definition connection.h:110
long get_delay_steps() const
Return the delay of the connection in steps.
Definition connection.h:181
Node * get_target(const size_t tid) const
Definition connection.h:239
size_t get_rport() const
Definition connection.h:244
Definition connector_model.h:69
Event for diffusion connections (rate model connections for the siegert_neuron).
Definition secondary_event.h:348
Encapsulate information sent between nodes.
Definition event.h:103
void set_sender(Node &)
Change pointer to sending Node.
Definition event.h:920
Base class for all NEST network objects.
Definition node.h:99
Definition diffusion_connection.h:90
void set_weight(double)
Definition diffusion_connection.h:154
Node * get_target(const size_t tid) const
Definition connection.h:239
double diffusion_factor_
Definition diffusion_connection.h:170
Connection< targetidentifierT > ConnectionBase
Definition diffusion_connection.h:94
size_t get_rport() const
Definition connection.h:244
void check_connection(Node &s, Node &t, size_t receptor_type, const CommonPropertiesType &)
Definition diffusion_connection.h:122
std::unique_ptr< SecondaryEvent > get_secondary_event()
Definition diffusion_connection.h:212
double drift_factor_
Definition diffusion_connection.h:169
static constexpr ConnectionModelProperties properties
Definition diffusion_connection.h:96
diffusion_connection()
Default Constructor.
Definition diffusion_connection.h:102
CommonSynapseProperties CommonPropertiesType
Definition diffusion_connection.h:93
bool send(Event &e, size_t t, const CommonSynapseProperties &)
Send an event to the receiver of this connection.
Definition diffusion_connection.h:138
void set_status(const Dictionary &d, ConnectorModel &cm)
Definition diffusion_connection.h:189
void set_delay(double)
Definition diffusion_connection.h:162
void get_status(Dictionary &d) const
Definition diffusion_connection.h:178
double weight_
Definition diffusion_connection.h:168
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 sends_secondary_event(GapJunctionEvent &ge)
Required to check, if source neuron may send a SecondaryEvent.
Definition node.cpp:381
const std::string delay("delay")
const std::string drift_factor("drift_factor")
const std::string weight("weight")
const std::string diffusion_factor("diffusion_factor")
const std::string size_of("sizeof")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_diffusion_connection(const std::string &name)
Definition diffusion_connection.cpp:32
ConnectionModelProperties
Definition connector_model.h:49