navis.TreeNeuron.snap¶
- TreeNeuron.snap(locs, to='nodes')[source]¶
Snap xyz location(s) to closest node or synapse.
- Parameters:
locs ((N, 3) array | (3, ) array) – Either single or multiple XYZ locations.
to ("nodes" | "connectors") – Whether to snap to nodes or connectors.
- Returns:
id (int | list of int) – ID(s) of the closest node/connector.
dist (float | list of float) – Distance(s) to the closest node/connector.
Examples
>>> import navis >>> n = navis.example_neurons(1) >>> id, dist = n.snap([0, 0, 0]) >>> id 1124