From eee173dc0bd81153821e44f96e1b50382a46762e Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 26 Jan 2026 17:53:54 +0100 Subject: [PATCH] added clean eye df call to combined feature creation bug fix, was missing in combined feature creation script --- dataset_creation/combined_feature_creation.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dataset_creation/combined_feature_creation.py b/dataset_creation/combined_feature_creation.py index 9b6097e..c525a6f 100644 --- a/dataset_creation/combined_feature_creation.py +++ b/dataset_creation/combined_feature_creation.py @@ -11,7 +11,7 @@ from pygazeanalyser.detectors import fixation_detection, saccade_detection # KONFIGURATION ############################################################################## INPUT_DIR = Path(r"/home/jovyan/data-paulusjafahrsimulator-gpu/both_mod_parquet_files") -OUTPUT_FILE = Path(r"/home/jovyan/data-paulusjafahrsimulator-gpu/new_datasets/blink_fix_dataset.parquet") +OUTPUT_FILE = Path(r"/home/jovyan/data-paulusjafahrsimulator-gpu/new_datasets/50s_25Hz_dataset.parquet") WINDOW_SIZE_SAMPLES = 25*50 # 50s bei 25Hz STEP_SIZE_SAMPLES = 125 # 5s bei 25Hz @@ -26,6 +26,7 @@ MIN_DUR_BLINKS = 2 # x * 40ms def clean_eye_df(df): """Extrahiert nur Eye-Tracking Spalten und entfernt leere Zeilen.""" eye_cols = [c for c in df.columns if c.startswith("EYE_")] + if not eye_cols: return pd.DataFrame() @@ -56,13 +57,14 @@ def extract_gaze_signal(df): gx_R[~val_R] = np.nan gy_R[~val_R] = np.nan + # Mittelwert beider Augen gx = np.mean(np.column_stack([gx_L, gx_R]), axis=1) gy = np.mean(np.column_stack([gy_L, gy_R]), axis=1) # Interpolation - gx = pd.Series(gx).interpolate(limit=50, limit_direction="both").bfill().ffill() - gy = pd.Series(gy).interpolate(limit=50, limit_direction="both").bfill().ffill() + gx = pd.Series(gx).interpolate(limit=None, limit_direction="both").bfill().ffill() + gy = pd.Series(gy).interpolate(limit=None, limit_direction="both").bfill().ffill() # MinMax Skalierung xscaler = MinMaxScaler() @@ -226,6 +228,7 @@ def process_combined_features(input_dir, output_file, window_size, step_size, fs try: df = pd.read_parquet(parquet_file) print(f" Einträge: {len(df)}") + # Identifiziere Spalten au_columns = [col for col in df.columns if col.startswith('FACE_AU')] @@ -286,6 +289,9 @@ def process_combined_features(input_dir, output_file, window_size, step_size, fs # Eye-Tracking Features if has_eye: try: + # clean dataframe from all nan rows + window_df= clean_eye_df(window_df) + eye_features = extract_eye_features_window(window_df[eye_columns], fs=fs,min_dur_blinks=min_duration_blinks) result.update(eye_features) except Exception as e: