Skip to content

Commit

Permalink
fix third-factor plasticity buffering and add third factor plasticity…
Browse files Browse the repository at this point in the history
… tutorial
  • Loading branch information
C.A.P. Linssen committed May 5, 2024
1 parent 890fe1d commit 19e6682
Show file tree
Hide file tree
Showing 4 changed files with 641 additions and 249 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1271,9 +1271,13 @@ void
generate getter functions for the transferred variables
#}

{%- for var in transferred_variables %}
{%- for var in transferred_variables + state_vars_that_need_post_spike_buffering %}
{%- with variable_symbol = transferred_variables_syms[var] %}

{%- if not variable_symbol %}
{%- set variable_symbol = astnode.get_scope().resolve_to_symbol(var, SymbolKind.VARIABLE) %}
{%- endif %}

{%- if not var == variable_symbol.get_symbol_name() %}
{{ raise('Error in resolving variable to symbol') }}
{%- endif %}
Expand Down Expand Up @@ -1330,9 +1334,11 @@ double
recompute_internal_variables(true);

{# emulate a call to ``integrate_odes(analytic_state_variables_moved)`` #}
{%- set args = utils.resolve_variables_to_expressions(astnode, analytic_state_variables_moved) %}
{%- set ast = ASTNodeFactory.create_ast_function_call("integrate_odes", args) %}
{%- include "directives_cpp/PredefinedFunction_integrate_odes.jinja2" %}
{%- filter indent(8, True) %}
{%- set args = utils.resolve_variables_to_expressions(astnode, analytic_state_variables_moved) %}
{%- set ast = ASTNodeFactory.create_ast_function_call("integrate_odes", args) %}
{%- include "directives_cpp/PredefinedFunction_integrate_odes.jinja2" %}
{%- endfilter %}

V_.__h = old___h;
recompute_internal_variables(true);
Expand Down Expand Up @@ -1384,19 +1390,22 @@ double
**/

{%- if analytic_state_variables_moved | length > 0 %}

const double old___h = V_.__h;
V_.__h = t; // from time 0 to the requested time
assert(V_.__h > 0);
recompute_internal_variables(true);
if (t > 1E-12)
{
const double old___h = V_.__h;
V_.__h = t; // from time 0 to the requested time
recompute_internal_variables(true);

{# emulate a call to ``integrate_odes(analytic_state_variables_moved)`` #}
{%- filter indent(8, True) %}
{%- set args = utils.resolve_variables_to_expressions(astnode, analytic_state_variables_moved) %}
{%- set ast = ASTNodeFactory.create_ast_function_call("integrate_odes", args) %}
{%- include "directives_cpp/PredefinedFunction_integrate_odes.jinja2" %}
{%- endfilter %}

V_.__h = old___h;
recompute_internal_variables(true);
V_.__h = old___h;
recompute_internal_variables(true);
}
{%- endif %}

return {{ printer.print(utils.get_variable_by_name(astnode, var)) }};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public:

/* getters/setters for variables transferred from synapse */

{%- for var in transferred_variables %}
{%- for var in transferred_variables + state_vars_that_need_post_spike_buffering %}
double get_{{var}}( double t, const bool before_increment = true );
{%- endfor %}
{%- endif %}
Expand Down Expand Up @@ -457,7 +457,7 @@ private:
std::deque< histentry__{{neuronName}} > history_;

// cache for initial values
{%- for var in transferred_variables %}
{%- for var in transferred_variables + state_vars_that_need_post_spike_buffering %}
double {{var}}__iv;
{%- endfor %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ public:
}

#ifdef DEBUG
std::cout << "\tprocessing post spike at t = " << start->t_ << std::endl;
std::cout << "\tprocessing post spike at t = " << start->t_ + __dendritic_delay << std::endl;
#endif

/**
Expand Down Expand Up @@ -820,7 +820,7 @@ public:

{%- for var_name in paired_neuron.state_vars_that_need_post_spike_buffering %}
{%- set var_name_post = utils.get_var_name_tuples_of_neuron_synapse_pair(continuous_post_ports, var_name) %}
const double __{{ var_name }} = ((post_neuron_t*)(__target))->get_{{ var_name_post }}();
const double __{{ var_name }} = ((post_neuron_t*)(__target))->get_{{ var_name_post }}(_tr_t);
{%- endfor %}
{%- endif %}
{%- endif %}
Expand Down Expand Up @@ -866,7 +866,7 @@ public:

{%- for var_name in paired_neuron.state_vars_that_need_post_spike_buffering %}
{%- set var_name_post = utils.get_var_name_tuples_of_neuron_synapse_pair(continuous_post_ports, var_name) %}
const double __{{ var_name }} = ((post_neuron_t*)(__target))->get_{{ var_name_post }}();
const double __{{ var_name }} = ((post_neuron_t*)(__target))->get_{{ var_name_post }}(_tr_t);
{%- endfor %}
{%- endif %}
{%- endif %}
Expand Down

0 comments on commit 19e6682

Please sign in to comment.