Having to create a NeuronModel
and a NeuronGroup
and then having to link them is unnecessarily complex for the user.
Linking should at the very least be hidden and not have to be done by the user.
I suggest the following. Just define your own dendrify NeuronGroup
that inherits Brian's NeuronGroup
and extends it with all the cool functionality of your current NeuronModel
class. After this, dendrify will only have one neuron-related class, and no linking.
That would simplify snippets such as the following:
edges = [(soma, apical, 10*nS), (soma, basal, 10*nS)]
pyr_model = NeuronModel(edges, cm=1*uF/(cm**2), gl=50*uS/(cm**2),
v_rest=-70*mV, r_axial=150*ohm*cm,
scale_factor=3, spine_factor=1.5)
# create a Brian NeuronGroup and link it to the neuron model
pyr_group = b.NeuronGroup(3, model=pyr_model.equations, method='euler',
threshold='V_soma > -40*mV', reset='V_soma = -50*mV',
refractory=3*ms, namespace=pyr_model.parameters)
pyr_model.link(pyr_group)
into something like this:
edges = [(soma, apical, 10*nS), (soma, basal, 10*nS)]
pyr_group = d.NeuronGroup(3, edges, ...)
So that everything you want to happen, happens inside your NeuronGroup
.
Nice and simple.