navis.persistence_points¶
- navis.persistence_points(x, descriptor='root_dist', remove_cbf=False)[source]¶
Calculate points for a persistence diagram.
Based on Li et al., PLoS One (2017). Briefly, this cuts the neuron into linear segments, the start (birth) and end (death) of which are assigned a value (see
descriptor
parameter). In combination, these points represent a fingerprint for the topology of the neuron.- Parameters:
x (TreeNeuron | MeshNeuron | NeuronList) – Neuron(s) to calculate persistence poinst for. For MeshNeurons, we will use the skeleton produced by/associated with its
.skeleton
property.descriptor ('root_dist') –
Descriptor function used to calculate birth and death “time” of the segments:
root_dist
distance from root
remove_cbf (bool) – In unipolar neurons (e.g. in insects) the soma is separate and connects to the neuron’s backbone via “cell body fiber” (CBF). The length of the CBF can vary quite a bit. Discounting the CBF can make the persistence points more stable. If
remove_cbf=True
and the neuron has a soma (!) we ignore the CBF for the birth & death times. Neurons will also be automatically be rooted onto their soma!parallel (bool) – If True and input is NeuronList, use parallel processing. Requires pathos.
n_cores (int, optional) – Numbers of cores to use if
parallel=True
. Defaults to half the available cores.progress (bool) – Whether to show a progress bar. Overruled by
navis.set_pbars
.omit_failures (bool) – If True will omit failures instead of raising an exception. Ignored if input is single neuron.
- Return type:
pandas.DataFrame
Examples
>>> import navis >>> n = navis.example_neurons(1) >>> n.reroot(n.soma, inplace=True) >>> p = navis.persistence_points(n)
References
Li Y, Wang D, Ascoli GA, Mitra P, Wang Y (2017) Metrics for comparing neuronal tree shapes based on persistent homology. PLOS ONE 12(8): e0182184. https://doi.org/10.1371/journal.pone.0182184