navis 1.4.0
  • Install
  • Quickstart
  • Tutorials
  • API
  • Changelog
  • Github
  • Ecosystem
  • Site
    • Page
        • navis.prune_at_depth
          • prune_at_depth()

    navis.prune_at_depth¶

    navis.prune_at_depth(x, depth, *, source=None, inplace=False)[source]¶

    Prune all neurites past a given distance from a source.

    Parameters:
    • x (TreeNeuron | MeshNeuron | NeuronList) –

    • depth (int | float | str) – Distance from source at which to start pruning. If neuron has its .units set, you can also pass this as a string such as “50 microns”.

    • source (int, optional) – Source node for depth calculation. If None, will use root (first root if multiple). If x is a list of neurons then must provide a source for each neuron.

    • inplace (bool, optional) – If False, pruning is performed on copy of original neuron which is then returned.

    • 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.

    Returns:

    Pruned neuron(s).

    Return type:

    TreeNeuron/List

    Examples

    >>> import navis
    >>> n = navis.example_neurons(2)
    >>> # Reroot to soma
    >>> n.reroot(n.soma, inplace=True)
    >>> # Prune all twigs farther from the root than 100 microns
    >>> # (example neuron are in 8x8x8nm units)
    >>> n_pr = navis.prune_at_depth(n,
    ...                             depth=100e3 / 8,
    ...                             inplace=False)
    >>> all(n.n_nodes > n_pr.n_nodes)
    True
    

    Back to top

    Source

    © Copyright 2018, Philipp Schlegel.
    Created using Sphinx 5.3.0.