Skip to content
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
22 changes: 22 additions & 0 deletions mne_bids_pipeline/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,28 @@
Currently not implemented
"""

et_has_run: bool = False
"""
Specify whether `run` is included in the eye-tracking data file name.

???+ example "Example"
``` python
et_has_run = False # Case with only one run and run is omitted in the file name.
et_has_run = True # Case with multiple runs. Run specification from EEG data is used.
```
"""

et_has_task: bool = False
"""
Specify whether `task` is included in the eye-tracking data file name.

???+ example "Example"
``` python
et_has_task = False # Case with only one task and task is omitted in the file name.
et_has_task = True # Case with multiple tasks. Task specification from EEG data is used.
```
"""

sync_eventtype_regex: str = ""
"""
Regular expression which will be used to select events in the EEG file for synchronisation
Expand Down
34 changes: 23 additions & 11 deletions mne_bids_pipeline/steps/preprocessing/_05b_sync_eyelink.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ def get_input_fnames_sync_eyelink(
subject: str,
session: str | None,
) -> dict:

# Get from config file whether `task` is specified in the et file name
if cfg.et_has_task == True:
et_task = cfg.task
else:
et_task = None

bids_basename = BIDSPath(
subject=subject,
session=session,
Expand All @@ -83,7 +90,7 @@ def get_input_fnames_sync_eyelink(
et_bids_basename = BIDSPath(
subject=subject,
session=session,
task=cfg.task,
task=et_task,
acquisition=cfg.acq,
recording=cfg.rec,
datatype="beh",
Expand All @@ -93,11 +100,10 @@ def get_input_fnames_sync_eyelink(
extension=".asc",
)


et_edf_bids_basename = BIDSPath(
subject=subject,
session=session,
task=cfg.task,
task=et_task,
acquisition=cfg.acq,
recording=cfg.rec,
datatype="beh",
Expand All @@ -117,16 +123,20 @@ def get_input_fnames_sync_eyelink(


key = f"et_run-{run}"
in_files[key] = et_bids_basename.copy().update(
run=run
)
_update_for_splits(in_files, key, single=True) # TODO: Find out if we need to add this or not
in_files[key] = et_bids_basename.copy()

if cfg.et_has_run:
in_files[key].update(run=run)

# _update_for_splits(in_files, key, single=True) # TODO: Find out if we need to add this or not

key = f"et_edf_run-{run}"
in_files[key] = et_edf_bids_basename.copy().update(
run=run
)
_update_for_splits(in_files, key, single=True) # TODO: Find out if we need to add this or not
in_files[key] = et_edf_bids_basename.copy()

if cfg.et_has_run:
in_files[key].update(run=run)

# _update_for_splits(in_files, key, single=True) # TODO: Find out if we need to add this or not

return in_files

Expand Down Expand Up @@ -341,6 +351,8 @@ def get_config(
cfg = SimpleNamespace(
runs=get_runs(config=config, subject=subject),
remove_blink_saccades = config.remove_blink_saccades,
et_has_run = config.et_has_run,
et_has_task = config.et_has_task,
sync_eventtype_regex = config.sync_eventtype_regex,
sync_eventtype_regex_et = config.sync_eventtype_regex_et,
sync_heog_ch = config.sync_heog_ch,
Expand Down