Skip to content

Commit 069bfcc

Browse files
committed
set specifications for et file name handling
1 parent cde517d commit 069bfcc

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed

mne_bids_pipeline/_config.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,28 @@
11501150
Currently not implemented
11511151
"""
11521152

1153+
et_has_run: bool = False
1154+
"""
1155+
Specify whether `run` is included in the eye-tracking data file name.
1156+
1157+
???+ example "Example"
1158+
``` python
1159+
et_has_run = False # Case with only one run and run is omitted in the file name.
1160+
et_has_run = True # Case with multiple runs. Run specification from EEG data is used.
1161+
```
1162+
"""
1163+
1164+
et_has_task: bool = False
1165+
"""
1166+
Specify whether `task` is included in the eye-tracking data file name.
1167+
1168+
???+ example "Example"
1169+
``` python
1170+
et_has_task = False # Case with only one task and task is omitted in the file name.
1171+
et_has_task = True # Case with multiple tasks. Task specification from EEG data is used.
1172+
```
1173+
"""
1174+
11531175
sync_eventtype_regex: str = ""
11541176
"""
11551177
Regular expression which will be used to select events in the EEG file for synchronisation

mne_bids_pipeline/steps/preprocessing/_05b_sync_eyelink.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ def get_input_fnames_sync_eyelink(
6767
subject: str,
6868
session: str | None,
6969
) -> dict:
70+
71+
# Get from config file whether `task` is specified in the et file name
72+
if cfg.et_has_task == True:
73+
et_task = cfg.task
74+
else:
75+
et_task = None
76+
7077
bids_basename = BIDSPath(
7178
subject=subject,
7279
session=session,
@@ -83,7 +90,7 @@ def get_input_fnames_sync_eyelink(
8390
et_bids_basename = BIDSPath(
8491
subject=subject,
8592
session=session,
86-
task=cfg.task,
93+
task=et_task,
8794
acquisition=cfg.acq,
8895
recording=cfg.rec,
8996
datatype="beh",
@@ -93,11 +100,10 @@ def get_input_fnames_sync_eyelink(
93100
extension=".asc",
94101
)
95102

96-
97103
et_edf_bids_basename = BIDSPath(
98104
subject=subject,
99105
session=session,
100-
task=cfg.task,
106+
task=et_task,
101107
acquisition=cfg.acq,
102108
recording=cfg.rec,
103109
datatype="beh",
@@ -117,16 +123,20 @@ def get_input_fnames_sync_eyelink(
117123

118124

119125
key = f"et_run-{run}"
120-
in_files[key] = et_bids_basename.copy().update(
121-
run=run
122-
)
123-
_update_for_splits(in_files, key, single=True) # TODO: Find out if we need to add this or not
126+
in_files[key] = et_bids_basename.copy()
127+
128+
if cfg.et_has_run:
129+
in_files[key].update(run=run)
130+
131+
# _update_for_splits(in_files, key, single=True) # TODO: Find out if we need to add this or not
124132

125133
key = f"et_edf_run-{run}"
126-
in_files[key] = et_edf_bids_basename.copy().update(
127-
run=run
128-
)
129-
_update_for_splits(in_files, key, single=True) # TODO: Find out if we need to add this or not
134+
in_files[key] = et_edf_bids_basename.copy()
135+
136+
if cfg.et_has_run:
137+
in_files[key].update(run=run)
138+
139+
# _update_for_splits(in_files, key, single=True) # TODO: Find out if we need to add this or not
130140

131141
return in_files
132142

@@ -341,6 +351,8 @@ def get_config(
341351
cfg = SimpleNamespace(
342352
runs=get_runs(config=config, subject=subject),
343353
remove_blink_saccades = config.remove_blink_saccades,
354+
et_has_run = config.et_has_run,
355+
et_has_task = config.et_has_task,
344356
sync_eventtype_regex = config.sync_eventtype_regex,
345357
sync_eventtype_regex_et = config.sync_eventtype_regex_et,
346358
sync_heog_ch = config.sync_heog_ch,

0 commit comments

Comments
 (0)