Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
rev: v0.16.6
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.1.0
rev: v2.3.1
hooks:
- id: mypy
additional_dependencies:
Expand All @@ -48,7 +48,7 @@ repos:
- types-simplejson
- pandas-stubs
- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
rev: v2.4.3
hooks:
- id: codespell
additional_dependencies:
Expand Down
9 changes: 5 additions & 4 deletions docs/source/pages/examples/acquisition-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ def get_file_path():
# the function get_next_ses() normally checks for the next session
# if you are recording for a new subject you can use it as well to create
# the first session folder for this subject.
session = project.get_next_ses(top_level_folder="rawdata",
sub=f"sub-{sub}_id-{id_number}")
session = project.get_next_ses(
top_level_folder="rawdata", sub=f"sub-{sub}_id-{id_number}"
)

# create the folders
created_folders = project.create_folders(
top_level_folder="rawdata",
sub_names=f"sub-{sub}_id-{id_number}",
ses_names=f"{session}_@DATETIME@",
datatype=["behav"]
datatype=["behav"],
)
# create a prompt to enter the experiment information and
# conspecific ID for social experiments.
Expand All @@ -46,7 +47,7 @@ def get_file_path():
file_name_video_1 = f"{exp_number}_{comsp_id}.avi"

# create the path to the video file
file_path1 = created_folders['behav'][0] / file_name_video_1
file_path1 = created_folders["behav"][0] / file_name_video_1
file_path1.touch()

return file_path1
Expand Down
6 changes: 3 additions & 3 deletions docs/source/pages/examples/lab-project-checker.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ This runs weekly to catch any formatting issues introduced into projects.


```python

from datashuttle import DataShuttle
import os

Expand All @@ -27,7 +26,9 @@ for p in project_list:
if os.path.isdir(project_path): # Only process directories
project = DataShuttle(p)
try:
errors = project.validate_project("rawdata", display_mode="print", strict_mode=True)
errors = project.validate_project(
"rawdata", display_mode="print", strict_mode=True
)
error_messages[p] = errors if errors else "No errors"
except Exception as e:
error_messages[p] = f"Validation failed: {e}"
Expand All @@ -41,5 +42,4 @@ with open(log_file, "w") as f:
# Optional: Print summary of error messages
for project, message in error_messages.items():
print(f"{project}: {message}")

```
18 changes: 6 additions & 12 deletions docs/source/pages/get_started/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ project.make_config_file(
If you want to change any config in the future, use the [](update_config_file()) method

```python
project.update_config_file(
local_path=r"C:\a\new\path"
)
project.update_config_file(local_path=r"C:\a\new\path")
```

We are now ready to create our standardised project folders.
Expand Down Expand Up @@ -347,7 +345,7 @@ project.create_folders(
top_level_folder="rawdata",
sub_names="sub-001",
ses_names="ses-001_@DATE@",
datatype=["behav", "ephys"]
datatype=["behav", "ephys"],
)
```

Expand All @@ -368,14 +366,11 @@ To get the next subject in this project (`sub-002`) and the next
session for that subject (`ses-001`) we can run:

```python
next_sub = project.get_next_sub("rawdata") # returns "sub-001"
next_sub = project.get_next_sub("rawdata") # returns "sub-001"
next_ses = project.get_next_ses("rawdata", sub=next_sub) # returns "ses-001"

project.create_folders(
"rawdata",
next_sub,
f"{next_ses}_@DATE@",
datatype=["behav", "ephys"]
"rawdata", next_sub, f"{next_ses}_@DATE@", datatype=["behav", "ephys"]
)
```

Expand Down Expand Up @@ -459,8 +454,7 @@ folder_path_dict = project.create_folders(
top_level_folder="rawdata",
sub_names=["sub-001"],
ses_names=["ses-001_@DATE@"],
datatype=["behav", "ephys"]

datatype=["behav", "ephys"],
)

print([path_ for path_ in folder_path_dict["behav"]])
Expand Down Expand Up @@ -693,7 +687,7 @@ project.download_custom(
top_level_folder="rawdata",
sub_names="all",
ses_names="ses-001_@*@",
datatype="behav"
datatype="behav",
)
```

Expand Down
1 change: 0 additions & 1 deletion docs/source/pages/get_started/quick-validate-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ validate_project_from_path(
project_path="/mydrive/path/to/project/project_name",
display_mode="error",
)

```

In this case, `display_mode=error` will result in an error on the first encountered validation issue.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/pages/user_guides/create-folders.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ created_folders = project.create_folders(
top_level_folder="rawdata",
sub_names=["sub-001", "002"],
ses_names="ses-001_@DATE@",
datatype=["behav", "funcimg"]
datatype=["behav", "funcimg"],
)
```

Expand Down
8 changes: 1 addition & 7 deletions docs/source/pages/user_guides/set-up-a-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,16 @@ If a project already exists, this should match the project folder name (i.e. the


```python

from datashuttle import DataShuttle

project = DataShuttle("my_project_name")

```

Next, give ``datashuttle`` the path to the project folder (this can,
but doesn't have to, include the ``project_name``)

```python

project.make_config_file(
local_path=r"C:\MyUsername\my_data\my_project_name"
)

project.make_config_file(local_path=r"C:\MyUsername\my_data\my_project_name")
```
\
The project is now ready for use, and in future can be instantiated with the line:
Expand Down
3 changes: 1 addition & 2 deletions docs/source/pages/user_guides/update-configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ For example, to change the `local_path` and `central_path`:

```python
project.update_config_file(
local_path="/a/new/local/path",
central_path="/a/new/central/path"
local_path="/a/new/local/path", central_path="/a/new/central/path"
)
```

Expand Down
15 changes: 5 additions & 10 deletions docs/source/pages/user_guides/validate.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ from datashuttle import DataShuttle

project = DataShuttle("my_project")

project.make_config_file(local_path="/path/to/my/project") # only required once, on initial project set up
project.make_config_file(
local_path="/path/to/my/project"
) # only required once, on initial project set up

error_messages = project.validate_project(
"rawdata",
Expand Down Expand Up @@ -126,14 +128,9 @@ In ``strict_mode``, non-[NeuroBlueprint](https://neuroblueprint.neuroinformatics
Therefore, any additional folders at the subject or session level will raise a validation error, for example:

```python
project.validate_project(
"rawdata",
display_mode="print",
strict_mode=True
)
project.validate_project("rawdata", display_mode="print", strict_mode=True)

# BAD_NAME: The name: some_other_folder of type: sub- is not valid. Path: <path to folder>

```

## ``include_central``
Expand All @@ -149,9 +146,7 @@ The ``include_central`` argument must be set to ``True``:

```python
error_messages = project.validate_project(
"rawdata",
display_mode="warn",
include_central=True
"rawdata", display_mode="warn", include_central=True
)
```

Expand Down
Loading