navis.TreeNeuron.convert_units¶
- TreeNeuron.convert_units(to, inplace=False)¶
Convert coordinates to different unit.
Only works if neuron’s
.units
is not dimensionless.- Parameters:
to (pint.Unit | str) – Units to convert to. If string, must be parsable by pint. See examples.
inplace (bool, optional) – If True will convert in place. If not will return a copy.
- Return type:
Optional
[BaseNeuron
]
Examples
>>> import navis >>> n = navis.example_neurons(1) >>> n.units <Quantity(8, 'nanometer')> >>> n.cable_length 266476.8 >>> n2 = n.convert_units('um') >>> n2.units <Quantity(1.0, 'micrometer')> >>> n2.cable_length 2131.8