Skip to content

Commit

Permalink
BUG: find file and glob
Browse files Browse the repository at this point in the history
  • Loading branch information
jungheejung committed Aug 27, 2024
1 parent 3f6114e commit 19097c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions spacetop_prep/events/bidsify_fractional_combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def parse_args():
print(f'No behavior data file found for {bids_string}. Skipping to next task.')
else:
# Get a list of all relevant files, excluding specific subjects
saxe_flist = list(Path(beh_inputdir).rglob(f'**/{task_name}*.csv'))
saxe_flist = list(Path(beh_inputdir).rglob(f'**/*{task_name}*.csv'))
filtered_saxe_flist = [file for file in saxe_flist if "sub-0001" not in str(file)]

if filtered_saxe_flist:
Expand Down Expand Up @@ -320,7 +320,7 @@ def parse_args():
print(f'No behavior data file found for {args.bids_string}. Skipping to next task.')
else:
# If no bids_string is provided, search for all relevant files excluding specific subjects
posner_flist = list(Path(beh_inputdir).rglob(f'**/{extract_task_name}*.csv'))
posner_flist = list(Path(beh_inputdir).rglob(f'**/*{extract_task_name}*.csv'))

# Filter out files belonging to the excluded subject (e.g., "sub-0001")
filtered_posner_flist = [file for file in posner_flist if "sub-0001" not in str(file)]
Expand Down Expand Up @@ -601,7 +601,7 @@ def parse_args():
print(f'No behavior data file found for {args.bids_string}. Skipping to next task.')
else:
# If no bids_string is provided, search for all relevant files excluding specific subjects
memory_flist = list(Path(beh_inputdir).rglob(f'**/{task_name}*.csv'))
memory_flist = list(Path(beh_inputdir).rglob(f'**/*{task_name}*.csv'))

# Filter out files belonging to the excluded subject (e.g., "sub-0001")
filtered_memory_flist = [file for file in memory_flist if "sub-0001" not in str(file)]
Expand Down Expand Up @@ -832,7 +832,7 @@ def parse_args():
print(f'No behavior data file found for {bids_string}. Skipping to next task.')
else:
# If no bids_string is provided, search for all relevant files excluding specific subjects
spunt_flist = list(Path(beh_inputdir).rglob(f'**/{task_name}*.csv'))
spunt_flist = list(Path(beh_inputdir).rglob(f'**/*{task_name}*.csv'))

# Filter out files belonging to the excluded subject (e.g., "sub-0001")
filtered_spunt_flist = [file for file in spunt_flist if "sub-0001" not in str(file)]
Expand Down
10 changes: 5 additions & 5 deletions spacetop_prep/events/bidsify_fractional_subtask.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def parse_args():
print(f'No behavior data file found for {args.bids_string}. Skipping to next task.')
else:
# Get a list of all relevant files, excluding specific subjects
saxe_flist = list(Path(beh_inputdir).rglob(f'**/{task_name}*.csv'))
saxe_flist = list(Path(beh_inputdir).rglob(f'**/*{task_name}*.csv'))
filtered_saxe_flist = [file for file in saxe_flist if "sub-0001" not in str(file)]


Expand Down Expand Up @@ -306,7 +306,7 @@ def parse_args():
print(f'standard beh file exists')
else:
# If no bids_string is provided, search for all relevant files excluding specific subjects
posner_flist = list(Path(beh_inputdir).rglob(f'**/{task_name}*.csv'))
posner_flist = list(Path(beh_inputdir).rglob(f'**/*{task_name}*.csv'))

# Filter out files belonging to the excluded subject (e.g., "sub-0001")
filtered_posner_flist = [file for file in posner_flist if "sub-0001" not in str(file)]
Expand Down Expand Up @@ -525,14 +525,14 @@ def parse_args():
filtered_memory_flist = temp_flist
else:
# If neither standard nor TEMP files are found, log a message and return an empty list
print(f'No behavior data file found for {args.bids_string}. Checked both standard and temporary filenames.')
print(f'No behavior data file found for {sub}*{ses}*task-fractional*{run}. Checked both standard and temporary filenames.')
filtered_memory_flist = None
else:
# If standard files are found, use them
filtered_memory_flist = memory_flist
else:
# If no bids_string is provided, search for all relevant files excluding specific subjects
memory_flist = list(Path(beh_inputdir).rglob(f'**/{task_name}*.csv'))
memory_flist = list(Path(beh_inputdir).rglob(f'**/*{task_name}*.csv'))

# Filter out files belonging to the excluded subject (e.g., "sub-0001")
filtered_memory_flist = [file for file in memory_flist if "sub-0001" not in str(file)]
Expand Down Expand Up @@ -753,7 +753,7 @@ def parse_args():
filtered_spunt_flist = spunt_flist
else:
# If no bids_string is provided, search for all relevant files excluding specific subjects
spunt_flist = list(Path(beh_inputdir).rglob(f'**/{task_name}*.csv'))
spunt_flist = list(Path(beh_inputdir).rglob(f'**/*{task_name}*.csv'))

# Filter out files belonging to the excluded subject (e.g., "sub-0001")
filtered_spunt_flist = [file for file in spunt_flist if "sub-0001" not in str(file)]
Expand Down

0 comments on commit 19097c2

Please sign in to comment.