From accb01da9bd846ca64bb04a7a823d289577fc13e Mon Sep 17 00:00:00 2001 From: AtMostafa Date: Mon, 11 Aug 2025 13:57:23 +0100 Subject: [PATCH] sort sunfolders to preserve gate numbers --- bnd/__init__.py | 4 ++-- bnd/config.py | 2 +- bnd/pipeline/nwbtools/beneuro_converter.py | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bnd/__init__.py b/bnd/__init__.py index 24389cb..1b3fa5c 100644 --- a/bnd/__init__.py +++ b/bnd/__init__.py @@ -1,6 +1,6 @@ # Package interface -from .cli import dl, up, to_pyal, batch_ks, init +from .cli import dl, up, to_pyal, batch_ks, init, to_nwb from .data_transfer import upload_session, download_session, download_animal -__all__ = ["dl", "up", "to_pyal", "batch_ks", "upload_session", "download_session", "download_animal", "init"] +__all__ = ["dl", "up", "to_pyal", "batch_ks", "upload_session", "download_session", "download_animal", "init", "to_nwb"] diff --git a/bnd/config.py b/bnd/config.py index 7cb6753..7914958 100644 --- a/bnd/config.py +++ b/bnd/config.py @@ -136,7 +136,7 @@ def get_animal_name(session_name) -> str: def get_subdirectories_from_pattern(directory: Path, subdir_pattern: str): subdirectory_paths = list(directory.glob(subdir_pattern)) - return subdirectory_paths + return sorted(subdirectory_paths) def _load_config() -> Config: diff --git a/bnd/pipeline/nwbtools/beneuro_converter.py b/bnd/pipeline/nwbtools/beneuro_converter.py index c1f4669..71ac7a1 100644 --- a/bnd/pipeline/nwbtools/beneuro_converter.py +++ b/bnd/pipeline/nwbtools/beneuro_converter.py @@ -117,6 +117,9 @@ def temporally_align_data_interfaces(self): spikeglx_output_folder_path = spikeglx_output_folder_path[ self.recording_to_process ] + assert f"g{self.recording_to_process}" in str(spikeglx_output_folder_path), \ + f"double check file paths: {spikeglx_output_folder_path=}" + elif len(spikeglx_output_folder_path) == 1: spikeglx_output_folder_path = spikeglx_output_folder_path[0]