Page 1 of 1

Animation of synapse activation

Posted: Fri Aug 17, 2018 7:31 am
by rlindroos
Hi all,
I have a model with a detailed morphology that I drive with synaptic input (of Exp2syn type).

I would now like to visualize the synaptic activation in a animation/movie, i.e. map the synaptic current onto the morphology over time.
Is there a best practice for this?

I have made a clumsy quick fix using a custom made mechanism, spikeMonitor, that maps the point process nature of the synapse onto a range variable (using pointers). I can then capture the state of this range variable, during the simulation using PlotShape().

Image

Code: Select all

COMMENT
Spike detection mechanism for visualization of synaptic input onto the morphology

ENDCOMMENT

NEURON {
	THREADSAFE
    SUFFIX spikeMonitor
    RANGE spike, fake
    POINTER I
}

PARAMETER {
    fake    = 0
}

ASSIGNED { 
    I
    spike
}

INITIAL {
	I       = 0
	spike   = 0
}

BREAKPOINT {
    spike = I
}
Another idea is to add a marker indicating the approximate location of the synapse on top of the morphology and change the color of this to indicate activation.

What would you recommend? Or even better is there a ready a solution for this?

Re: Animation of synapse activation

Posted: Mon Aug 20, 2018 12:21 pm
by ted
I'm surprised that it works. I do have one minor question. Is "fake" really necessary?

Re: Animation of synapse activation

Posted: Tue Aug 21, 2018 12:33 pm
by rlindroos
Well, probably not. I use "fake" as pointer target for segments not containing synapses.
That is they are pointed back to themselves...

Re: Animation of synapse activation

Posted: Tue Aug 21, 2018 4:54 pm
by ted
Your approach works if there is only one such synaptic mechanism per segment. It can't be used if more than one NetCon drives that synaptic mechanism. The result it produces is unrelated to the NetCon's weight. But it is adequate for your needs?

Re: Animation of synapse activation

Posted: Wed Aug 22, 2018 2:17 am
by rlindroos
I only have one NetCon per synapse so that would be adequate, yes.

I'm also not pointing to the weight of the NetCon object but to the current of the synapse itself.

e.g.

Code: Select all

from neuron import h
def cell
insert synapses (in some segments)
insert spikeMonitor (in all sections)

for sec in h.allsec():
	for seg in sec:
		if seg has synapse:
			point synapse.I to spikeMonitor.I
		else:
			point spikeMonitor.fake to spikeMonitor.I
			
def PlotShape()
initialize and run
Would something like this work for multiple sources?

(have deleted the code and made another solution using python now, since it seemed like you could not remove the visualized variable from origo without the gui + python is more versatile in general)