navis.persistence_vectors¶
- navis.persistence_vectors(x, threshold=None, samples=100, bw=0.2, center=False, **kwargs)[source]¶
Produce vectors from persistence points.
Works by creating a Gaussian and sampling
samples
evenly spaced points across it.- Parameters:
x (navis.NeuronList | pd.DataFrame | list thereof) – The persistence points (see
navis.persistence_points()
). For vectors for multiple neurons, provide either a list of persistence points DataFrames or a single DataFrame with a “neuron_id” column.threshold (float, optional) – If provided, segments shorter (death - birth) than this will not be used to create the Gaussian.
samples (int) – Number of points sampled across the Gaussian.
bw (float) – Bandwidth for Gaussian kernel: larger = smoother, smaller = more detailed.
center (bool) – Whether to center the individual curves on their highest value. This is done by “rolling” the axis (using
np.roll
) which means that elements that roll beyond the last position are re-introduced at the first.
- Returns:
vectors (np.ndarray)
samples (np.ndarray) – Sampled distances. If
center=True
the absolute values don’t make much sense anymore.
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
See also
navis.persistence_points()
The function to calculate the persistence points.
navis.persistence_distances()
Get distances based on (augmented) persistence vectors.