Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonlinear interactions between spikes on the same stream (accessing spike buffers) #103

Open
tclose opened this issue May 27, 2015 · 2 comments

Comments

@tclose
Copy link
Contributor

tclose commented May 27, 2015

In the process of importing the PyNN standard models NMODL files into 9ML I came across explicit spike buffers and realised that I don't think we have a way of representing them in 9ML, e.g.

TITLE Alpha-function synaptic current, with NET_RECEIVE

COMMENT
This model works with variable time-step methods (although it may not
be very accurate) but at the expense of having to maintain the queues
of spike times and weights.

Andrew P. Davison, UNIC, CNRS, May 2006
ENDCOMMENT

DEFINE MAX_SPIKES 1000
DEFINE CUTOFF 20

NEURON {
    POINT_PROCESS AlphaISyn
    RANGE tau, i, q
    NONSPECIFIC_CURRENT i
}

UNITS {
    (nA) = (nanoamp)
}

PARAMETER {
    tau = 5 (ms) <1e-9,1e9>

}

ASSIGNED {
    i (nA)
    q
    quiet
    onset_times[MAX_SPIKES] (ms)
    weight_list[MAX_SPIKES] (nA)
}

INITIAL {
    i  = 0
    q  = 0 : queue index
    quiet = 0
}

BREAKPOINT {
    LOCAL k, expired_spikes, x
    i = 0
    expired_spikes = 0
    FROM k=0 TO q-1 {
        x = (t - onset_times[k])/tau
        if (x > CUTOFF) {
            expired_spikes = expired_spikes + 1
        } else {
            i = i - weight_list[k] * alpha(x)
        }
    }
    update_queue(expired_spikes)
}

FUNCTION update_queue(n) {
    LOCAL k
    :if (n > 0) { printf("Queue changed. t = %4.2f onset_times=[",t) }
    FROM k=0 TO q-n-1 {
        onset_times[k] = onset_times[k+n]
        weight_list[k] = weight_list[k+n]
        :if (n > 0) { printf("%4.2f ",onset_times[k]) }
    }
    :if (n > 0) { printf("]\n") }
    q = q-n
}

FUNCTION alpha(x) {
    if (x < 0) {
        alpha = 0
    } else {
        alpha = x * exp(1 - x)
    }
}

NET_RECEIVE(weight (nA)) {
    onset_times[q] = t
    weight_list[q] = weight
        :printf("t = %f, weight = %f\n", t, weight)
    if (q >= MAX_SPIKES-1) {
        if (!quiet) {
            printf("Error in AlphaSynI. Spike queue is full\n")
            quiet = 1
        }
    } else {
        q = q + 1
    }
}

While in this case there should be a way around them I am not sure there is in general. Is this something we should look at, and if so does anyone have any suggestions, or have I missed something very obvious here?

Perhaps we could have some sort of "ReduceStateVariable", which is actually the combination of variable per event (with a time limit). But this is very hacky...

@apdavison
Copy link
Member

I sort of feel that spike buffers are an implementation detail. They are sometimes needed if you're trying to handle multiple non-linear synaptic currents with a single mechanism, but I think the cleaner way would be to just have multiple mechanisms, one per synapse.

@tclose
Copy link
Contributor Author

tclose commented May 29, 2015

I agree that we don't want to have to specify the buffer itself but could
you sometimes have nonlinear interactions between spikes on the same stream
that you would want to model and therefore need to model the response to
each spike separately?

On Fri, 29 May 2015 at 9:11 pm Andrew Davison [email protected]
wrote:

I sort of feel that spike buffers are an implementation detail. They are
sometimes needed if you're trying to handle multiple non-linear synaptic
currents with a single mechanism, but I think the cleaner way would be to
just have multiple mechanisms, one per synapse.

Reply to this email directly or view it on GitHub
#103 (comment).

@tclose tclose changed the title Explicit spike buffers? Nonlinear interactions between spikes on the same stream (accessing spike buffers) Jun 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants