๐Ÿ“‘ report#

Generate Comprehensive Trial Reports#

The report() function generates a comprehensive analysis report for all trials in eye-tracking data. This report includes important metrics for each trial such as:

  • Recording duration

  • Total number of samples

  • Number of fixations, saccades, and blinks

  • Average fixation duration

  • Average saccade amplitude (in degrees)

This function is useful for quickly obtaining an overview of eye movement behavior across all trials in your experiment.

Parameters#

  • events (str or DataFrame): Path to events CSV file or pandas DataFrame with events data

  • output_path (str, optional): Path to save the output report CSV file. If None and events is a path, a path will be generated based on the input file

Returns#

  • When output_path is provided: Path to the generated report file (string)

  • When output_path is None and events is a DataFrame: DataFrame with the complete trial report

import etformat as et
import pandas as pd

# Load event data
events = pd.read_csv(r"D:\Github_web_page_website\test_events.csv")

# Generate report using DataFrame input
report_df = et.report(events)
report_df.head()
๐Ÿ“– etformat 1.1.1 - For Documentation, visit: https://ahsankhodami.github.io/etformat/intro.html
Generating trial report from DataFrame
Removed 7 empty or zero-filled columns
Processing 480 trials...
trial recording_duration total_samples num_fixations num_saccades num_blinks avg_fixation_duration avg_saccade_amplitude
0 1.0 4922 64 14 14 1 314.071429 2.671917
1 2.0 2704 26 5 5 0 517.800000 2.158233
2 3.0 2676 38 8 8 0 311.500000 1.861769
3 4.0 3104 32 6 6 1 459.833333 2.703100
4 5.0 2900 32 6 6 1 436.500000 1.435189

You can also generate reports directly from files:

# # Generate report from a file path
# output_path = et.report("test_events.csv")
# print(f"Report saved to: {output_path}")

Understanding the Output#

The report includes the following metrics for each trial:

  • trial: The trial number/identifier

  • recording_duration: Total duration of the trial in milliseconds

  • total_samples: Total number of samples in the trial

  • num_fixations: Number of fixation events

  • num_saccades: Number of saccade events

  • num_blinks: Number of blink events

  • avg_fixation_duration: Average duration of fixations in milliseconds

  • avg_saccade_amplitude: Average saccade amplitude in degrees of visual angle

These metrics provide a comprehensive overview of eye movement behavior for each trial, allowing for quick comparison across experimental conditions.