pygrenade_vx.network.multicompartment.morphology_builder.MorphologyBuilder

class pygrenade_vx.network.multicompartment.morphology_builder.MorphologyBuilder

Bases: object

Construct a multicompartment neuron class.

Compartments can be added and interconnected. The builder supports cloning branches of interconnected compartments and connecting different branches to one neuron. The created neuron must be fully connnected and acyclic.

__init__()

Builder for multicompartment neuron classes.

Structures the neuron during the building process in nodes that form a tree.

Methods

__init__()

Builder for multicompartment neuron classes.

add_compartment(compartment[, label])

Add a compartment to the builder.

clone(node[, label])

Clone an existing node.

connect(connections[, label])

Connect two compartments.

done(name)

Return a new neuron class that matches the topology defined in the builder.

get_ref_in_node(target_tree, subnode)

Return the reference to a node on a specific subtree.

add_compartment(compartment: pygrenade_vx.network.multicompartment.neuron_components.Compartment, label: Optional[str, None] = None)pygrenade_vx.network.multicompartment.tree.Node

Add a compartment to the builder.

Parameters
  • compartment – Compartment to be added.

  • label – Label of the compartment in the builder.

Returns

Node in the builder representing the compartment.

clone(node: pygrenade_vx.network.multicompartment.tree.Node, label: Optional[str, None] = None)pygrenade_vx.network.multicompartment.tree.Node

Clone an existing node.

Parameters
  • node – Node to be cloned.

  • label – Label of the clone.

Returns

Clone of the given node.

connect(connections: List[Tuple[pygrenade_vx.network.multicompartment.tree.Node, pygrenade_vx.network.multicompartment.tree.Node]], label: Optional[str, None] = None)pygrenade_vx.network.multicompartment.tree.Node

Connect two compartments.

By connecting two compartments a node that contains the two subtrees, that contain the source and target compartment of the connection is created.

Parameters
  • connections – List of source target tuples of compartments.

  • label – Optional label for newly created subtree.

Returns

Newly created subtree containing the subtrees of the

connected compartments.

done(name: str)pygrenade_vx.network.multicompartment.neuron.Neuron

Return a new neuron class that matches the topology defined in the builder.

Parameters

name – Name of the neuron class.

Returns

Neuron class.

get_ref_in_node(target_tree: pygrenade_vx.network.multicompartment.tree.Node, subnode: pygrenade_vx.network.multicompartment.tree.Node)pygrenade_vx.network.multicompartment.tree.Node

Return the reference to a node on a specific subtree.

Intended for getting the reference of a node on a cloned subtree. :param target_tree: The subtree on which the node is searched. :param subnode: The node to be searched. :return: Reference of the node on the given subtree.