pyavs.find_eye_components_xy_correlation¶
- pyavs.find_eye_components_xy_correlation(ica: mne.preprocessing.ICA, meg_raw: mne.io.Raw, et_gaze_epochs: mne.EpochsArray, top_fraction: float = 0.05, reject: dict | None = None, verbose: bool = True) Tuple[List[int], DataFrame][source]¶
Find ICA components correlated with per-scene XY gaze position.
IC sources are epoched with the same scene_on events as
et_gaze_epochsand then both are flattened across epochs before computing Pearson r. The toptop_fractionof components ranked bymax(abs(r_gx), abs(r_gy))are flagged as eye components.- Parameters:
ica (mne.preprocessing.ICA) – Fitted ICA object.
meg_raw (mne.io.Raw) – MEG raw data (unfiltered; used to compute ICA source epochs).
et_gaze_epochs (mne.EpochsArray) – Per-scene gaze epochs from
build_et_gaze_epochs_per_scene(), with ‘gx’ and ‘gy’ channels. Its.eventsand.tmin/.tmaxdrive the matching MEG epoching.top_fraction (float, optional) – Fraction of components to flag as eye-related, ranked by max_r (default: 0.05 → top 5 %).
reject (dict or None, optional) – Amplitude rejection thresholds applied when creating MEG epochs (e.g.
dict(grad=4000e-13, mag=4e-12)). ET epochs are synced to the surviving MEG epochs after dropping.Nonekeeps all epochs.verbose (bool, optional) – Whether to log results.
- Returns:
(eye_component_indices, scores_df) where scores_df has columns ‘component’, ‘r_gx’, ‘r_gy’, ‘max_r’.
- Return type: