Morphology class¶
(Shortest import: from brian2 import Morphology)
- class brian2.spatialneuron.morphology.Morphology(**kwds)[source]¶
Bases:
objectNeuronal 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
The membrane surface area of each compartment in this section.
The children (as a
Childrenobject) of this section.Array with all coordinates at the start- and end-points of each compartment in this section.
Array with all coordinates (as unitless floating point numbers) at the start- and end-points of each compartment in this section.
The diameter at the middle of each compartment in this section.
The total distance between the midpoint of each compartment and the root of the morphology.
The distance to the root of the morphology at the end of this section.
The x coordinate at the end of each compartment.
The x coordinate (as a unitless floating point number) at the end of each compartment.
The y coordinate at the end of each compartment.
The y coordinate (as a unitless floating point number) at the end of each compartment.
The z coordinate at the end of each compartment.
The z coordinate (as a unitless floating point number) at the end of each compartment.
The length of each compartment in this section.
The number of compartments in this section.
The parent section of this section.
The geometry-dependent term to calculate the conductance between the start and the midpoint of each compartment.
The geometry-dependent term to calculate the conductance between the midpoint and the end of each compartment.
The x coordinate at the beginning of each compartment.
The x coordinate (as a unitless floating point number) at the beginning of each compartment.
The y coordinate at the beginning of each compartment.
The y coordinate (as a unitless floating point number) at the beginning of each compartment.
The z coordinate at the beginning of each compartment.
The z coordinate (as a unitless floating point number) at the beginning of each compartment.
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).
The total number of sections in this subtree.
The volume of each compartment in this section.
The x coordinate at the midpoint of each compartment.
The x coordinate (as a unitless floating point number) at the midpoint of each compartment.
The y coordinate at the midpoint of each compartment.
The y coordinate (as a unitless floating point number) at the midpoint of each compartment.
The y coordinate at the midpoint of each compartment.
The z coordinate (as a unitless floating point number) at the midpoint of each compartment.
Methods
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
SWCformat, seeMorphology.from_swc_file).from_swc_file(filename[, spherical_soma])Load a morphology from a
SWCfile.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.
- 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
Nonefor 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
Nonefor 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
Nonefor morphologies without coordinates.
- end_x_¶
The x coordinate (as a unitless floating point number) at the end of each compartment. Returns
Nonefor morphologies without coordinates.
- end_y¶
The y coordinate at the end of each compartment. Returns
Nonefor morphologies without coordinates.
- end_y_¶
The y coordinate (as a unitless floating point number) at the end of each compartment. Returns
Nonefor morphologies without coordinates.
- end_z¶
The z coordinate at the end of each compartment. Returns
Nonefor morphologies without coordinates.
- end_z_¶
The z coordinate (as a unitless floating point number) at the end of each compartment. Returns
Nonefor 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
Nonefor morphologies without coordinates.
- start_x_¶
The x coordinate (as a unitless floating point number) at the beginning of each compartment. Returns
Nonefor morphologies without coordinates.
- start_y¶
The y coordinate at the beginning of each compartment. Returns
Nonefor morphologies without coordinates.
- start_y_¶
The y coordinate (as a unitless floating point number) at the beginning of each compartment. Returns
Nonefor morphologies without coordinates.
- start_z¶
The z coordinate at the beginning of each compartment. Returns
Nonefor morphologies without coordinates.
- start_z_¶
The z coordinate (as a unitless floating point number) at the beginning of each compartment. Returns
Nonefor 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
Nonefor morphologies without coordinates.
- x_¶
The x coordinate (as a unitless floating point number) at the midpoint of each compartment. Returns
Nonefor morphologies without coordinates.
- y¶
The y coordinate at the midpoint of each compartment. Returns
Nonefor morphologies without coordinates.
- y_¶
The y coordinate (as a unitless floating point number) at the midpoint of each compartment. Returns
Nonefor morphologies without coordinates.
- z¶
The y coordinate at the midpoint of each compartment. Returns
Nonefor morphologies without coordinates.
- z_¶
The z coordinate (as a unitless floating point number) at the midpoint of each compartment. Returns
Nonefor 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
SWCfiles are supported, calling this function is therefore equivalent to callingMorphology.from_swc_filedirectly.
- static from_points(points, spherical_soma=True)[source]¶
Create a morphology from a sequence of points (similar to the
SWCformat, seeMorphology.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
SWCfile. A large database of morphologies in this format can be found at http://neuromorpho.orgThe 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
indexis an integer label (starting at 1) that identifies the current point and increases by one each line.typeis an integer representing the type of the neural segment. The only type that changes the interpretation by Brian is the type1which signals a soma. Types2(axon),3(dendrite), and4(apical dendrite) are used to give corresponding names to the respective sections. All other types are ignored.x,y, andzare the cartesian coordinates at each point andris its radius.parentrefers to the index of the parent point or is-1for 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.