Plot simple morphology (single dendritic branch)

Description of problem

I want to plot just a simple compartmental branch by using the command below(which was in the “User’s guide” ):
morpho=Section(n=5, diameter=[15, 5, 10, 5, 10, 5]*um, length=[10, 20, 5, 5, 10]*um)

Minimal code to reproduce problem

morpho = morpho.generate_coordinates()

without defining Soma I get an error that says: float division by zero

What you have already tried

I added Soma by :
morpho = Soma(diameter=3*um)
morpho.child=Section(n=5, diameter=[15, 5, 10, 5, 10, 5]*um, length=[10, 20, 5, 5, 10]*um)

and it got fixed. but I don’t want to have soma in my simulation. where did I make a mistake? and is it possible to have a simulation without soma? just a single dendritic branch?

1 Like

Hi @shirin. The generate_coordinates method is meant to generate coordinates for an artificial morphology so that it “looks nice”. Admittedly it should not generate an error for a morphology that only has a single section, but in either case it will not be very useful. As a workaround, you can directly set coordinates yourself instead of specifying the length of your compartments:

morpho = Section(n=5, diameter=[15, 5, 10, 5, 10, 5] * um,
                 x=[0, 10, 30, 35, 40, 50] * um)
plot_morphology(morpho, plot_3d=False, show_diameter=True)

Note that I also set the show_diameter option, otherwise you’d only see a simple line.

It is perfectly fine to have a simulation without the soma (like in a number of examples in the documentation, e.g. Example: cylinder — Brian 2 2.5.4 documentation), your problems are only related to plotting such morphologies.