ETracker.stop_recording
ETracker.stop_recording(data_check=True)Stop gaze data recording and finalize session.
Performs complete shutdown: stops data collection, cleans up resources, saves all buffered data, and optionally performs a comprehensive data quality check. Handles both simulation and real eye tracker modes appropriately.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| data_check | bool | If True (default), performs data quality check by reading the saved file and analyzing timestamp gaps to detect dropped samples. If False, skips the quality check and completes faster. Default True. | True |
Raises
| Type | Description |
|---|---|
| UserWarning | If recording is not currently active. |
Details
- All pending data in buffers is automatically saved before completion
- Recording duration is measured from start_recording() call
- Quality check reads the complete saved file to analyze gaps between ALL samples, including potential gaps between save_data() calls
- At 120Hz, each sample should be ~8333µs apart; gaps significantly larger indicate dropped samples
Examples
Basic Usage
Standard stop with quality check
ET_controller.start_recording('data.h5')
# ... run experiment ...
ET_controller.stop_recording() # Shows quality reportSkip quality check for faster shutdown
ET_controller.stop_recording(data_check=False)Understanding Output
Expected quality check report
# When data_check=True, you'll see output like:
# ╔════════════════════════════╗
# ║ Recording Complete ║
# ╠════════════════════════════╣
# ║ Data collection lasted ║
# ║ approximately 120.45 sec ║
# ║ Data has been saved to ║
# ║ experiment.h5 ║
# ║ ║
# ║ Data Quality Report: ║
# ║ - Total samples: 14454 ║
# ║ - Dropped samples: 0 ║
# ╚════════════════════════════╝