Morphology class

(Shortest import: from brian2 import Morphology)

class brian2.spatialneuron.morphology.Morphology(**kwds)[source]

Bases: object

Neuronal morphology (tree structure).

The data structure is a tree where each node is an un-branched section consisting of a number of connected compartments, each one defined by its geometrical properties (length, area, diameter, position).

Attributes

area

The membrane surface area of each compartment in this section.

children

The children (as a Children object) of this section.

coordinates

Array with all coordinates at the start- and end-points of each compartment in this section.

coordinates_

Array with all coordinates (as unitless floating point numbers) at the start- and end-points of each compartment in this section.

diameter

The diameter at the middle of each compartment in this section.

distance

The total distance between the midpoint of each compartment and the root of the morphology.

end_distance

The distance to the root of the morphology at the end of this section.

end_x

The x coordinate at the end of each compartment.

end_x_

The x coordinate (as a unitless floating point number) at the end of each compartment.

end_y

The y coordinate at the end of each compartment.

end_y_

The y coordinate (as a unitless floating point number) at the end of each compartment.

end_z

The z coordinate at the end of each compartment.

end_z_

The z coordinate (as a unitless floating point number) at the end of each compartment.

length

The length of each compartment in this section.

n

The number of compartments in this section.

parent

The parent section of this section.

r_length_1

The geometry-dependent term to calculate the conductance between the start and the midpoint of each compartment.

r_length_2

The geometry-dependent term to calculate the conductance between the midpoint and the end of each compartment.

start_x

The x coordinate at the beginning of each compartment.

start_x_

The x coordinate (as a unitless floating point number) at the beginning of each compartment.

start_y

The y coordinate at the beginning of each compartment.

start_y_

The y coordinate (as a unitless floating point number) at the beginning of each compartment.

start_z

The z coordinate at the beginning of each compartment.

start_z_

The z coordinate (as a unitless floating point number) at the beginning of each compartment.

total_compartments

The total number of compartments in this subtree (i.e. the number of compartments in this section plus all the compartments in the sections deeper in the tree).

total_sections

The total number of sections in this subtree.

volume

The volume of each compartment in this section.

x

The x coordinate at the midpoint of each compartment.

x_

The x coordinate (as a unitless floating point number) at the midpoint of each compartment.

y

The y coordinate at the midpoint of each compartment.

y_

The y coordinate (as a unitless floating point number) at the midpoint of each compartment.

z

The y coordinate at the midpoint of each compartment.

z_

The z coordinate (as a unitless floating point number) at the midpoint of each compartment.

Methods

copy_section()

Create a copy of the current section (attributes of this section only, not re-creating the parent/children relation)

from_file(filename[, spherical_soma])

Convencience method to load a morphology from a given file.

from_points(points[, spherical_soma])

Create a morphology from a sequence of points (similar to the SWC format, see Morphology.from_swc_file).

from_swc_file(filename[, spherical_soma])

Load a morphology from a SWC file.

generate_coordinates([section_randomness, ...])

Create a new Morphology, with coordinates filled in place where the previous morphology did not have any.

topology()

Return a representation of the topology

Details

area

The membrane surface area of each compartment in this section.

children

The children (as a Children object) of this section.

coordinates

Array with all coordinates at the start- and end-points of each compartment in this section. The array has size \((n+1) \times 3\), where \(n\) is the number of compartments in this section. Each row is one point (start point of first compartment, end point of first compartment, end point of second compartment, …), with the columns being the x, y, and z coordinates. Returns None for morphologies without coordinates.

coordinates_

Array with all coordinates (as unitless floating point numbers) at the start- and end-points of each compartment in this section. The array has size \((n+1) \times 3\), where \(n\) is the number of compartments in this section. Each row is one point (start point of first compartment, end point of first compartment, end point of second compartment, …), with the columns being the x, y, and z coordinates. Returns None for morphologies without coordinates.

diameter

The diameter at the middle of each compartment in this section.

distance

The total distance between the midpoint of each compartment and the root of the morphology.

end_distance

The distance to the root of the morphology at the end of this section.

end_x

The x coordinate at the end of each compartment. Returns None for morphologies without coordinates.

end_x_

The x coordinate (as a unitless floating point number) at the end of each compartment. Returns None for morphologies without coordinates.

end_y

The y coordinate at the end of each compartment. Returns None for morphologies without coordinates.

end_y_

The y coordinate (as a unitless floating point number) at the end of each compartment. Returns None for morphologies without coordinates.

end_z

The z coordinate at the end of each compartment. Returns None for morphologies without coordinates.

end_z_

The z coordinate (as a unitless floating point number) at the end of each compartment. Returns None for morphologies without coordinates.

length

The length of each compartment in this section.

n

The number of compartments in this section.

parent

The parent section of this section.

r_length_1

The geometry-dependent term to calculate the conductance between the start and the midpoint of each compartment. Dividing this value by the Intracellular resistivity gives the conductance.

r_length_2

The geometry-dependent term to calculate the conductance between the midpoint and the end of each compartment. Dividing this value by the Intracellular resistivity gives the conductance.

start_x

The x coordinate at the beginning of each compartment. Returns None for morphologies without coordinates.

start_x_

The x coordinate (as a unitless floating point number) at the beginning of each compartment. Returns None for morphologies without coordinates.

start_y

The y coordinate at the beginning of each compartment. Returns None for morphologies without coordinates.

start_y_

The y coordinate (as a unitless floating point number) at the beginning of each compartment. Returns None for morphologies without coordinates.

start_z

The z coordinate at the beginning of each compartment. Returns None for morphologies without coordinates.

start_z_

The z coordinate (as a unitless floating point number) at the beginning of each compartment. Returns None for morphologies without coordinates.

total_compartments

The total number of compartments in this subtree (i.e. the number of compartments in this section plus all the compartments in the sections deeper in the tree).

total_sections

The total number of sections in this subtree.

volume

The volume of each compartment in this section.

x

The x coordinate at the midpoint of each compartment. Returns None for morphologies without coordinates.

x_

The x coordinate (as a unitless floating point number) at the midpoint of each compartment. Returns None for morphologies without coordinates.

y

The y coordinate at the midpoint of each compartment. Returns None for morphologies without coordinates.

y_

The y coordinate (as a unitless floating point number) at the midpoint of each compartment. Returns None for morphologies without coordinates.

z

The y coordinate at the midpoint of each compartment. Returns None for morphologies without coordinates.

z_

The z coordinate (as a unitless floating point number) at the midpoint of each compartment. Returns None for morphologies without coordinates.

abstract copy_section()[source]

Create a copy of the current section (attributes of this section only, not re-creating the parent/children relation)

static from_file(filename, spherical_soma=True)[source]

Convencience method to load a morphology from a given file. At the moment, only SWC files are supported, calling this function is therefore equivalent to calling Morphology.from_swc_file directly.

static from_points(points, spherical_soma=True)[source]

Create a morphology from a sequence of points (similar to the SWC format, see Morphology.from_swc_file). Each point has to be a 7-tuple: (index, name, x, y, z, diameter, parent)

Note that the values should not use units, but are instead all taken to be in micrometers.

static from_swc_file(filename, spherical_soma=True)[source]

Load a morphology from a SWC file. A large database of morphologies in this format can be found at http://neuromorpho.org

The format consists of an optional header of lines starting with # (ignored), followed by a sequence of points, each described in a line following the format:

index type x y z radius parent

index is an integer label (starting at 1) that identifies the current point and increases by one each line. type is an integer representing the type of the neural segment. The only type that changes the interpretation by Brian is the type 1 which signals a soma. Types 2 (axon), 3 (dendrite), and 4 (apical dendrite) are used to give corresponding names to the respective sections. All other types are ignored. x, y, and z are the cartesian coordinates at each point and r is its radius. parent refers to the index of the parent point or is -1 for the root point.

generate_coordinates(section_randomness=0.0, compartment_randomness=0.0, overwrite_existing=False)[source]

Create a new Morphology, with coordinates filled in place where the previous morphology did not have any. This is mostly useful for plotting a morphology, it does not affect its electrical properties.

topology()[source]

Return a representation of the topology