Skip to content

Conversation

Copy link

Copilot AI commented Dec 12, 2025

Analysis and Optimization Plan for HDF5 Saving

Files Analyzed

  • /DeToX/Base.py - Main ETracker class with HDF5 save method
  • /DeToX/Calibration.py - Calibration classes (no HDF5 saves here)
  • /DeToX/ETSettings.py - Configuration settings

Current HDF5 Save Implementation (_save_hdf5_data)

Located in Base.py lines 1861-1888:

  • Converts string columns to fixed-width bytes (S50)
  • Uses to_records() to convert DataFrame to numpy structured array
  • Opens file in append mode ('a')
  • Creates or appends to 'gaze' and 'events' tables
  • Stores metadata (screen_size, framerate, raw_format)

Issues Identified

  • Method design: Current implementation is good as a method - properly encapsulated
  • Performance: Check if compression could speed up saves
  • Buffer management: Thread-safe buffer swapping is already implemented
  • Data conversion: String to bytes conversion might be optimized

Planned Optimizations

  • Add HDF5 compression (zlib/blosc) to reduce I/O time
  • Optimize data type conversions (potentially use categorical for Events)
  • Add batch size configuration for large datasets
  • Consider using pytables filters for better compression
  • Add performance benchmarking

Files to Modify

  • DeToX/Base.py - Enhance _save_hdf5_data() method with compression
  • DeToX/ETSettings.py - Add HDF5 settings configuration (optional)
  • Add tests to validate changes
Original prompt

I want to check my folder Detox where the python script of my package are.

I want yo focus on the base file and the calibration file.

check if there the hdf5 save is good as method.

also check if there is any way to speed up the saving process


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants