diff --git a/README.md b/README.md index de292de..7809876 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,17 @@ Play around with it and raise Github issues if anything fails conda env create --file=processing_env.yml ``` + For kilosorting you will also need: + 1. Install kilosort and the GUI, run `python -m pip install kilosort[gui]`. If you're on a zsh server, you may need to use `python -m pip install "kilosort[gui]"` + 2. You can also just install the minimal version of kilosort with python -m pip install kilosort. + 3. Next, if the CPU version of pytorch was installed (will happen on Windows), remove it with `pip uninstall torch` + 4. Then install the GPU version of pytorch `conda install pytorch pytorch-cuda=11.8 -c pytorch -c nvidia` + If you installed the base environment and want to update later on: ```shell - conda env --file=processing_env.yml + conda env update --file=processing_env.yml ``` + And then do the kilosort step 4. Create your configuration file: ```shell bnd init # Provide the path to local and remote data storage diff --git a/bnd/pipeline/kilosort.py b/bnd/pipeline/kilosort.py index 64e538a..f765093 100644 --- a/bnd/pipeline/kilosort.py +++ b/bnd/pipeline/kilosort.py @@ -157,15 +157,19 @@ def run_kilosort_on_session(session_path: Path) -> None: logger.warning(f"Kilosort output already exists. Skipping kilosort call") else: + ephys_recording_folders = config.get_subdirectories_from_pattern( + session_path, "*_g?" + ) # Check kilosort is installed in environment if torch.cuda.is_available(): logger.info(f"CUDA is available. GPU device: {torch.cuda.get_device_name(0)}") else: logger.warning("CUDA is not available. GPU computations will not be enabled.") - return - ephys_recording_folders = config.get_subdirectories_from_pattern( - session_path, "*_g?" - ) + if len(ephys_recording_folders) > 1: + raise ValueError( + "It seems you are trying to run kilosort without GPU. Look at the README on instrucstions of how to do this. " + ) + for recording_path in ephys_recording_folders: logger.info(f"Processing recording: {recording_path.name}") run_kilosort_on_recording( diff --git a/bnd/pipeline/nwb.py b/bnd/pipeline/nwb.py index cd227dc..b7e69d4 100644 --- a/bnd/pipeline/nwb.py +++ b/bnd/pipeline/nwb.py @@ -116,7 +116,7 @@ def run_nwb_conversion(session_path: Path, kilosort_flag: bool, custom_map: bool .strip() .lower() ) - if response != "y": + if "y" not in response: logger.warning(f"Aborting nwb conversion") return else: diff --git a/bnd/pipeline/pyaldata.py b/bnd/pipeline/pyaldata.py index 6eb74f6..6a6cab7 100644 --- a/bnd/pipeline/pyaldata.py +++ b/bnd/pipeline/pyaldata.py @@ -857,12 +857,12 @@ def save(self): .lower() .strip() ) - if user_input == "y": + if "y" in user_input: self._partition_and_save_to_mat() logger.info("Session has been overwritten.") break - elif user_input == "n": + elif "n" in user_input: logger.info("Session was not overwritten.") break diff --git a/processing_env.yml b/processing_env.yml index 84dcf7d..36250ba 100644 --- a/processing_env.yml +++ b/processing_env.yml @@ -9,15 +9,12 @@ dependencies: - python=3.10 - pytest - typer - - pytorch - - pytorch-cuda=11.8 - pynwb - numpy - pandas - scipy - spikeinterface - pip: - - kilosort - ndx_pose - neuroconv - -e ./ \ No newline at end of file