pygrenade_vx.network.abstract.multicompartment.morphology_builder.MorphologyBuilder

class pygrenade_vx.network.abstract.multicompartment.morphology_builder.MorphologyBuilder(neuron_type=<class 'pygrenade_vx.network.abstract.multicompartment.neuron.Neuron'>)

Bases: object

Construct a multicompartment neuron class.

Parameters

neuron_type – Base class from which the neuron created in the builder

derives.

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__(neuron_type=<class 'pygrenade_vx.network.abstract.multicompartment.neuron.Neuron'>)

Builder for multicompartment neuron classes.

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

Methods

__init__([neuron_type])

Builder for multicompartment neuron classes.

add_compartment(compartment, label)

Add a compartment to the builder.

build_defaults(compartments_full_label, …)

clone(tree[, label])

Clone an existing tree.

connect(connections[, label])

Connect two compartments.

done(name)

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

get_ref_in_tree(target_tree, subtree)

Return the reference to a tree on a specific subtree.

add_compartment(compartment: pygrenade_vx.network.abstract.multicompartment.neuron_components.Compartment, label: str)pygrenade_vx.network.abstract.multicompartment.tree.Tree

Add a compartment to the builder.

Parameters
  • compartment – Compartment to be added.

  • label – Label of the compartment in the builder.

Returns

Tree in the builder representing the compartment.

build_defaults(compartments_full_label, connections_full_label)
clone(tree: pygrenade_vx.network.abstract.multicompartment.tree.Tree, label: Optional[str, None] = None)pygrenade_vx.network.abstract.multicompartment.tree.Tree

Clone an existing tree.

Parameters
  • tree – Tree to be cloned.

  • label – Label of the clone.

Returns

Clone of the given tree.

connect(connections: List[pygrenade_vx.network.abstract.multicompartment.tree.Connection], label: Optional[str, None] = None)pygrenade_vx.network.abstract.multicompartment.tree.Tree

Connect two compartments.

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

Parameters
  • connections – List of connections.

  • conductances – List of conductances for connections.

  • label – Optional label for newly created subtree.

Returns

Newly created subtree containing the subtrees of the

connected compartments.

done(name: str)

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_tree(target_tree: pygrenade_vx.network.abstract.multicompartment.tree.Tree, subtree: pygrenade_vx.network.abstract.multicompartment.tree.Tree)pygrenade_vx.network.abstract.multicompartment.tree.Tree

Return the reference to a tree on a specific subtree.

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