Skip to content

Commit

Permalink
fixes to allow for setting a custom data_dir outside of ~/.eegnb/
Browse files Browse the repository at this point in the history
  • Loading branch information
pellet committed Sep 7, 2024
1 parent a74046f commit 2b4c19d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit 2b4c19d

Please sign in to comment.