pupilresponse_nnls#

pypillometry.signal.pupilresponse_nnls(tx, sy, event_onsets, fs, npar=10.1, tmax=930)[source]#

Estimate single-event pupil responses based on canonical PRF (pupil_kernel()) using non-negative least-squares (NNLS).

Parameters:
  • tx (np.ndarray) – time-vector in milliseconds

  • sy (np.ndarray) – (baseline-corrected) pupil signal

  • event_onsets (np.ndarray) – onsets of events (stimuli/responses) in milliseconds

  • fs (float) – sampling rate in Hz

  • npar (float) – parameter \(n\) for pupil_kernel()

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

Returns:

  • coef (np.ndarray) – purely-positive regression coefficients (one per event)

  • pred (np.ndarray) – predicted signal

  • resid (np.ndarray) – residuals (sy-pred)