This function bins pupil data into specified time bins using either mean or median aggregation. It creates evenly spaced bins across the time series and aggregates pupil values within each bin.
bin_pupil(x, prev_op, bins_per_second, method, current_fs)
A data frame with binned pupil data containing columns:
time_secs
: Bin center timestamps
pupil_binned_{method}_{bins_per_second}hz
: Binned pupil values
A data frame containing the pupil time series data
The name of the previous operation's output column
Number of bins per second (positive integer)
Aggregation method: "mean" or "median"
Current sampling rate in Hz
This function is called by the exposed wrapper bin()
.