jaxley.morphology.distance_direct#
- distance_direct(startpoint, endpoints)[source]#
Returns the direct distance between a root and other compartments.
This function uses
cell.nodes[['x', 'y', 'z']]and computes the euclidean distance (i.e., the line of sight distance).- Parameters:
- Returns:
A list of distances.
- Return type:
Example usage#
The following computes the direct (line of sight) distance between the zero-eth soma compartment and all other compartments. It then saves this distance in cell.nodes[“direct_dist_from_soma”].
from jaxley.morphology import distance_pathwise cell.compute_compartment_centers() # necessary if you modified branch length. direct_dists = distance_direct(cell.soma.branch(0).comp(0), cell) cell.nodes["direct_dist_from_soma"] = direct_dists