Skip to content

Commit

Permalink
Fixups for SWC reader defaults (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldeistler authored Nov 22, 2024
1 parent 6e79424 commit ba42d64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions jaxley/io/swc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down Expand Up @@ -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`.
Expand Down
17 changes: 9 additions & 8 deletions jaxley/utils/cell_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit ba42d64

Please sign in to comment.