Skip to content

Commit

Permalink
change third factor STDP plasticity unit test into a notebook tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
C.A.P. Linssen committed Dec 21, 2023
1 parent a90d571 commit f862bad
Show file tree
Hide file tree
Showing 6 changed files with 6,691 additions and 245 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion models/neurons/iaf_psc_exp_dend_neuron.nestml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ See also

iaf_cond_exp
"""
model iaf_psc_exp_dend:
model iaf_psc_exp_dend_neuron:

state:
V_m mV = E_L # Membrane potential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,37 @@ const {{ type_symbol_printer.print(var_symbol.type_symbol) }} {{variable_name}}_
}
{%- if state_vars_that_need_continuous_buffering | length > 0 %}

void {{neuronName}}::get_continuous_variable_history( double t1,
double t2,
std::deque< continuous_variable_histentry_{{ neuronName }} >::iterator* start,
std::deque< continuous_variable_histentry_{{ neuronName }} >::iterator* finish )
{
*finish = continuous_variable_history_.end();
if ( continuous_variable_history_.empty() )
{
*start = *finish;
return;
}
else
{
std::deque< continuous_variable_histentry_{{ neuronName }} >::iterator runner = continuous_variable_history_.begin();

// To have a well defined discretization of the integral, we make sure
// that we exclude the entry at t1 but include the one at t2 by subtracting
// a small number so that runner->t_ is never equal to t1 or t2.
while ( ( runner != continuous_variable_history_.end() ) and runner->t_ - 1.0e-6 < t1 )
{
++runner;
}
*start = runner;
while ( ( runner != continuous_variable_history_.end() ) and runner->t_ - 1.0e-6 < t2 )
{
( runner->access_counter_ )++;
++runner;
}
*finish = runner;
}
}

void {{neuronName}}::write_continuous_variable_history(nest::Time const &t,
{%- for state_var in state_vars_that_need_continuous_buffering %}
Expand All @@ -988,6 +1019,20 @@ void {{neuronName}}::write_continuous_variable_history(nest::Time const &t,
{
const double t_ms = t.get_ms();

// prune all entries from history which are no longer needed
// except the penultimate one. we might still need it.
while ( continuous_variable_history_.size() > 1 )
{
if ( continuous_variable_history_.front().access_counter_ >= n_incoming_ )
{
continuous_variable_history_.pop_front();
}
else
{
break;
}
}

continuous_variable_history_.push_back( continuous_variable_histentry_{{ neuronName }}( t_ms,
{%- for state_var in state_vars_that_need_continuous_buffering %}
{{ state_var }}{% if not loop.last %}, {% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,13 @@ public:
const double {{ state_var }}{% if not loop.last %}, {% endif %}
{%- endfor %});

std::vector< continuous_variable_histentry_{{ neuronName }} > continuous_variable_history_;
void get_continuous_variable_history( double t1,
double t2,
std::deque< continuous_variable_histentry_{{ neuronName }} >::iterator* start,
std::deque< continuous_variable_histentry_{{ neuronName }} >::iterator* finish );


std::deque< continuous_variable_histentry_{{ neuronName }} > continuous_variable_history_;
{%- endif %}

{%- endif %}
Expand Down
243 changes: 0 additions & 243 deletions tests/nest_tests/third_factor_stdp_synapse_test.py

This file was deleted.

0 comments on commit f862bad

Please sign in to comment.