core Package

core Package

Object-models for morphology representations.

class MorphologyTree(name=None, dummysection=None, metadata=None, region_number_to_name_bidict=None)[source]

Bases: morphforge.morphology.core.base.MorphologyBase

__init__(name=None, dummysection=None, metadata=None, region_number_to_name_bidict=None)[source]
__iter__()[source]

Iteration over each of the sections.

__len__()[source]

Returns the numbers of sections in the morphology

__str__()[source]
_every_section()[source]

Includes dummy section

ensure_consistency(requiretreeset=True)[source]

This method is used to check the consistency of the tree. In production code, all calls to this should be optimised out using -O optimisation to python. This requests a check from MorphologyConsistencyMgr. We do this to avoid storing additional attributes in the MorphologyTree Object, which could cause upset for calculating md5sums or pickling.

get_dummy_section()[source]
get_idtags()[source]
get_region(name)[source]

Returns a Region object relevant to this tree, given a filename

get_region_names()[source]
get_regions()[source]

Returns a list of unique regions in the morphology

get_root_section()[source]
get_root_sections()[source]
get_section(idtag)[source]

Returns a Section object with a given id

is_dummy_section_set()[source]

Returns whether a tree has been assigned to this morphology

regions
set_dummy_section(dummysection)[source]

Set the tree node for the morphology. You can only do this to a morphology which has not had its tree assigned yet. The root-object of the tree is a ‘dummysection’, but this is not the same as a root node.

surface_area
class Section(x, y, z, r, region, parent=None, idtag=None)[source]

Bases: object

__init__(x, y, z, r, region, parent=None, idtag=None)[source]

Creation of the section.

__repr__()[source]
area

Returns the area of the section.

children
create_distal_section(x, y, z, r, region, idtag=None)[source]

Creates and returns a new Section object from its distal end. The parameters are the same as for the constructor.

d_r

Distal r coordinate

d_x

Distal x coordinate

d_y

Distal y coordinate

d_z

Distal z coordinate

get_area(include_end_if_terminal=False)[source]

Returns the area of the section.

get_distal_npa3()[source]

Returns the 3 coordinates of the distal end of the section.

get_distal_npa4()[source]

Returns the 3 coordinates and the radius of the distal end of the section.

get_length()[source]
get_npa3(position)[source]
get_npa4(position)[source]
get_proximal_npa3()[source]

Returns the 3 coordinates of the proximal end of the section.

get_proximal_npa4()[source]

Returns the 3 coordinates and the radius of the proximal end of the section.

get_proximal_to_distal_vector_npa3()[source]

Returns the vector that joins the proximal end of the section to the distal end.

get_proximal_to_distal_vector_npa4()[source]

Returns the vector that joins the proximal end of the section to the distal end.

get_vectorfrom_parent_np4()[source]

Deprecated: Returns the directional vector and the radious difference in the section.

get_volume()[source]

Returns the volume of the section.

idtag
is_a_root_section()[source]
is_dummy_section()[source]
is_leaf()[source]
length
p_r

Proximal radius

p_x

Proximal x coordinate

p_y

Proximal y coordinate

p_z

Proximal z coordinate

parent
region
surface_area

Returns the area of the section.

volume

Returns the volume of the section.

class Region(name)[source]

Bases: object

Region is a collection of sections. It is used for annotating the sections (i.e. axon, soma, proximal dendrite, ...) and for collectively assigning the channels and membrane definitions to the sections.

__init__(name)[source]
__iter__()[source]
__len__()[source]
__str__()[source]
add_section(section)[source]

Adding a section to the region.

set_morphology(morph)[source]
surface_area
class MorphLocation(section, sectionpos)[source]

Bases: object

A MorphLocations represents a cell_location (more accurately a disk) on a morphology. It is specied by a Section, and the proportion of the distance along it, sectionpos. Sectionpos is a float from 0.0 (most proximal) to 1.0 (most distal) (like NEURON).

__init__(section, sectionpos)[source]
get_3d_position()[source]

Returns the 3D position of the morphology cell_location

section
sectionpos
class MorphologyArray(vertices, connectivity, dummy_vertex_index=0, section_types=None, region_number_to_name_bidict=None, name=None, metadata=None)[source]

Bases: morphforge.morphology.core.base.MorphologyBase

__init__(vertices, connectivity, dummy_vertex_index=0, section_types=None, region_number_to_name_bidict=None, name=None, metadata=None)[source]
__len__()[source]

Returns the number of cylinders in the morphology (Chosen over the number for vertices, in order to maintain compatibility with MorphologyTree,

connections_to_index(pid)[source]
get_connection_by_index(i)[source]
get_leaf_vertices_indices()[source]
get_vertex_by_index(i)[source]
index_of_connection(_id, pid)[source]
is_directed()[source]
class MorphPath(morphloc1, morphloc2)[source]

Bases: object

DirDistal = 'DirDistal'
DirProximal = 'DirProximal'
__init__(morphloc1, morphloc2)[source]
get_length()[source]
classmethod get_sections_to_root(sect)[source]

array Module

Vertex-based object-model of morphologies.

class MorphologyArray(vertices, connectivity, dummy_vertex_index=0, section_types=None, region_number_to_name_bidict=None, name=None, metadata=None)[source]

Bases: morphforge.morphology.core.base.MorphologyBase

__init__(vertices, connectivity, dummy_vertex_index=0, section_types=None, region_number_to_name_bidict=None, name=None, metadata=None)[source]
__len__()[source]

Returns the number of cylinders in the morphology (Chosen over the number for vertices, in order to maintain compatibility with MorphologyTree,

connections_to_index(pid)[source]
get_connection_by_index(i)[source]
get_leaf_vertices_indices()[source]
get_vertex_by_index(i)[source]
index_of_connection(_id, pid)[source]
is_directed()[source]

base Module

class MorphologyBase(region_number_to_name_bidict=None, name=None, metadata=None)[source]

Bases: object

__init__(region_number_to_name_bidict=None, name=None, metadata=None)[source]
name

morphologyconsistency Module

class MorphConsistencyChecker(morph)[source]

Bases: object

__init__(morph)[source]
classmethod check_dummy_section(dummysection)[source]
check_region(region, morph)[source]
check_section(section, morph, dummysection=False, recurse=True)[source]
check_section_contents(section, morph, dummysection)[source]
check_section_infra_structure(section, morph, dummysection)[source]
check_tree()[source]
disable()[source]
enable()[source]
run_checks()[source]
class MorphologyConsistencyMgr[source]

Bases: object

_morphology_consistency_checkers = {}
classmethod check_morphology(morph)[source]
classmethod get_checker(morph)[source]
_get_md5_of_morphology(m)[source]
_get_md5_of_region(r)[source]
_get_md5_of_section(s)[source]

tree Module

class MorphLocation(section, sectionpos)[source]

Bases: object

A MorphLocations represents a cell_location (more accurately a disk) on a morphology. It is specied by a Section, and the proportion of the distance along it, sectionpos. Sectionpos is a float from 0.0 (most proximal) to 1.0 (most distal) (like NEURON).

__init__(section, sectionpos)[source]
get_3d_position()[source]

Returns the 3D position of the morphology cell_location

section
sectionpos
class MorphPath(morphloc1, morphloc2)[source]

Bases: object

DirDistal = 'DirDistal'
DirProximal = 'DirProximal'
__init__(morphloc1, morphloc2)[source]
get_length()[source]
classmethod get_sections_to_root(sect)[source]
class MorphologyTree(name=None, dummysection=None, metadata=None, region_number_to_name_bidict=None)[source]

Bases: morphforge.morphology.core.base.MorphologyBase

__init__(name=None, dummysection=None, metadata=None, region_number_to_name_bidict=None)[source]
__iter__()[source]

Iteration over each of the sections.

__len__()[source]

Returns the numbers of sections in the morphology

__str__()[source]
_every_section()[source]

Includes dummy section

ensure_consistency(requiretreeset=True)[source]

This method is used to check the consistency of the tree. In production code, all calls to this should be optimised out using -O optimisation to python. This requests a check from MorphologyConsistencyMgr. We do this to avoid storing additional attributes in the MorphologyTree Object, which could cause upset for calculating md5sums or pickling.

get_dummy_section()[source]
get_idtags()[source]
get_region(name)[source]

Returns a Region object relevant to this tree, given a filename

get_region_names()[source]
get_regions()[source]

Returns a list of unique regions in the morphology

get_root_section()[source]
get_root_sections()[source]
get_section(idtag)[source]

Returns a Section object with a given id

is_dummy_section_set()[source]

Returns whether a tree has been assigned to this morphology

regions
set_dummy_section(dummysection)[source]

Set the tree node for the morphology. You can only do this to a morphology which has not had its tree assigned yet. The root-object of the tree is a ‘dummysection’, but this is not the same as a root node.

surface_area
class Region(name)[source]

Bases: object

Region is a collection of sections. It is used for annotating the sections (i.e. axon, soma, proximal dendrite, ...) and for collectively assigning the channels and membrane definitions to the sections.

__init__(name)[source]
__iter__()[source]
__len__()[source]
__str__()[source]
add_section(section)[source]

Adding a section to the region.

set_morphology(morph)[source]
surface_area
class Section(x, y, z, r, region, parent=None, idtag=None)[source]

Bases: object

__init__(x, y, z, r, region, parent=None, idtag=None)[source]

Creation of the section.

__repr__()[source]
area

Returns the area of the section.

children
create_distal_section(x, y, z, r, region, idtag=None)[source]

Creates and returns a new Section object from its distal end. The parameters are the same as for the constructor.

d_r

Distal r coordinate

d_x

Distal x coordinate

d_y

Distal y coordinate

d_z

Distal z coordinate

get_area(include_end_if_terminal=False)[source]

Returns the area of the section.

get_distal_npa3()[source]

Returns the 3 coordinates of the distal end of the section.

get_distal_npa4()[source]

Returns the 3 coordinates and the radius of the distal end of the section.

get_length()[source]
get_npa3(position)[source]
get_npa4(position)[source]
get_proximal_npa3()[source]

Returns the 3 coordinates of the proximal end of the section.

get_proximal_npa4()[source]

Returns the 3 coordinates and the radius of the proximal end of the section.

get_proximal_to_distal_vector_npa3()[source]

Returns the vector that joins the proximal end of the section to the distal end.

get_proximal_to_distal_vector_npa4()[source]

Returns the vector that joins the proximal end of the section to the distal end.

get_vectorfrom_parent_np4()[source]

Deprecated: Returns the directional vector and the radious difference in the section.

get_volume()[source]

Returns the volume of the section.

idtag
is_a_root_section()[source]
is_dummy_section()[source]
is_leaf()[source]
length
p_r

Proximal radius

p_x

Proximal x coordinate

p_y

Proximal y coordinate

p_z

Proximal z coordinate

parent
region
surface_area

Returns the area of the section.

volume

Returns the volume of the section.