From ba42d64142a6eedc6e0d2c5579e2e6c147163f8b Mon Sep 17 00:00:00 2001 From: Michael Deistler Date: Fri, 22 Nov 2024 08:02:30 +0100 Subject: [PATCH] Fixups for SWC reader defaults (#527) --- jaxley/io/swc.py | 6 +++--- jaxley/utils/cell_utils.py | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/jaxley/io/swc.py b/jaxley/io/swc.py index ff4a61d3..c33aad3d 100644 --- a/jaxley/io/swc.py +++ b/jaxley/io/swc.py @@ -22,7 +22,7 @@ def swc_to_jaxley( fname: str, - max_branch_len: float = 100.0, + max_branch_len: Optional[float] = None, sort: bool = True, num_lines: Optional[int] = None, ) -> Tuple[List[int], List[float], List[Callable], List[float], List[np.ndarray]]: @@ -99,9 +99,9 @@ def read_swc( fname: str, ncomp: Optional[int] = None, nseg: Optional[int] = None, - max_branch_len: float = 300.0, + max_branch_len: Optional[float] = None, min_radius: Optional[float] = None, - assign_groups: bool = False, + assign_groups: bool = True, ) -> Cell: """Reads SWC file into a `Cell`. diff --git a/jaxley/utils/cell_utils.py b/jaxley/utils/cell_utils.py index 229e5789..d71014c2 100644 --- a/jaxley/utils/cell_utils.py +++ b/jaxley/utils/cell_utils.py @@ -16,18 +16,19 @@ def _split_into_branches_and_sort( content: np.ndarray, - max_branch_len: float, + max_branch_len: Optional[float], is_single_point_soma: bool, sort: bool = True, ) -> Tuple[np.ndarray, np.ndarray]: branches, types = _split_into_branches(content, is_single_point_soma) - branches, types = _split_long_branches( - branches, - types, - content, - max_branch_len, - is_single_point_soma=is_single_point_soma, - ) + if max_branch_len is not None: + branches, types = _split_long_branches( + branches, + types, + content, + max_branch_len, + is_single_point_soma=is_single_point_soma, + ) if sort: first_val = np.asarray([b[0] for b in branches])