Skip to content
Open
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
7 changes: 4 additions & 3 deletions multipleye_settings_preprocessing.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data_collection_name: "MultiplEYE_DA_DK_Aalborg_1_2026"
data_collection_name: "MultiplEYE_ZH_CH_Zurich_1_2025"
experiment_type: "MeRID" # can be either MultiplEYE or MeRID

overwrite: False # defines whether written files will be overwritten, if they already exist. If False, preprocessed sessions will be skipped and not reprocessed.
Expand All @@ -8,10 +8,11 @@ overwrite: False # defines whether written files will be overwritten, if they al
# SESSIONS
## pick either include or exclude sessions, if none is specified, all sessions are included
include_sessions:
- 089_ZH_CH_1_ET1
exclude_sessions:
- 021_DA_DK_1_ET1
#- 021_DA_DK_1_ET1

include_pilots: True
include_pilots: False

# HARDWARE
expected_sampling_rate_hz: 1000 # Hz
Expand Down
57 changes: 51 additions & 6 deletions preprocessing/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _init_defaults(self) -> None:
#: Whether to include sessions from the pilot folder.
self.INCLUDE_PILOTS: bool = False

#:
#: Which type of experiment. E.g., supported are MultiplEYE and MeRID
self.EXPERIMENT_TYPE: str = ""

# Defines whether written files will be overwritten, if they already exist.
Expand Down Expand Up @@ -205,12 +205,12 @@ def _init_defaults(self) -> None:

#: Regex to identify the start of a recording for a trial/page.
self.START_RECORDING_REGEX = re.compile(
rf"MSG\s+(?P<timestamp>\d+)\s+(?P<type>start_recording)_(?P<{self.TRIAL_COL}>(?:PRACTICE_)?trial_\d\d?)_(?P<{self.PAGE_COL}>.*)"
r"(?P<type>start_recording)_(?P<trial>(PRACTICE_)?trial_\d\d?)_stimulus__(?P<stimulus_id>\d+)_(?P<page>\S*)"
)

#: Regex to identify the stop of a recording for a trial/page.
self.STOP_RECORDING_REGEX = re.compile(
rf"MSG\s+(?P<timestamp>\d+)\s+(?P<type>stop_recording)_(?P<{self.TRIAL_COL}>(?:PRACTICE_)?trial_\d\d?)_(?P<{self.PAGE_COL}>.*)"
r"(?P<type>stop_recording)_(?P<trial>(PRACTICE_)?trial_\d\d?)_stimulus_(?P<stimulus_name>\S*?_\S*?)_(?P<stimulus_id>\d+)_(?P<page>\S*)"
)

#: Glob pattern for raw data files.
Expand All @@ -219,6 +219,9 @@ def _init_defaults(self) -> None:
#: Glob pattern for event data files.
self.EVENT_DATA_FILE_GLOB = "*_{event_type}.csv"

#: Glob patter for reading measures files
self.READING_MEASURES_GLOB = "*_reading_measures.csv"

#: Regex to extract the stimulus order version from ASC files.
self.STIMULUS_ORDER_VERSION_REGEX = re.compile(
r"MSG\s+\d+\s+stimulus_order_version:\s+(?P<version_num>\d\d?\d?)\n"
Expand All @@ -230,12 +233,52 @@ def _init_defaults(self) -> None:
)

#: Regex to extract trial and stimulus info from raw data file names.
self.RAW_DATA_FILENAME_REGEX = rf".+_(?P<{self.TRIAL_COL}>(?:PRACTICE_)?trial_\d+)_(?P<{self.STIMULUS_COL}>[^_]+_[^_]+_\d+(\.0)?)_raw_data"
self.RAW_DATA_FILENAME_REGEX = rf"[^_]+_[^_]+_[^_]+_[^_]+_[^_]+_(?P<{self.TRIAL_COL}>(PRACTICE_)?trial_\d+)_(?P<{self.STIMULUS_COL}>[^_]+_[^_]+_\d+(\.0)?)_raw_data"

#: Regex to extract trial and stimulus info from event data file names.
self.EVENT_DATA_FILENAME_REGEX = rf".+_(?P<{self.TRIAL_COL}>(?:PRACTICE_)?trial_\d+)_(?P<{self.STIMULUS_COL}>[^_]+_[^_]+_\d+(\.0)?)_{{event_type}}.csv"
self.EVENT_DATA_FILENAME_REGEX = rf"[^_]+_[^_]+_[^_]+_[^_]+_[^_]+_(?P<{self.TRIAL_COL}>(PRACTICE_)?trial_\d+)_(?P<{self.STIMULUS_COL}>[^_]+_[^_]+_\d+(\.0)?)_{{event_type}}.csv"

#: Regex for the reading measures file name
self.READING_MEASURES_FILENAME_REGEX = r"[^_]+_[^_]+_[^_]+_[^_]+_[^_]+_(?P<trial>(PRACTICE_)?trial_\d+)_(?P<stimulus>[^_]+_[^_]+_\d+(\.0)?)_reading_measures.csv"

multipleye_messages = {
"other_screens": [
"welcome_screen",
"informed_consent_screen",
"start_experiment",
"stimulus_order_version",
"showing_instruction_screen",
"camera_setup_screen",
"practice_text_starting_screen",
"transition_screen",
"final_validation",
"show_final_screen",
"optional_break_screen",
"fixation_trigger:skipped_by_experimenter",
"fixation_trigger:experimenter_calibration_triggered",
"recalibration",
"empty_screen",
"obligatory_break",
"optional_break",
],
"break_msgs": [
"optional_break_duration",
"optional_break_end",
"optional_break",
"obligatory_break_duration",
"obligatory_break_end",
"obligatory_break",
],
}

# --- HARDWARE AND STIMULI MAPPINGS ---
self.BREAK_REGEX = re.compile(
"|".join(map(re.escape, multipleye_messages["break_msgs"]))
)
self.OTHER_SCREENS_REGEX = re.compile(
"|".join(map(re.escape, multipleye_messages["other_screens"]))
)

# --- HARDWARE ---

#: Mapping of eye tracker brands to known model names.
self.EYETRACKER_NAMES = {
Expand All @@ -247,6 +290,8 @@ def _init_defaults(self) -> None:
],
}

# --- STIMULI ---

#: Mapping of stimulus names to internal numeric IDs.
self.STIMULUS_NAME_MAPPING = {
"PopSci_MultiplEYE": 1,
Expand Down
Loading