pupil_build_design_matrix#

pypillometry.signal.pupil_build_design_matrix(tx, event_onsets, fs, npar, tmax, max_duration='estimate')[source]#

Construct design matrix (nevents x n). Each row has a single pupil-kernel with parameters npar, tmax starting at each event_onset.

Parameters:
  • tx (np.ndarray) – time-vector in ms, sampled at fs

  • event_onsets (np.ndarray) – timing of the events in ms (each onset is assigned to the closest sample in tx)

  • fs (float) – sampling rate (Hz)

  • npar (float) – n in the equation of pupil_kernel()

  • tmax (float) – \(t_{max}\) in pupil_kernel(), in ms

  • max_duration (float or "estimate") – either maximum duration in milliseconds or string “estimate” which causes the function to determine an appropriate duration based on the kernel parameters npar and tmax

Returns:

x1 (np.ndarray) – design matrix (nevents x n), where n is the length of tx