From 2b9831efb6d527ae0dc9e7946aeaa956b5b72d12 Mon Sep 17 00:00:00 2001 From: BadPrograms Date: Wed, 10 Dec 2025 12:11:23 +0100 Subject: [PATCH 1/2] do not add pos if none specified for add_root --- src/lineagetree/_core/_modifier.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lineagetree/_core/_modifier.py b/src/lineagetree/_core/_modifier.py index 25303d5..4f2b1cb 100644 --- a/src/lineagetree/_core/_modifier.py +++ b/src/lineagetree/_core/_modifier.py @@ -96,7 +96,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] = list(pos) lT._changed_roots = True return C_next From 66a5751fba2e9d08833aa6be391f997898177637 Mon Sep 17 00:00:00 2001 From: BadPrograms Date: Thu, 11 Dec 2025 11:18:30 +0100 Subject: [PATCH 2/2] fix --- src/lineagetree/_core/_modifier.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lineagetree/_core/_modifier.py b/src/lineagetree/_core/_modifier.py index 4f2b1cb..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 @@ -97,7 +98,7 @@ def add_root(lT: LineageTree, t: int, pos: list | None = None) -> int: lT._predecessor[C_next] = () lT._time[C_next] = t if isinstance(pos, (list, tuple)): - lT.pos[C_next] = list(pos) + lT.pos[C_next] = np.array(pos) lT._changed_roots = True return C_next