Skip to content

Time-driven synapse #1332

@beatriiz-barros

Description

@beatriiz-barros

Hi! I'm trying to implement a time-driven synapse, where weights are updated based on a calcium variable post_Ca.

module_name, neuron_model, synapse_model = NESTCodeGeneratorUtils.generate_code_for(nestml_neuron_model="calcium_neuron.nestml",
                                                                                    nestml_synapse_model="time_driven_synapse.nestml",
                                                                                    post_ports=[["post_Ca", "Ca"]],
                                                                                    codegen_opts={"weight_variable": {"time_driven_synapse": "w"},
                                                                                                  "delay_variable": {"time_driven_synapse": "d"},
                                                                                                  "continuous_state_buffering_method": "continuous_time_buffer"})

However, I'm struggling to access that variable inside the synapse model. I was unable to do it directly, so I tried to do it via variable c.

model time_driven_synapse:
    state:
        w real = 0.5

    equations:
        inline c real = post_Ca

    parameters:
        gamma_p real = 8.0
        gamma_d real = 5.0
        theta_p real = 1.3
        theta_d real = 1.0
        tau_w ms = 20.0 ms

        d ms = 1.0 ms

    input:
        pre_spikes <- spike
        post_Ca real <- continuous

    output:
        spike(weight real, delay ms)

    onReceive(pre_spikes):
        emit_spike(w, d)

    update:
        integrate_odes()
        dw real = (- w * (1.0 - w) * (0.5 - w) + gamma_p * (1.0 - w) * heaviside(c, theta_p) - gamma_d * w * heaviside(c, theta_p)) / tau_w
        w += dw * timestep()
        w = max(0.0, min(1.0, w))

    function heaviside(a real, b real) real:
        if a >= b:
            return 1.0
        else:
            return 0.0

Still, I'm getting errors: NESTBuilder_stderr.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions