Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions pyneuroml/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ def get_state_color(s: str) -> str:
if s.startswith("u"):
col = "#880088"

if '/' in s: # e.g. for sub gates
if "/" in s: # e.g. for sub gates
from pyneuroml.utils.plot import get_next_hex_color
col = get_next_hex_color()

col = get_next_hex_color()

return col

Expand All @@ -342,6 +342,7 @@ def rotate_cell(
z: float = 0,
order: str = "xyz",
relative_to_soma: bool = False,
inplace: bool = False,
) -> neuroml.Cell:
"""Return a new cell object rotated in the provided order along the
provided angles (in radians) relative to the soma position.
Expand All @@ -358,6 +359,10 @@ def rotate_cell(
:type order: str
:param relative_to_soma: whether rotation is relative to soma
:type relative_to_soma: bool
:param inplace: toggle whether the cell object should be modified inplace
or a copy created (creates and returns a copy by default)

:type inplace: bool
:returns: new neuroml.Cell object
:rtype: neuroml.Cell

Expand All @@ -374,7 +379,12 @@ def rotate_cell(
cell_origin = numpy.array(
[soma_seg.proximal.x, soma_seg.proximal.y, soma_seg.proximal.z]
)
newcell = copy.deepcopy(cell)

if not inplace:
newcell = copy.deepcopy(cell)
else:
newcell = cell

print(f"Rotating {newcell.id} by {x}, {y}, {z}")

# calculate rotations
Expand Down