Up-sample gaze and pupil data

Description

Increase the sampling frequency to ‘target_hz’ Hz by inserting additional rows. Missing values in gaze and pupil data will be preserved for later interpolation.

Usage

upsample_gaze(
  x,
  pupil_cols = c("Pupil_Diameter"),
  gaze_cols = c("x_pred_normalised", "y_pred_normalised"),
  target_hz = 1000,
  upsample_pupil = TRUE
)

Arguments

x A dataframe containing gaze and pupil data with columns: ‘subject’, ‘trial’, and ‘time’.
pupil_cols Character vector of pupil diameter column names.
gaze_cols Character vector of gaze position column names.
target_hz Target sampling frequency (default is 1000 Hz).
upsample_pupil Logical; if ‘TRUE’, pupil data will also be upsampled.

Value

A dataframe with up-sampled time points and an ‘up_sampled’ column.