MorphoEdge#
- class braincell.morph.MorphoEdge(parent, child, parent_x, child_x=0.0)[source]#
A directed edge between two morphology branches.
MorphoEdgeis a frozen dataclass representing a parent-child connection in aMorphotree. It records which branches are connected and where on each branch the attachment occurs.Edges are typically obtained via
Morpho.edgesrather than constructed directly.- Parameters:
parent (
MorphoBranch) – The parent branch in the connection.child (
MorphoBranch) – The child branch in the connection.parent_x (
float) – Attachment point on the parent branch. One of0(proximal),0.5(midpoint, soma only), or1(distal).child_x (
float) – Attachment point on the child branch. One of0(proximal) or1(distal). Default is0.
See also
Morpho.edgesRetrieve all edges in a morphology.
Morpho.attachAttach a child branch to a parent.
Examples
>>> import brainunit as u >>> from braincell import Branch, Morphology >>> soma = Branch.from_lengths( ... lengths=[20.0] * u.um, ... radii=[10.0, 10.0] * u.um, ... type="soma", ... ) >>> dend = Branch.from_lengths( ... lengths=[50.0] * u.um, ... radii=[2.0, 1.0] * u.um, ... type="dendrite", ... ) >>> morph = Morphology.from_root(soma, name="soma") >>> morph.soma.dend = dend >>> edges = morph.edges >>> len(edges) 1 >>> edges[0].parent.name 'soma' >>> edges[0].child.name 'dend'