Apply a subtractive or divisive baseline correction to pupil data. See https://dr-jt.github.io/pupillometry/ for more information.

pupil_baselinecorrect(
  x,
  bc_onset_message = "",
  baseline_duration = 200,
  type = "subtractive",
  match = "exact",
  bc_onset.message = NULL,
  pre.duration = NULL
)

Arguments

x

dataframe.

bc_onset_message

Message string(s) that marks the onset of the segment to be baseline corrected. The values in the Stimulus column can be used here. Multiple values can be specified if multiple segments need to be baseline corrected.

baseline_duration

Duration of baseline period(s). Multiple values can be specified if multiple segments need to be baseline corrected with different baseline durations. default: 200

type

Do you want to use "subtractive" or "divisive" baseline correction? default: "subtractive"

match

Is the message string an "exact" match or a "pattern" match?

bc_onset.message

deprecated. see bc_onset_message

pre.duration

deprecated. see baseline_duration.

Output

Adds a `Pupil_Diameter_bc` column to the data.

Baseline correction

Baseline correction is calculated based on the median pupil size during a defined baseline period. That baseline period is defined with the

1) `bc_onset_message` argument that specifies a message string that is sent to the eye tracker at onset of the segment to be baseline corrected. The values in the Stimulus column can be used here. Multiple values can be specified if multiple segments need to be baseline corrected.

AND

2) `baseline_duration` argument that specifies the duration of the baseline period, before `bc_onset_message`, to use in calculating the median baseline pupil size.

Either "subtractive" or "divisive" baseline correction can be applied.