navis.NeuronList.apply¶
- NeuronList.apply(func, *, parallel=False, n_cores=1, omit_failures=False, **kwargs)[source]¶
Apply function across all neurons in this NeuronList.
- Parameters:
func (callable) – Function to be applied. Must accept
BaseNeuron
as first argument.parallel (bool) – If True (default) will use multiprocessing. Spawning the processes takes time (and memory). Using
parallel=True
makes only sense if the NeuronList is large or the function takes a long time to run.n_cores (int) – Number of CPUs to use for multiprocessing. Defaults to half the available cores.
omit_failures (bool) – If True, will ignore failures.
**kwargs – Will be passed to function.
- Return type:
Results
Examples
>>> import navis >>> nl = navis.example_neurons() >>> # Apply resampling function >>> nl_rs = nl.apply(navis.resample_skeleton, resample_to=1000, inplace=False)