navis.BaseNeuron.map_units¶
- BaseNeuron.map_units(units, on_error='raise')[source]¶
Convert units to match neuron space.
Only works if neuron’s
.units
is isometric and not dimensionless.- Parameters:
units (number | str | pint.Quantity | pint.Units) – The units to convert to neuron units. Simple numbers are just passed through.
on_error ("raise" | "ignore") – What to do if an error occurs (e.g. because neuron does not have units specified). If “ignore” will simply return
units
unchanged.
See also
navis.core.to_neuron_space()
The base function for this method.
Examples
>>> import navis >>> # Example neurons are in 8x8x8nm voxel space >>> n = navis.example_neurons(1) >>> n.map_units('1 nanometer') 0.125 >>> # Numbers are passed-through >>> n.map_units(1) 1 >>> # For neuronlists >>> nl = navis.example_neurons(3) >>> nl.map_units('1 nanometer') [0.125, 0.125, 0.125]