NEST main@caf0ae8
 
Loading...
Searching...
No Matches
tsodyks_synapse.h
Go to the documentation of this file.
1/*
2 * tsodyks_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 TSODYKS_SYNAPSE_H
24#define TSODYKS_SYNAPSE_H
25
26// C++ includes:
27#include <cmath>
28
29// Includes from nestkernel:
30#include "connection.h"
31
32namespace nest
33{
34
35/* BeginUserDocs: synapse, chemical, functional, stp, Tsodyks
36
37Short description
38+++++++++++++++++
39
40Synapse type with short term plasticity
41
42Description
43+++++++++++
44
45This synapse model implements synaptic short-term depression and short-term
46facilitation according to :footcite:p:`Tsodyks2000`. In particular it solves Eqs (3) and (4) from
47this paper in an exact manner.
48
49Synaptic depression is motivated by depletion of vesicles in the readily
50releasable pool of synaptic vesicles (variable x in equation (3)). Synaptic
51facilitation comes about by a presynaptic increase of release probability,
52which is modeled by variable U in Eq (4).
53
54The original interpretation of variable y is the amount of glutamate
55concentration in the synaptic cleft. In :footcite:p:`Tsodyks2000` this variable is taken to be
56directly proportional to the synaptic current caused in the postsynaptic
57neuron (with the synaptic weight w as a proportionality constant). In order
58to reproduce the results of :footcite:p:`Tsodyks2000` and to use this model of synaptic plasticity
59in its original sense, the user therefore has to ensure the following
60conditions:
61
621.) The postsynaptic neuron must be of type ``iaf_psc_exp`` or ``iaf_psc_exp_htum``,
63because these neuron models have a postsynaptic current which decays
64exponentially.
65
662.) The time constant of each ``tsodyks_synapse`` targeting a particular neuron
67must be chosen equal to that neuron's synaptic time constant. In particular
68that means that all synapses targeting a particular neuron have the same
69parameter ``tau_psc``.
70
71However, there are no technical restrictions using this model of synaptic
72plasticity also in conjunction with neuron models that have a different
73dynamics for their synaptic current or conductance. The effective synaptic
74weight, which will be transmitted to the postsynaptic neuron upon occurrence
75of a spike at time t is :math:`u(t) \cdot x(t) \cdot w`, where ``u(t)`` and ``x(t)``
76are defined in Eq (3) and (4), w is the synaptic weight specified upon connection.
77The interpretation is as follows: The quantity :math:`u(t) \cdot x(t)` is the release
78probability times the amount of releasable synaptic vesicles at time t of the
79presynaptic neuron's spike, so this equals the amount of transmitter expelled
80into the synaptic cleft.
81
82The amount of transmitter then relaxes back to 0 with time constant tau_psc
83of the synapse's variable y. Since the dynamics of ``y(t)`` is linear, the
84postsynaptic neuron can reconstruct from the amplitude of the synaptic
85impulse :math:`u(t) \cdot x(t) \cdot w` the full shape of ``y(t)``. The postsynaptic
86neuron, however, might choose to have a synaptic current that is not necessarily
87identical to the concentration of transmitter ``y(t)`` in the synaptic cleft. It may
88realize an arbitrary postsynaptic effect depending on ``y(t)``.
89
90.. warning::
91
92 This synaptic plasticity rule does not take
93 :ref:`precise spike timing <sim_precise_spike_times>` into
94 account. When calculating the weight update, the precise spike time part
95 of the timestamp is ignored.
96
97Parameters
98++++++++++
99
100The following parameters can be set in the status dictionary:
101
102======== ====== ========================================================
103 U real Parameter determining the increase in u with each spike
104 [0,1]
105 tau_psc ms Time constant of synaptic current
106 tau_fac ms Time constant for facilitation
107 tau_rec ms Time constant for depression
108 x real Initial fraction of synaptic vesicles in the readily
109 releasable pool [0,1]
110 y real Initial fraction of synaptic vesicles in the synaptic
111 cleft [0,1]
112 u real Initial release probability of synaptic vesicles [0,1]
113======== ====== ========================================================
114
115References
116++++++++++
117
118.. footbibliography::
119
120Transmits
121+++++++++
122
123SpikeEvent
124
125See also
126++++++++
127
128iaf_tum_2000, stdp_synapse, static_synapse, iaf_psc_exp
129
130Examples using this model
131+++++++++++++++++++++++++
132
133.. listexamples:: tsodyks_synapse
134
135EndUserDocs */
136
137void register_tsodyks_synapse( const std::string& name );
138
139template < typename targetidentifierT >
140class tsodyks_synapse : public Connection< targetidentifierT >
141{
142public:
145
149
155
160 tsodyks_synapse( const tsodyks_synapse& ) = default;
162
167 {
168 }
169
170 // Explicitly declare all methods inherited from the dependent base
171 // ConnectionBase. This avoids explicit name prefixes in all places these
172 // functions are used. Since ConnectionBase depends on the template parameter,
173 // they are not automatically found in the base class.
178
182 void get_status( Dictionary& d ) const;
183
187 void set_status( const Dictionary& d, ConnectorModel& cm );
188
194 bool send( Event& e, size_t t, const CommonSynapseProperties& cp );
195
197 {
198 public:
199 // Ensure proper overriding of overloaded virtual functions.
200 // Return values from functions are ignored.
202 size_t
203 handles_test_event( SpikeEvent&, size_t ) override
204 {
205 return invalid_port;
206 }
207 };
208
209 void
210 check_connection( Node& s, Node& t, size_t receptor_type, const CommonPropertiesType& )
211 {
212 ConnTestDummyNode dummy_target;
213 ConnectionBase::check_connection_( dummy_target, s, t, receptor_type );
214 }
215
216 void
217 set_weight( double w )
218 {
219 weight_ = w;
220 }
221
222private:
223 double weight_;
224 double tau_psc_;
225 double tau_fac_;
226 double tau_rec_;
227 double U_;
228 double x_;
229 double y_;
230 double u_;
232};
233
234template < typename targetidentifierT >
236
242template < typename targetidentifierT >
243inline bool
245{
246 const double t_spike = e.get_stamp().get_ms();
247 const double h = t_spike - t_lastspike_;
248
249 Node* target = get_target( t );
250
251
252 // t_lastspike_ = 0 initially
253 // this has no influence on the dynamics, IF y = z = 0 initially
254 // !!! x != 1.0 -> z != 0.0 -> t_lastspike_=0 has influence on dynamics
255
256 // propagator
257 double Puu = ( tau_fac_ == 0.0 ) ? 0.0 : std::exp( -h / tau_fac_ );
258 double Pyy = std::exp( -h / tau_psc_ );
259 double Pzz = std::expm1( -h / tau_rec_ );
260 double Pxy = ( Pzz * tau_rec_ - ( Pyy - 1.0 ) * tau_psc_ ) / ( tau_psc_ - tau_rec_ );
261
262 double z = 1.0 - x_ - y_;
263
264 // propagation t_lastspike_ -> t_spike
265 // don't change the order !
266
267 u_ *= Puu;
268 x_ += Pxy * y_ - Pzz * z;
269 y_ *= Pyy;
270
271 // delta function u
272 u_ += U_ * ( 1.0 - u_ );
273
274 // postsynaptic current step caused by incoming spike
275 double delta_y_tsp = u_ * x_;
276
277 // delta function x, y
278 x_ -= delta_y_tsp;
279 y_ += delta_y_tsp;
280
281
282 e.set_receiver( *target );
283 e.set_weight( delta_y_tsp * weight_ );
284 e.set_delay_steps( get_delay_steps() );
285 e.set_rport( get_rport() );
286 e();
287
288 t_lastspike_ = t_spike;
289
290 return true;
291}
292
293template < typename targetidentifierT >
296 , weight_( 1.0 )
297 , tau_psc_( 3.0 )
298 , tau_fac_( 0.0 )
299 , tau_rec_( 800.0 )
300 , U_( 0.5 )
301 , x_( 1.0 )
302 , y_( 0.0 )
303 , u_( 0.0 )
304 , t_lastspike_( 0.0 )
305{
306}
307
308template < typename targetidentifierT >
309void
311{
312 ConnectionBase::get_status( d );
313 d[ names::weight ] = weight_;
314 d[ names::U ] = U_;
315 d[ names::tau_psc ] = tau_psc_;
316 d[ names::tau_rec ] = tau_rec_;
317 d[ names::tau_fac ] = tau_fac_;
318 d[ names::x ] = x_;
319 d[ names::y ] = y_;
320 d[ names::u ] = u_;
321 d[ names::size_of ] = static_cast< long >( sizeof( *this ) );
322}
323
324template < typename targetidentifierT >
325void
327{
328 // Handle parameters that may throw an exception first, so we can leave the
329 // synapse untouched
330 // in case of invalid parameter values
331 double x = x_;
332 double y = y_;
333 d.update_value( names::x, x );
334 d.update_value( names::y, y );
335
336 if ( x + y > 1.0 )
337 {
338 throw BadProperty( "x + y must be <= 1.0." );
339 }
340
341 x_ = x;
342 y_ = y;
343
344 ConnectionBase::set_status( d, cm );
345 d.update_value( names::weight, weight_ );
346
347 d.update_value( names::U, U_ );
348 if ( U_ > 1.0 or U_ < 0.0 )
349 {
350 throw BadProperty( "'U' must be in [0,1]." );
351 }
352
353 d.update_value( names::tau_psc, tau_psc_ );
354 if ( tau_psc_ <= 0.0 )
355 {
356 throw BadProperty( "'tau_psc' must be > 0." );
357 }
358
359 d.update_value( names::tau_rec, tau_rec_ );
360 if ( tau_rec_ <= 0.0 )
361 {
362 throw BadProperty( "'tau_rec' must be > 0." );
363 }
364
365 d.update_value( names::tau_fac, tau_fac_ );
366 if ( tau_fac_ < 0.0 )
367 {
368 throw BadProperty( "'tau_fac' must be >= 0." );
369 }
370
371 d.update_value( names::u, u_ );
372 if ( u_ > 1.0 or u_ < 0.0 )
373 {
374 throw BadProperty( "'u' must be in [0,1]." );
375 }
376}
377
378} // namespace
379
380#endif // TSODYKS_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 tsodyks_synapse.h:197
size_t handles_test_event(SpikeEvent &, size_t) override
Check if the node can handle a particular event and receptor type.
Definition tsodyks_synapse.h:203
Definition tsodyks_synapse.h:141
double tau_psc_
[ms] time constant of postsyn current
Definition tsodyks_synapse.h:224
CommonSynapseProperties CommonPropertiesType
Definition tsodyks_synapse.h:143
tsodyks_synapse & operator=(const tsodyks_synapse &)=default
double u_
actual probability of release
Definition tsodyks_synapse.h:230
double t_lastspike_
time point of last spike emitted
Definition tsodyks_synapse.h:231
double tau_rec_
[ms] time constant for recovery
Definition tsodyks_synapse.h:226
static constexpr ConnectionModelProperties properties
Definition tsodyks_synapse.h:146
void get_status(Dictionary &d) const
Get all properties of this connection and put them into a dictionary.
Definition tsodyks_synapse.h:310
double weight_
Definition tsodyks_synapse.h:223
double U_
asymptotic value of probability of release
Definition tsodyks_synapse.h:227
double x_
amount of resources in recovered state
Definition tsodyks_synapse.h:228
tsodyks_synapse(const tsodyks_synapse &)=default
Copy constructor from a property object.
double tau_fac_
[ms] time constant for facilitation
Definition tsodyks_synapse.h:225
void check_connection(Node &s, Node &t, size_t receptor_type, const CommonPropertiesType &)
Definition tsodyks_synapse.h:210
double y_
amount of resources in active state
Definition tsodyks_synapse.h:229
Connection< targetidentifierT > ConnectionBase
Definition tsodyks_synapse.h:144
bool send(Event &e, size_t t, const CommonSynapseProperties &cp)
Send an event to the receiver of this connection.
Definition tsodyks_synapse.h:244
tsodyks_synapse()
Default Constructor.
Definition tsodyks_synapse.h:294
~tsodyks_synapse()
Default Destructor.
Definition tsodyks_synapse.h:166
void set_weight(double w)
Definition tsodyks_synapse.h:217
void set_status(const Dictionary &d, ConnectorModel &cm)
Set properties of this connection from the values given in dictionary.
Definition tsodyks_synapse.h:326
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 u("u")
const std::string x("x")
const std::string tau_fac("tau_fac")
const std::string y("y")
const std::string weight("weight")
const std::string U("U")
const std::string size_of("sizeof")
const std::string tau_psc("tau_psc")
const std::string tau_rec("tau_rec")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_tsodyks_synapse(const std::string &name)
Definition tsodyks_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