Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Merge to master) fixes to allow for setting a custom data_dir outside of ~/.eegnb/ #282

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
4 changes: 2 additions & 2 deletions eegnb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _get_recording_dir(
data_dir=DATA_DIR,
) -> Path:
"""A subroutine of get_recording_dir that accepts subject and session as strings"""
# folder structure is /DATA_DIR/experiment/site/subject/session/*.csv
# folder structure is /DATA_DIR/experiment/board_name/site/subject/session/*.csv
recording_dir = (
Path(data_dir) / experiment / site / board_name / subject_str / session_str
)
Expand All @@ -51,7 +51,7 @@ def generate_save_fn(
) -> Path:
"""Generates a file name with the proper trial number for the current subject/experiment combo"""
recording_dir = get_recording_dir(
board_name, experiment, subject_id, session_nb, data_dir=DATA_DIR
board_name, experiment, subject_id, session_nb, data_dir=data_dir
)

# generate filename based on recording date-and-timestamp and then append to recording_dir
Expand Down
2 changes: 1 addition & 1 deletion eegnb/analysis/analysis_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def load_data(
subject_str = "*" if subject == "all" else f"subject{subject_int:04}"
session_str = "*" if session == "all" else f"session{session_int:03}"

recdir = _get_recording_dir(device_name, experiment, subject_str, session_str, site)#, data_dir)
recdir = _get_recording_dir(device_name, experiment, subject_str, session_str, site, data_dir)
data_path = os.path.join(data_dir, recdir, "*.csv")

fnames = glob(str(data_path))
Expand Down
2 changes: 1 addition & 1 deletion eegnb/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def load_data(
subject_str = "*" if subject == "all" else f"subject{subject_int:04}"
session_str = "*" if session == "all" else f"session{session_int:03}"

recdir = _get_recording_dir(device_name, experiment, subject_str, session_str, site)#, data_dir)
recdir = _get_recording_dir(device_name, experiment, subject_str, session_str, site, data_dir)
data_path = os.path.join(data_dir, recdir, "*.csv")

fnames = glob(str(data_path))
Expand Down
Loading