baseline_pupil_model#

pypillometry.signal.baseline_pupil_model(tx, sy, event_onsets, fs=1000, lp1=2, lp2=0.2)[source]#

Extract baseline based on filtering after removing stim-locked activity.

Steps:

  • filter away noise

  • regress out event-locked activity from the filtered signal using NNLS

  • remove modeled signal from filtered data

  • run another lowpass-filter to get rid of spurious signals

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

  • sy (np.ndarray) – raw pupil signal (must not contain NaN)

  • event_onsets (np.ndarray) – onsets of events (stimuli/responses), in the same units as tx (each onset is assigned to the closest sample in tx)

  • fs (float) – sampling rate in Hz

  • lp1 (float) – low-pass filter cutoff in Hz for removing random noise

  • lp2 (float) – low-pass filter cutoff in Hz for removing spurious peaks from the baseline-signal

Returns:

base (np.ndarray) – baseline estimate (same length as sy)