NEST main@caf0ae8
 
Loading...
Searching...
No Matches
ht_synapse.h
Go to the documentation of this file.
1/*
2 * ht_synapse.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 HT_SYNAPSE_H
24#define HT_SYNAPSE_H
25
26// Includes from nestkernel:
27#include "connection.h"
28
29namespace nest
30{
31
32/* BeginUserDocs: synapse, chemical, functional, stp, Hill-Tononi
33
34Short description
35+++++++++++++++++
36
37Synapse with depression after Hill & Tononi (2005)
38
39Description
40+++++++++++
41
42This synapse implements the depression model described in :footcite:p:`Hill2005`, p 1678.
43
44Synaptic dynamics are given by
45
46.. math::
47
48 \frac{dP(t)}{dt} &= \frac{1}{\tau_\mathrm{P}} \left( 1 - P \right) \\
49 P(t=0) &= 1 \\
50
51Upon the arrival of a presynaptic spike at time :math:`t_\mathrm{sp}`, the value of :math:`P` is updated as follows:
52
53.. math::
54
55 P \leftarrow (1 - \delta_\mathrm{P}) P
56
57:math:`w(t) = w_\mathrm{max} \cdot P(t)` is the resulting synaptic weight.
58
59For implementation details see:
60`HillTononi_model <../model_details/HillTononiModels.ipynb>`_
61
62.. warning::
63
64 This synaptic plasticity rule does not take
65 :ref:`precise spike timing <sim_precise_spike_times>` into
66 account. When calculating the weight update, the precise spike time part
67 of the timestamp is ignored.
68
69Parameters
70++++++++++
71
72The following parameters can be set in the status dictionary:
73
74======== ====== =========================================================
75 tau_P ms Synaptic vesicle pool recovery time constant
76 delta_P real Fractional change in vesicle pool on incoming spikes
77 (unitless)
78 P real Current size of the vesicle pool (unitless, 0 <= P <= 1)
79======== ====== =========================================================
80
81References
82++++++++++
83
84.. footbibliography::
85
86Transmits
87+++++++++
88
89SpikeEvent
90
91See also
92++++++++
93
94ht_neuron, tsodyks_synapse, stdp_synapse, static_synapse
95
96Examples using this model
97+++++++++++++++++++++++++
98
99.. listexamples:: ht_synapse
100
101EndUserDocs */
102
103void register_ht_synapse( const std::string& name );
104
105template < typename targetidentifierT >
106class ht_synapse : public Connection< targetidentifierT >
107{
108public:
111
115
120 ht_synapse();
121
126 ht_synapse( const ht_synapse& ) = default;
127
128 // Explicitly declare all methods inherited from the dependent base
129 // ConnectionBase. This avoids explicit name prefixes in all places these
130 // functions are used. Since ConnectionBase depends on the template parameter,
131 // they are not automatically found in the base class.
136
140 virtual ~ht_synapse()
141 {
142 }
143
147 virtual void get_status( Dictionary& d ) const;
148
152 virtual void set_status( const Dictionary& d, ConnectorModel& cm );
153
159 bool send( Event& e, size_t t, const CommonSynapseProperties& cp );
160
162 {
163 public:
164 // Ensure proper overriding of overloaded virtual functions.
165 // Return values from functions are ignored.
167 size_t
168 handles_test_event( SpikeEvent&, size_t ) override
169 {
170 return invalid_port;
171 }
172 };
173
174 void
175 check_connection( Node& s, Node& t, size_t receptor_type, const CommonPropertiesType& )
176 {
177 ConnTestDummyNode dummy_target;
178 ConnectionBase::check_connection_( dummy_target, s, t, receptor_type );
179 }
180
182 void
183 set_weight( double w )
184 {
185 weight_ = w;
186 }
187
188private:
189 double weight_;
190
191 double tau_P_;
192 double delta_P_;
193
194 double p_;
195
197};
198
199template < typename targetidentifierT >
201
207template < typename targetidentifierT >
208inline bool
210{
211 // propagation t_lastspike -> t_spike, t_lastspike_ = 0 initially, p_ = 1
212 const double t_spike = e.get_stamp().get_ms();
213 const double h = t_spike - t_lastspike_;
214 p_ = 1 - ( 1 - p_ ) * std::exp( -h / tau_P_ );
215
216 // send the spike to the target
217 e.set_receiver( *get_target( t ) );
218 e.set_weight( weight_ * p_ );
219 e.set_delay_steps( get_delay_steps() );
220 e.set_rport( get_rport() );
221 e();
222
223 // reduce pool after spike is sent
224 p_ *= ( 1 - delta_P_ );
225
226 t_lastspike_ = t_spike;
227
228 return true;
229}
230
231template < typename targetidentifierT >
234 , weight_( 1.0 )
235 , tau_P_( 500.0 )
236 , delta_P_( 0.125 )
237 , p_( 1.0 )
238 , t_lastspike_( 0.0 )
239{
240}
241
242template < typename targetidentifierT >
243void
245{
246 ConnectionBase::get_status( d );
247 d[ names::weight ] = weight_;
248 d[ names::tau_P ] = tau_P_;
249 d[ names::delta_P ] = delta_P_;
250 d[ names::P ] = p_;
251 d[ names::size_of ] = static_cast< long >( sizeof( *this ) );
252}
253
254template < typename targetidentifierT >
255void
257{
258 ConnectionBase::set_status( d, cm );
259
260 d.update_value( names::weight, weight_ );
261 d.update_value( names::tau_P, tau_P_ );
262 d.update_value( names::delta_P, delta_P_ );
263 d.update_value( names::P, p_ );
264
265 if ( tau_P_ <= 0.0 )
266 {
267 throw BadProperty( "tau_P > 0 required." );
268 }
269
270 if ( delta_P_ < 0.0 or delta_P_ > 1.0 )
271 {
272 throw BadProperty( "0 <= delta_P <= 1 required." );
273 }
274
275 if ( p_ < 0.0 or p_ > 1.0 )
276 {
277 throw BadProperty( "0 <= P <= 1 required." );
278 }
279}
280
281} // namespace
282
283#endif // HT_SYNAPSE_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 dummy nodes used in connection testing.
Definition connection.h:67
Base class for representing connections.
Definition connection.h:110
void check_connection_(Node &dummy_target, Node &source, Node &target, const size_t receptor_type)
This function calls check_connection() on the sender to check if the receiver accepts the event type ...
Definition connection.h:319
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
double get_delay() const
Return the delay of the connection in ms.
Definition connection.h:172
Definition connector_model.h:69
Encapsulate information sent between nodes.
Definition event.h:103
Base class for all NEST network objects.
Definition node.h:99
Event for spike information.
Definition event.h:418
Definition ht_synapse.h:162
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition ht_synapse.h:168
Definition ht_synapse.h:107
Connection< targetidentifierT > ConnectionBase
Definition ht_synapse.h:110
double t_lastspike_
Time point of last spike emitted.
Definition ht_synapse.h:196
ht_synapse()
Default Constructor.
Definition ht_synapse.h:232
void set_weight(double w)
allows efficient initialization from ConnectorModel::add_connection()
Definition ht_synapse.h:183
virtual void set_status(const Dictionary &d, ConnectorModel &cm)
Set properties of this connection from the values given in dictionary.
Definition ht_synapse.h:256
static constexpr ConnectionModelProperties properties
Definition ht_synapse.h:112
double weight_
Synaptic weight.
Definition ht_synapse.h:189
bool send(Event &e, size_t t, const CommonSynapseProperties &cp)
Send an event to the receiver of this connection.
Definition ht_synapse.h:209
double tau_P_
Time constant for recovery [ms].
Definition ht_synapse.h:191
double p_
Current pool size.
Definition ht_synapse.h:194
ht_synapse(const ht_synapse &)=default
Copy constructor.
double delta_P_
Fractional decrease in pool size per spike.
Definition ht_synapse.h:192
CommonSynapseProperties CommonPropertiesType
Definition ht_synapse.h:109
void check_connection(Node &s, Node &t, size_t receptor_type, const CommonPropertiesType &)
Definition ht_synapse.h:175
virtual void get_status(Dictionary &d) const
Get all properties of this connection and put them into a dictionary.
Definition ht_synapse.h:244
virtual ~ht_synapse()
Default Destructor.
Definition ht_synapse.h:140
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
const std::string tau_P("tau_P")
const std::string P("P")
const std::string delta_P("delta_P")
const std::string weight("weight")
const std::string size_of("sizeof")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_ht_synapse(const std::string &name)
Definition ht_synapse.cpp:32
ConnectionModelProperties
Definition connector_model.h:49
constexpr size_t invalid_port
Value for invalid connection port number.
Definition nest_types.h:141