src.export_balanced_chunks

export_balanced_chunks.py

Version that: - Processes sensor segment .xlsx files. - Computes modulus of acceleration,gyroscope and magnetometer, keeps S0–S2. - Truncates to median length. - Discards chunks longer than 125% of the median. - Balances class samples. - Saves output as a .hdf5 dataset (X, y) for training.

Usage:

python export_balanced_chunks.py –input output/ –output data_balanced/ –verbose 2

Functions

compute_mod_columns(df)

Compute ModA, ModG, ModM from raw accelerometer, gyroscope and magnetometer data.

main()

Main entry point to export balanced sensor chunks as an HDF5 dataset.

save_to_hdf5(X, y, output_dir[, base_name, ...])

Save the preprocessed data into an HDF5 file.