downsample_trialtree#
- ethograph.io.dataset.downsample_trialtree(dt, factor)[source]#
Downsample every trial in a TrialTree using a min-max envelope.
For each contiguous block of factor samples, two values are kept: the block minimum and maximum. This preserves peaks and troughs (important for spike-like signals) while reducing the number of samples by roughly
factor / 2.All time-like dimensions in every trial are downsampled independently, so datasets with mixed sampling rates (e.g. 30 Hz pose + 44 kHz audio) are handled correctly.
- Parameters:
- Returns:
New tree with downsampled data. Each trial’s
attrsincludesdownsample_factoranddownsample_method.- Return type:
Examples
>>> import ethograph as eto >>> dt = eto.open("high_rate_experiment.nc") >>> dt_small = eto.downsample_trialtree(dt, factor=20) >>> dt_small.save("experiment_downsampled.nc")