changed script for combined feature creation
min duration for blink is now configurable in __main__
This commit is contained in:
parent
fc6c593f6b
commit
d79fad909c
@ -11,11 +11,12 @@ from pygazeanalyser.detectors import fixation_detection, saccade_detection
|
|||||||
# KONFIGURATION
|
# KONFIGURATION
|
||||||
##############################################################################
|
##############################################################################
|
||||||
INPUT_DIR = Path(r"/home/jovyan/data-paulusjafahrsimulator-gpu/both_mod_parquet_files")
|
INPUT_DIR = Path(r"/home/jovyan/data-paulusjafahrsimulator-gpu/both_mod_parquet_files")
|
||||||
OUTPUT_FILE = Path(r"/home/jovyan/data-paulusjafahrsimulator-gpu/new_datasets/combined_dataset_25hz.parquet")
|
OUTPUT_FILE = Path(r"/home/jovyan/data-paulusjafahrsimulator-gpu/new_datasets/fix_blink_combined_dataset_25hz.parquet")
|
||||||
|
|
||||||
WINDOW_SIZE_SAMPLES = 1250 # 50s bei 25Hz
|
WINDOW_SIZE_SAMPLES = 1250 # 50s bei 25Hz
|
||||||
STEP_SIZE_SAMPLES = 125 # 5s bei 25Hz
|
STEP_SIZE_SAMPLES = 125 # 5s bei 25Hz
|
||||||
SAMPLING_RATE = 25 # Hz
|
SAMPLING_RATE = 25 # Hz
|
||||||
|
MIN_DUR_BLINKS = 2 # x * 40ms
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -115,7 +116,7 @@ def compute_IPA(pupil, fs=25):
|
|||||||
return np.sum(Pxx[hf_band])
|
return np.sum(Pxx[hf_band])
|
||||||
|
|
||||||
|
|
||||||
def extract_eye_features_window(df_eye_window, fs=25):
|
def extract_eye_features_window(df_eye_window, fs=25, min_dur_blinks=2):
|
||||||
"""
|
"""
|
||||||
Extrahiert Eye-Tracking Features für ein einzelnes Window.
|
Extrahiert Eye-Tracking Features für ein einzelnes Window.
|
||||||
Gibt Dictionary mit allen Eye-Features zurück.
|
Gibt Dictionary mit allen Eye-Features zurück.
|
||||||
@ -160,7 +161,7 @@ def extract_eye_features_window(df_eye_window, fs=25):
|
|||||||
# ----------------------------
|
# ----------------------------
|
||||||
# BLINKS
|
# BLINKS
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
blinks = detect_blinks(pupil_validity)
|
blinks = detect_blinks(pupil_validity, min_duration=min_dur_blinks)
|
||||||
blink_durations = [(b[1] - b[0]) / fs for b in blinks]
|
blink_durations = [(b[1] - b[0]) / fs for b in blinks]
|
||||||
|
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
@ -197,7 +198,7 @@ def extract_eye_features_window(df_eye_window, fs=25):
|
|||||||
# KOMBINIERTE FEATURE-EXTRAKTION
|
# KOMBINIERTE FEATURE-EXTRAKTION
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
def process_combined_features(input_dir, output_file, window_size, step_size, fs=25):
|
def process_combined_features(input_dir, output_file, window_size, step_size, fs=25,min_duration_blinks=2):
|
||||||
"""
|
"""
|
||||||
Verarbeitet Parquet-Dateien mit FACE_AU und EYE Spalten.
|
Verarbeitet Parquet-Dateien mit FACE_AU und EYE Spalten.
|
||||||
Extrahiert beide Feature-Sets und kombiniert sie.
|
Extrahiert beide Feature-Sets und kombiniert sie.
|
||||||
@ -285,7 +286,7 @@ def process_combined_features(input_dir, output_file, window_size, step_size, fs
|
|||||||
# Eye-Tracking Features
|
# Eye-Tracking Features
|
||||||
if has_eye:
|
if has_eye:
|
||||||
try:
|
try:
|
||||||
eye_features = extract_eye_features_window(window_df[eye_columns], fs=fs)
|
eye_features = extract_eye_features_window(window_df[eye_columns], fs=fs,min_dur_blinks=min_duration_blinks)
|
||||||
result.update(eye_features)
|
result.update(eye_features)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f" WARNUNG: Eye-Features fehlgeschlagen: {str(e)}")
|
print(f" WARNUNG: Eye-Features fehlgeschlagen: {str(e)}")
|
||||||
@ -358,7 +359,8 @@ def main():
|
|||||||
output_file=OUTPUT_FILE,
|
output_file=OUTPUT_FILE,
|
||||||
window_size=WINDOW_SIZE_SAMPLES,
|
window_size=WINDOW_SIZE_SAMPLES,
|
||||||
step_size=STEP_SIZE_SAMPLES,
|
step_size=STEP_SIZE_SAMPLES,
|
||||||
fs=SAMPLING_RATE
|
fs=SAMPLING_RATE,
|
||||||
|
min_duration_blinks=MIN_DUR_BLINKS
|
||||||
)
|
)
|
||||||
|
|
||||||
if result is not None:
|
if result is not None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user