navis.cable_overlap¶
- navis.cable_overlap(a, b, dist=2, method='min')[source]¶
Calculate the amount of cable of neuron A within distance of neuron B.
- Parameters:
a (TreeNeuron | NeuronList) – Neuron(s) for which to compute cable within distance. It is highly recommended to resample neurons to guarantee an even sampling rate.
b (TreeNeuron | NeuronList) – Neuron(s) for which to compute cable within distance. It is highly recommended to resample neurons to guarantee an even sampling rate.
dist (int | float, optional) – Maximum distance. If the neurons have their .units set, you can also provides this as a string such as “2 microns”.
method ('min' | 'max' | 'mean' | 'forward' | 'reverse') –
Method by which to calculate the overlapping cable between two cables:
Assuming that neurons A and B have 300 and 150 um of cable within given distances, respectively: 1. 'min' returns 150 2. 'max' returns 300 3. 'mean' returns 225 4. 'forward' returns 300 (i.e. A->B) 5. 'reverse' returns 150 (i.e. B->A)
- Returns:
Matrix in which neurons A are rows, neurons B are columns. Cable within distance is given in the neuron’s native units:
neuronD neuronE neuronF ... neuronA 5 1 0 neuronB 10 20 5 neuronC 4 3 15 ...
- Return type:
pandas.DataFrame
See also
navis.resample_skeleton()
Use to resample neurons before calculating overlap.
Examples
>>> import navis >>> nl = navis.example_neurons(4) >>> # Cable overlap is given in the neurons' units >>> # Converting the example neurons from 8x8x8 voxel space into microns >>> # make the results easier to interpret >>> nl = nl.convert_units('um') >>> # Resample to half a micron >>> nl_res = nl.resample('.5 micron', inplace=False) >>> # Get overlapping cable within 2 microns >>> ol = navis.cable_overlap(nl_res[:2], nl_res[2:], dist='2 microns')