diff --git a/src/lineagetree/_core/_modifier.py b/src/lineagetree/_core/_modifier.py index 25303d5..dccfe08 100644 --- a/src/lineagetree/_core/_modifier.py +++ b/src/lineagetree/_core/_modifier.py @@ -3,6 +3,7 @@ from collections.abc import Callable, Iterable from functools import wraps from typing import TYPE_CHECKING +import numpy as np if TYPE_CHECKING: from ..lineage_tree import LineageTree @@ -96,7 +97,8 @@ def add_root(lT: LineageTree, t: int, pos: list | None = None) -> int: lT._successor[C_next] = () lT._predecessor[C_next] = () lT._time[C_next] = t - lT.pos[C_next] = pos if isinstance(pos, list) else [] + if isinstance(pos, (list, tuple)): + lT.pos[C_next] = np.array(pos) lT._changed_roots = True return C_next