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

SpatialNeuronGroup #1008

Open
psipeter opened this issue Sep 14, 2018 · 6 comments
Open

SpatialNeuronGroup #1008

psipeter opened this issue Sep 14, 2018 · 6 comments

Comments

@psipeter
Copy link

psipeter commented Sep 14, 2018

Dear Brian developers,

My name is Peter, and I'm a PhD student at the University of Waterloo in Chris Eliasmith's lab. My work involves incorporating biologically-detailed neuron models into the Neural Engineering Framework (and its associated software suite nengo), building medium-sized networks from these models, and investigating various neurocognitive phenomenon. Up to this point I've used NEURON to model compartmental neurons, but I've become disenchanted with this language and I'm looking for an alternative approach.

I recently discovered that Brian2 supports compartmental modelling, and I am excited about interfacing your software with ours, with the goal of eventually building functional and biologically-realistic neural networks! I've already done some preliminary work and have successfully built nengo networks populated by NeuronGroups, as well as individual by SpatialNeurons. Now I'm at the point where I want to simulate groups of these SpatialNeurons. Previous posts have described how to extract the equations from a SpatialNeuron and instantiate a NeuronGroup with those equations, but this is somewhat laborious from the user's perspective, and may not take full advantage of optimization or multi-threading.

I'd like to rekindle the development of a SpatialNeuronGroup class and associated methods. Are there members of the development team that would be willing to add support for SpatialNeuronGroups? It seems to me like this would be a powerful tool with numerous applications in computational neuroscience, and its development would be a natural extension of Brian's core goals.

Thanks for your consideration.

  • Peter
@thesamovar
Copy link
Member

I think this could potentially be a nice feature to have, but at least from my point of view not extremely high priority. So, I'd be happy for us to support you in doing this and potentially merge it into Brian once it's finished, but realistically I won't have a lot of time. Not sure what @mstimberg thinks.

The main challenge is that different SpatialNeurons may have different numbers and structure of compartments, so there is no way to vectorise the code across neurons. Essentially, a SpatialNeuronGroup would just have to be a wrapper around a list of SpatialNeurons. I wonder how helpful it is to add specific syntax in this case?

The other alternative is that oyu have a SpatialNeuronGroup where the compartmental structure is forced to be the same across neurons. This is certainly feasible and would lead to potential vectorisation benefits, but I'm not sure how useful that is to modellers?

These are the questions that have stopped us from making moves towards implementing a SpatialNeuronGroup in the past. What are your thoughts?

@psipeter
Copy link
Author

I intend to use an identical compartmental structure across all neurons in the SpatialNeuronGroup. For the moment, I'll even keep the biophysical parameters identical across the neurons; later I'll want to experiment with heterogeneity in these properties.

Nengo induces neural heterogeneity using two external terms, gain (which scales weights) and bias (which delivers a constant current to each neuron); this process produces diverse tuning curves and eliminates the need to vary parameters of the neuron model itself.

@thesamovar
Copy link
Member

OK IIRC using identical compartmental structure is definitely possible, but I'm not very familiar with the compartmental stuff so I'll have to hand over to @mstimberg when he gets a chance (I believe he's rather busy at the moment, so it might take him a little while to respond).

@psipeter
Copy link
Author

I'm having trouble placing multiple synapses onto the same compartment of a SpatialNeuron model. When the 'on_pre' argument of the synapse targets a state variable of the neuron equations using the '_post' and '(summed)' notation, Brian complains that multiple summed variables cannot target the state variable. I'm unsure whether this is intended or not, but it does raise the question of how the user is supposed to place multiple nonlinear synapses onto e.g. the soma in the SpatialNeuron framework.

Here is a minimal example:

from brian2 import *

soma = Soma(diameter=10*um)

cell_eqs = '''
    Im = gs : amp/meter**2
    gs : amp/meter**2
'''
syn_eqs = '''
    dg/dt = -g/tau : amp/meter**2 (event-driven)
    gs_post = g : amp/meter**2 (summed)
    tau = 0.1*ms : second
'''

spike_gen = SpikeGeneratorGroup(1, indices=[0], times=[1]*ms)

neuron = SpatialNeuron(morphology=soma, model=cell_eqs, method='rk4', Cm=1*uF/cm**2, Ri=100*ohm*cm)

S1 = Synapses(spike_gen, neuron, model=syn_eqs, method='rk4', on_pre='g += 1*namp/meter**2')
S1.connect()

S2 = Synapses(spike_gen, neuron, model=syn_eqs, method='rk4', on_pre='g += 1*namp/meter**2')
S2.connect()

network = Network(neuron, spike_gen, S1, S2)

defaultclock.dt = 0.025*ms
network.run(1*ms)

Throws

NotImplementedError: Multiple "summed variables" target the variable "gs" in group "spatialneuron". Use multiple variables in the target group instead

Note that in this example, I could alternatively implement the conductance variable in the neuron equations due to linearity, as mentioned in the docs on multicompartmental models.

Also, has @mstimberg had a chance to revisit SpatialNeuronGroups?

@mstimberg
Copy link
Member

Brian complains that multiple summed variables cannot target the state variable. I'm unsure whether this is intended or not, but it does raise the question of how the user is supposed to place multiple nonlinear synapses onto e.g. the soma in the SpatialNeuron framework.

The issue is the same as for having multiple non-linear synapse target the same neuron in a NeuronGroup of neurons (#766). The only solution/workaround for now is what the error message says: use multiple variables in the target compartment, e.g. instead of gs : amp/meter**2 you could use something like:

gs = gs_1 + gs_2 : amp/meter**2
gs_1 : amp/meter**2
gs_2 : amp/meter**2

and one of the synapse types would target gs_1, the other one gs_2.

Also, has @mstimberg had a chance to revisit SpatialNeuronGroups?

We are definitely interested in implementing this (with identical structure for each neuron), but I cannot commit to any time frame at the moment. It shouldn't be that difficult to implement, though. The main use case we were thinking of were not actual networks of neurons, but simply many instances of a single neuron with different parameters, e.g. for model fitting or parameter exploration. One of the main issues to decide will be the syntax, e.g. for this kind of nested structure there's always the question in which order attributes should be accessible (e.g. neurons.soma.v[0] vs neurons[0].soma.v, etc.).

@rcaze
Copy link
Contributor

rcaze commented Feb 22, 2019

See our paper with @mstimberg in Rescience where we played with the classic NeuronGroup to have a network of two compartmental neuron models. This is not a full-fledged SpatialNeuronGroup but I like this approximation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants