cell_calc¶
This module provides functions for analysis of NEURON cell morphologies, such as path length, surface area, and terminal sections, etc.
- average_path_length(section_list)[source]¶
Finds the average pathlength from all paths to the soma in the section list
Parameters¶
- section_list: list[Section]
list of sections to find paths to the soma within
Returns¶
average_path_length : float
- axon_length_along(seg_1, seg_2)[source]¶
Calculates the length of the axon segment between two given segments. Equivalent to h.distance(seg_1, seg_2).
Parameters¶
- seg_1Segment
The starting segment of the axon path.
- seg_2Segment
The ending segment of the axon path.
Returns¶
- axon_pathlengthfloat
The calculated length of the axon segment between the two given segments.
- axon_length_to_terminal(cell, seg, section_list, method='plane')[source]¶
Calculates the length of the axon to the terminal segment.
Parameters¶
- cellCell
The cell instance containing the sections.
- segSegment
The segment object for which to calculate the axon length to the terminal.
- section_listlist[Section]
List of NEURON sections to analyze.
- methodstr, optional
The method to use for calculation. Options are ‘plane’, ‘cartesian’, or ‘straight’. Default is ‘plane’. plane: Uses a defined distal perpendicular plane based on cell orientation and furthest segment. cartesian: Calculates the distance in Cartesian coordinates, assuming axon travels along one axis at a time. straight: Calculates the straight-line distance to the terminal segment, assuming a direct path.
Returns¶
- axon_length_to_terminalfloat
The calculated axon length to the terminal segment.
- closest_endsegSegment
The closest terminal segment object.
- closest_terminal_segment(section_list, seg)[source]¶
Returns the closest terminal section’s terminal segment to a given segment in a section list.
Parameters¶
- section_listlist[Section]
List of NEURON sections to find terminal sections to consider in distance search.
- segSegment
The NEURON segment to find the closest terminal segment to.
Returns¶
- closest_distancefloat
Distance to the closest terminal segment.
- closest_endsegSegment
The closest terminal segment object.
- furthest_point(from_sec, section_list)[source]¶
Finds the furthest segment and its distance from the soma.
Parameters¶
- from_secSection
The NEURON section to measure distance from.
- section_listlist[Section]
List of NEURON sections to measure to and compare.
Returns¶
- furthest_distancefloat
Distance of the furthest segment from the soma.
- furthest_segSegment
The furthest segment object.
- get_all_input_lengths(cell, section_lists, **kwargs)[source]¶
Calculates the total length of all input paths in a cell.
Parameters¶
- cellCell
The cell instance containing the sections.
- section_listslist of lists of Section, optional
A list of lists of sections to consider. If None, uses all sections in the cell.
Returns¶
- dict
A dictionary mapping each segment to the total length of its input path.
- get_average_endpoints(cell, sectionlist_1=None, sectionlist_2=None)[source]¶
Calculates the average coordinates of the terminal segments at the ends of the cell for use defining line parallel to cell orientation.
Parameters¶
- cellCell
The cell instance containing the sections.
- sectionlist_1list[Section], optional
A list of sections to consider for the first set of terminal segments. If None, uses lateral_nofilopodia.
- sectionlist_2list[Section], optional
A list of sections to consider for the second set of terminal segments. If None, uses medial_nofilopodia.
Returns¶
- tuple
Two tuples containing the average coordinates (x, y) of the lateral and medial terminal segments, respectively.
- get_children_secs(sec, section_list=None)[source]¶
Returns a list of all child sections in the cell (recursively).
Parameters¶
- secSection
The NEURON section to find children of.
- section_listlist[Section], optional
If provided, only returns children within this list. Default is None.
Returns¶
- all_childrenlist
List of all child sections.
- get_input_lengths(cell, section_lists, **kwargs)[source]¶
Calculates the total length of all input paths in a cell.
Parameters¶
- cellCell
The cell instance containing the sections.
- section_listslist of lists of Section, optional
A list of sections to consider. If None, uses all sections in the cell.
Returns¶
- dict
A dictionary mapping each segment to the total length of its input path.
- get_parent_sections(section, starts_from_soma=True, include_soma=False, include_section=True)[source]¶
Retrieves all parent sections of a given section. Parents are sections between the given section and the soma/root.
Parameters¶
- sectionSection
The NEURON section to analyze.
- starts_from_somabool, optional
If True, the list starts from the soma. Default is True.
- include_somabool, optional
If True, includes the soma in the list. Default is False.
- include_sectionbool, optional
If True, includes the original section in the list. Default is True.
Returns¶
- parent_listlist[Section]
List of parent sections, including the original section.
- get_terminal_sections(section_list)[source]¶
Identifies all terminal sections in a given list.
Parameters¶
- section_listlist[Section]
List of NEURON sections to analyze.
Returns¶
- end_sectionslist[Section]
List of terminal sections (sections with no children).
- getsegxyz(seg)[source]¶
Retrieves the 3D coordinates of a NEURON segment.
Parameters¶
- segSegment
The NEURON segment to determine coordinates for.
Returns¶
- coordstuple
3D coordinates of the segment (x, y, z).
- mep(cell, section_list)[source]¶
Calculates the mean electrotonic pathlength (MEP). Uses paths to soma from each section in section_list.
MEP calculation based on (van Elburg and van Ooyen, 2010).
Parameters¶
- cell: Cell
cell instance to pass along to pj()
- section_list: list[Section]
sections considered as ‘endpoints’ of a pathlength
Returns¶
- mepfloat
calculated MEP value
- section_list_length(cell, section_list, return_list=True)[source]¶
Calculates the total and (optionally) individual lengths of sections in a list.
Parameters¶
- cellCell
The cell instance to check for somatic sections.
- section_listlist[Section]
List of NEURON sections to measure.
- return_listbool, optional
If True, returns a list of individual section lengths. Default is True.
Returns¶
- total_lengthfloat
Total length of all sections in the list.
- length_listlist, optional
List of individual section lengths (if return_list is True).