pupil_preprocess()
is a wrapper around the other functions to allow full preprocessing of raw pupil data using a single function.
Using this method, you will need to pass many arguments to the pupil_preprocess()
function that specifies all the details and preprocessing options.
pupil_preprocess()
will be performed on an entire import_dir
directory of raw data files that match a certain pattern
in their filename. The preprocessed data will be saved to a specified output_dir
directory.
The overall workflow of pupil_preprocess()
is:
Read in raw data files pupil_read()
tracking_file
is supplied will also add message markers to the dataClean up raw data files and more
Set Timing variable to be relative to onset of each trial. set_timing()
Correlate left and right pupil size (if both eyes were recorded from). pupil_cor()
Select either left or right pupil data (if both eyes were recorded from). select_eye()
Deblink data. pupil_deblink()
Smooth (if specified). pupil_smooth()
Interpolate (if specified). pupil_interpolate()
Baseline Correct (if specified). pupil_baselinecorrect()
Remove trials with too much Missing Data. pupil_missing()
Merges files into a single merged file (if specified). pupil_merge()
A final preprocessed data file will be saved for every original raw data file.
If output_steps == TRUE
a data file will be saved after steps 3, 4, and 5. Before saving the data file at each of these steps, the final two steps 6 and 7 are performed. This results in baseline corrected and missing data removed files before each major preprocessing step. This is obviously not necessary and so output_steps = FALSE
is the default and will only save one final preprocessed data file per subject. Saving a data file after each preprocessing steps would allow you to analyze your data at different stages to assess the influence of the preprocessing methods you chose.
You will need to supply message markers to correctly preprocess your data. This image is a representation of what the message markers start_tracking.message
, trial_onset.message
, and bc_onset.message
correspond to. For further detail see Example Data Set and Message Markers Articles.
To call the GUI window execute the function in your console
You will see the following window:
For any of the parameters that do not apply to your data or preprocessing steps, then you can just leave them blank
You can both execute the pupil_preprocess()
function from the GUI itself and/or, based on the information you entered, you can copy and paste the generated R code into an R script file and save it. I highly suggest you save an R script - that way you can easily go back and change or assess what parameters you specified.