pymovements.Gaze.report_data_quality#

Gaze.report_data_quality(*, checks: list[str] | None = None, measures: list[str] | None = None, levels: list[str] | None = None, raise_on_error: bool = False, output_path: Path | str | None = None, source_path: str = '', max_gap_factor: float = 5.0, max_deviation: float = 0.05, min_fraction: float = 0.95) → DataQualityReport[source]#

Generate a data quality report for this gaze object.

Runs validation checks via validate() and computes quality measures (data loss, fixation precision) for this single gaze file. The result is a DataQualityReport that can optionally be saved as BIDS-conformant derivative files.

Parameters:
  • checks (list[str] | None) – Check identifiers to run. None runs all eight checks. Valid values: 'trial_columns_exist', 'trial_columns_dtype', 'time_column_exists', 'gaze_components_defined', 'time_monotone', 'max_gap', 'sampling_rate_consistency', 'gaze_range'.

  • measures (list[str] | None) – Measures to compute. None computes all four. Valid values: 'data_loss', 'std_rms', 'rms_s2s', 'bcea'.

  • levels (list[str] | None) – Aggregation levels. None defaults to ['dataset', 'trial'] (meaningful for a single file; pass 'subject' or 'session' explicitly if needed).

  • raise_on_error (bool) – If True, raise ValidationError on the first 'fail' or 'error'-severity check result. (default: False)

  • output_path (Path | str | None) – If given, write BIDS-conformant derivative files here via save_bids_report(). (default: None)

  • source_path (str) – Identifier for this gaze object (e.g. a file path). Used as affected_files in failing CheckResult objects. (default: '')

  • max_gap_factor (float) – Maximum allowed inter-sample gap as a multiple of the expected ISI. Passed to the 'max_gap' check. (default: 5.0)

  • max_deviation (float) – Maximum allowed relative deviation between empirical and declared sampling rate. Passed to the 'sampling_rate_consistency' check. (default: 0.05, i.e. 5%)

  • min_fraction (float) – Minimum fraction of non-null samples that must lie within screen bounds. Passed to the 'gaze_range' check. (default: 0.95)

Returns:

Aggregated check results, quality measures, pass/fail status, and any Python warnings captured during the run.

Return type:

DataQualityReport

Raises:

Examples

>>> import polars as pl
>>> from pymovements import Gaze
>>> samples = pl.DataFrame(
...     {'time': [0, 1, 2], 'x': [0.0, 1.0, 2.0], 'y': [0.0, 1.0, 2.0]}
... )
>>> gaze = Gaze(samples=samples, pixel_columns=['x', 'y'])
>>> report = gaze.report_data_quality(checks=['time_column_exists'])
>>> report.passed
True