Skip to content

Commit

Permalink
r.xform_brain: if present, also convert soma_radius
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Oct 4, 2020
1 parent 029311b commit 5593205
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions navis/interfaces/r.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"""
import math
import numbers
import os
import sys

Expand Down Expand Up @@ -1164,6 +1165,10 @@ def xform_brain(x: Union['core.NeuronObject', 'pd.DataFrame', 'np.ndarray'],
if isinstance(xf.units, (config.ureg.Unit, config.ureg.Quantity)):
xf.units = (xf.units / 10**magnitude).to_compact()

# Fix soma radius if applicable
if hasattr(xf, 'soma_radius') and isinstance(xf.soma_radius, numbers.Number):
xf.soma_radius *= 10**magnitude

return xf
elif isinstance(x, pd.DataFrame):
if any([c not in x.columns for c in ['x', 'y', 'z']]):
Expand Down

0 comments on commit 5593205

Please sign in to comment.