Skip to content

Commit

Permalink
ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandratrapani committed Nov 20, 2024
1 parent 039b0f6 commit 11f6dd3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ jobs:
run: pip install -e .
- name: Test module load
run: python -c "import hnasko_lab_to_nwb"

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ dmypy.json
.DS_Store

# NWB files
**.nwb
**.nwb
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pip install hnasko-lab-to-nwb

We recommend that you install the package inside a [virtual environment](https://docs.python.org/3/tutorial/venv.
html). A simple way of doing this is to use a [conda environment](https://docs.conda.
io/projects/conda/en/latest/user-guide/concepts/environments.html) from the `conda` package manager ([installation
instructions](https://docs.conda.io/en/latest/miniconda.html)). Detailed instructions on how to use conda
io/projects/conda/en/latest/user-guide/concepts/environments.html) from the `conda` package manager ([installation
instructions](https://docs.conda.io/en/latest/miniconda.html)). Detailed instructions on how to use conda
environments can be found in their [documentation](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html).

### Running a specific conversion
Expand All @@ -30,10 +30,10 @@ python convert_session.py
```

## Installation from GitHub
Another option is to install the package directly from GitHub. This option has the advantage that the source code
can be modified if you need to amend some of the code we originally provided to adapt to future experimental
differences. To install the conversion from GitHub you will need to use `git` ([installation instructions] (https://github.com/git-guides/install-git)).
We also recommend the installation of `conda` ([installation instructions](https://docs.conda.io/en/latest/miniconda.html)) as it contains all the required
Another option is to install the package directly from GitHub. This option has the advantage that the source code
can be modified if you need to amend some of the code we originally provided to adapt to future experimental
differences. To install the conversion from GitHub you will need to use `git` ([installation instructions] (https://github.com/git-guides/install-git)).
We also recommend the installation of `conda` ([installation instructions](https://docs.conda.io/en/latest/miniconda.html)) as it contains all the required
machinery in a single and simple install.

From a terminal (note that conda should install one in your system) you can do the following:
Expand All @@ -47,7 +47,7 @@ conda activate hnasko-lab-to-nwb-env

This creates a [conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/environments.html) which isolates the conversion code from your system libraries. We recommend that you run all your conversion related tasks and analysis from the created environment in order to minimize issues related to package dependencies.

Alternatively, if you want to avoid conda altogether (for example if you use another virtual environment tool) you
Alternatively, if you want to avoid conda altogether (for example if you use another virtual environment tool) you
can install the repository with the following commands using only pip:

```
Expand Down Expand Up @@ -94,11 +94,11 @@ Each conversion is organized in a directory of its own in the `src` directory:

└── __init__.py

For example, for the conversion `embargo_2025` you can find a directory located in `src/hnasko-lab-to-nwb/embargo_2025`.
For example, for the conversion `embargo_2025` you can find a directory located in `src/hnasko-lab-to-nwb/embargo_2025`.
Inside each conversion directory you can find the following files:


* `convert_sesion.py`: this script defines the function to convert one full session of the conversion.
* `convert_sesion.py`: this script defines the function to convert one full session of the conversion.
* `metadata.yml`: metadata in yaml format for this specific conversion.
* `behaviorinterface.py`: the behavior interface. Usually ad-hoc for each conversion.
* `nwbconverter.py`: the place where the `NWBConverter` class is defined.
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,3 @@ fixable = ["ALL"]
[tool.ruff.lint.isort]
relative-imports-order = "closest-to-furthest"
known-first-party = ["neuroconv"]

19 changes: 10 additions & 9 deletions src/hnasko_lab_to_nwb/embargo_2025/convert_all_sessions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Primary script to run to convert all sessions in a dataset using session_to_nwb."""
from pathlib import Path
from typing import Union
import traceback
from concurrent.futures import ProcessPoolExecutor, as_completed
from pathlib import Path
from pprint import pformat
import traceback
from typing import Union

from tqdm import tqdm

from .embargo_2025_convert_session import session_to_nwb
Expand Down Expand Up @@ -39,7 +40,7 @@ def dataset_to_nwb(
for session_to_nwb_kwargs in session_to_nwb_kwargs_per_session:
session_to_nwb_kwargs["output_dir_path"] = output_dir_path
session_to_nwb_kwargs["verbose"] = verbose
exception_file_path = data_dir_path / f"ERROR_<nwbfile_name>.txt" # Add error file path here
exception_file_path = data_dir_path / f"ERROR_<nwbfile_name>.txt" # Add error file path here
futures.append(
executor.submit(
safe_session_to_nwb,
Expand Down Expand Up @@ -86,11 +87,11 @@ def get_session_to_nwb_kwargs_per_session(
list[dict[str, Any]]
A list of dictionaries containing the kwargs for session_to_nwb for each session.
"""
#####
# # Implement this function to return the kwargs for session_to_nwb for each session
# This can be a specific list with hard-coded sessions, a path expansion or any conversion specific logic that you might need
#####
raise NotImplementedError
#####
# # Implement this function to return the kwargs for session_to_nwb for each session
# This can be a specific list with hard-coded sessions, a path expansion or any conversion specific logic that you might need
#####
raise NotImplementedError


if __name__ == "__main__":
Expand Down

0 comments on commit 11f6dd3

Please sign in to comment.