#
Description of problem

I’m trying to find a way to group and connect a large number (~1,500) of 2 compartments `SpatialNeuron`

s (1 Soma and 1 Dendrite). I’m pretty new but I’ve been going through the documentation trying to find a way to make this work.

The idea would be to find a way to independently have Somas and Dendrites (with specific morphologies) and be able to connect them (Somas ↔ Somas, Somas ↔ Dendrites, and Dendrites ↔ Dendrites)

My questions :

- Is there a built-in Method or Class allowing for this behavior?
- Is it done " by hand", connecting via the
`Synapse`

class the `spatialNeuron`

with a condition or a loop?

Thank you very much.

Hi @AGuyNextDoor. If each of your neurons is modelled as two compartments, I’d strongly advise against using `SpatialNeuron`

in the first place. The reason is that `SpatialNeuron`

treats each neuron as an independent unit, and having 1500 of them would among other things mean to compile 1500 C++ files representing the computations updating the neurons. Also, you’d need to have one `Synapses`

object for each pair of neurons, adding to the complexity. In sum, this would be very inefficient, and – if using a C+±based code generation target – *very* slow to compile.

If you only need two compartments, a much more efficient approach would be to directly represent these compartments in the equations, i.e. instead of having one `dv/dt = ...`

equation, use `dv_soma/dt = ...`

and `dv_dend/dt = ...`

with a current proportional to `(v_soma - v_dend)`

between the two variables. In particular, if you want to model a passive dendrite, this is quite straightforward to do. Instead of creating the equations by hand, you can also use the dendrify package, which does the same thing under the hood (with additional options for efficient models of active dendrites).

If you follow that approach, you will only need a single `NeuronGroup`

for all your neurons, and connecting them with synapses will therefore also be possible using the standard methods.

Does that help, or did I misunderstand what you want to do?

1 Like

Thanks for the fast and qualitative reply!

It helps a lot! I now know my modelization direction, I really didn’t want to go in a direction and discovering a more suited Class after that …!

If I understand correctly, the SpatialNeuron class really aims at modeling more specific behaviors of a few number of neurons

I’ll check on the `dendrify package`

thanks a lot !

Yes, indeed, the main use case at the moment is to use it either for models with a dendritic tree and something like hundreds of compartments (e.g. to study integration of synaptic input on various positions of the dendritic tree), or in simplified models but still with many compartments, e.g. to study the propagation of action potentials in an axon.

In the long run, we are planning to implement a `SpatialNeuronGroup`

that would cover your use case as well, but we aren’t there yet…