navis.persistence_distances¶
- navis.persistence_distances(q, t=None, augment=True, normalize=True, bw=0.2, **persistence_kwargs)[source]¶
Calculate morphological similarity using persistence diagrams.
- This works by:
Generate persistence points for each neuron.
Create a weighted Gaussian from persistence points and sample 100 evenly spaced points to create a feature vector.
Calculate Euclidean distance.
- Parameters:
q/t (NeuronList) – Queries and targets, respectively. If
t=None
will run queries against queries. Neurons should have the same units, ideally nanometers.normalize (bool) – If True, will normalized the vector for each neuron to be within 0-1. Set to False if the total number of linear segments matter.
bw (float) – Bandwidth for Gaussian kernel: larger = smoother, smaller = more detailed.
augment (bool) – Whether to augment the persistence vectors with other neuron properties (number of branch points & leafs and cable length).
**persistence_kwargs – Keyword arguments are passed to
navis.persistence_points()
.
- Returns:
distances
- Return type:
pandas.DataFrame
See also
navis.persistence_points()
The function to calculate the persistence points.
navis.persistence_vectors()
Use this to get and inspect the actual vectors used here.