Pupillometry (measurement of changes in pupil size) is an effective indicator of various perceptual, cognitive and affective processes (for reviews, see Mathôt, 2018; van der Wel & van Steenbergen, 2018). Pupil size is used in studies examining attentional processes (Breeden, Siegle, Norr, Gordon, & Vaidya, 2017; Geva, Zivan, Warsha, & Olchik, 2013; van Steenbergen & Band, 2013), mental workload (Beatty, 1982; Hess & Polt, 1964; Kahneman & Beatty, 1966; Klingner, Tversky, & Hanrahan, 2011), surprise (Braem, Coenen, Bombeke, van Bochove, & Notebaert, 2015; Preuschoff, ’t Hart, & Einhäuser, 2011), memory (Beatty & Kahneman, 1966; Goldinger & Papesh, 2012; Otero, Weekes, & Hutton, 2011), and decision making (Einhäuser, Koch, & Carter, 2010; Murphy, Vandekerckhove, & Nieuwenhuis, 2014a). Pupil size also reflects high-order visual processing (Einhäuser, Stout, Koch, & Carter, 2008; Kloosterman et al., 2015; Kuchinke, Võ, Hofmann, & Jacobs, 2007; Naber & Nakayama, 2013), and movement preparation (Wang, Brien, & Munoz, 2015; Wang, McInnis, Brien, Pari, & Munoz, 2016). Moreover, pupil size is commonly used as an indicator of arousal and affective processing (Bradley, Miccoli, Escrig, & Lang, 2008; Cohen, Moyal, & Henik, 2015; Hess & Polt, 1960; Partala & Surakka, 2003; Siegle, Steinhauer, Carter, Ramel, & Thase, 2003; Unsworth & Robison, 2017; van Steenbergen, Band, & Hommel, 2011). Pupillometry (mainly pupil light reflex) is also frequently used in ophthalmology studies assessing the physiology of pupil dynamics, as well as changes to pupil size due to diseases such as multiple sclerosis and diabetes (Barbur, Harlow, & Sahraie, 2007; Binda et al., 2017; Feigl et al., 2012; Kostic et al., 2016; McDougal & Gamlin, 2010; Phillips, Szabadi, & Bradshaw, 2001; Wilhelm, Wilhelm, Moro, & Barbur, 2002).

Researchers who are interested in pupillometry use eyetracking devices (e.g., EyeLink, Tobii, Ergoneers, and Mangold), which provide information on eye movements as well as pupil size. Although there are open-source tools for processing the eye movement data recorded by these devices (Li, 2017; Sogo, 2013; Zhegallo & Marmalyuk, 2015), there is a lack of tools for processing and analyzing pupillometry data.

Some of the current eyetracker companies offer basic tools for processing pupillometry data (e.g., Data Viewer by SR Research, Tobii Pro Lab by Tobii, etc.), but these tools follow different conventions and include only basic processing of the data. For example, these tools do not correct for blinks or allow for a time-course visualization of the data. Although there have been some attempts to provide guidelines and scripts for the preprocessing of pupil size data (Kret & Sjak-Shie, 2018; Mathôt, Fabius, Van Heusden, & Van der Stigchel, 2018), these works do not offer researchers tools for advanced processing and analyses.

For this reason, we developed CHAP (Cohen and Hershman Analysis Pupil), open-source software written in MATLAB. This software provides a user-friendly graphical user interface (GUI) for processing and analyzing pupillometry data. The software receives input of a standard data file from common eyetrackers such as EyeLink (.edf file), Tobii, Applied Science Laboratories (ASL), or Eye Tribe (.csv file), and provides both preprocessing and analysis of the data. Our software aims to create uniform conventions for the preprocessing and analysis of pupillometry data, and to offer a quick and easy-to-implement tool for researchers interested in pupillometry.

CHAP’s input

CHAP receives input of a standard data file from various eyetrackers. It receives input from EyeLink (.edf file), Eye Tribe (both .txt and .csv files; see Appendix A for an example), and Tobii and ASL eyetrackers (.csv files; see Appendixes A and B for examples). CHAP also supports data files from other eyetracker devices, as long as they have a specific format (.dat files; see Appendix B for an example). These input files (.edf, .csv, .txt, or .dat files) include data on pupil size, as well as information the user entered when programming the experiment (e.g., trial number, condition). Various software programs, such as E-Prime (application software package; Psychology Software Tools, 2001), MATLAB, and Experiment Builder (SR Research program provided by EyeLink), can be used to build pupillometry experiments and their use depends on the eyetracker and on specific task requirements. For processing EyeLink data files (.edf), CHAP uses the EDFMEX software (Beta Version 0.9; SR Research, Ontario, Canada) and the EDFMAT software (Version 1.6; developed by Adrian Etter and Marc Biedermann, University of Zurich), which read the EyeLink data files and transform them into a MATLAB structure using the EyeLink edf application programming interface (API). For processing Eye Tribe data files (i.e., .txt files resulting from the streamed data of the Eye Tribe interface), Python should be installed. Other output files, such as the files created by PyGaze (Dalmaijer, Mathôt, & Van der Stigchel, 2014) or PsychoPy (Peirce, 2007), can be converted to both .dat and .csv files (see Appendix B). For processing input files in both a .dat and a .csv format, CHAP does not require any additional packages.

Running CHAP

After installing CHAP (see Appendix C for the installation instructions), the user should type chap in MATLAB’s command window or run the main file chap.m from the software directory. Then, in order to process and analyze a new data file, the user should click on the New project button in the main GUI (see Fig. 1). Next the user will be asked to choose a data file, as follows: For EyeLink data, the file extension should be .edf (the standard output file of EyeLink; e.g., sub01.edf); for Eye Tribe data, the file extension should be .txt (the standard output file of Eye Tribe; e.g., sub01.txt); for ASL data, the file extension should be .asl (a .csv file renamed with the .asl extension; e.g., sub01.asl); and for Tobii data, the extension should be .tbi (.csv file renamed with the .tbi extension; e.g., sub01.tbi).

Fig. 1
figure 1

A screenshot of the main GUI of CHAP. This window allows the user to process a new data file (by clicking on New project) or open an existing (already preprocessed) data file (by clicking on Open existing project).

Loading, cleaning, and compressing files

After CHAP loads the data file and converts it to a .mat file, it keeps relevant measures (pupil size and the x- and y-positions of the pupil) and removes irrelevant information saved by the eyetracking system, such as indications of fixations and saccades. After this cleaning, CHAP processes the data (see below) and creates a file with the extension .chp (e.g., sub01.chp). This CHAP file can later be loaded by clicking on the Open existing project button in the main GUI (Fig. 1). This compression of the data, which results in a .chp file that is approximately ten times smaller than the original data file, allows for fast and efficient processing of the data.

Trials, variables, and events

Pupil size is usually recorded in experiments that consist of different trial types. CHAP uses user-defined information to split the data into trials, to analyze different events within a trial (e.g., pupil size during stimulus presentation) or to compare different conditions (which we call variables; e.g., congruent vs. incongruent Stroop stimuli).

To detect trial onset, CHAP uses EyeLink standards. Namely, CHAP looks for logs with a string in the format TRIALID [trial id]. This log is created by EyeLink when Experiment Builder is used for programming the task. In the case of other software (MATLAB, E-Prime), this log should be defined by the user (see Appendix A for examples). For trial offset, CHAP uses logs with a string that is either TRIAL_RESULT 0 (the EyeLink standard format) or TRIAL_END (see Appendix A for examples). In the case in which the user did not send a log that defines a trial’s offset, CHAP will use the onset of the subsequent trial as offset of the current trial.

CHAP also detects user-defined variables and events (up to 64 of each). These variables and events are defined by the researcher when building his/her experiment and should be logged into the data file. Variables should indicate conditions (e.g., congruency in a Stroop task, valance in a study assessing emotional processing), as well as other information about the trial (e.g., block number, accuracy). Events should indicate the relevant factors that occur during a trial (e.g., fixation, stimulus, inter-trial interval).

CHAP recognizes the variables using logs with text strings that appear in the data file, according to EyeLink standards (!V trial_var [variable name] [variable value]). For example, a possible string could be !V trial_var congruency congruent. In this example, the variable name is congruency and the value is congruent. CHAP also supports other types of variable formats by reading an external .csv file created by the user (see Appendix D). This file should include the variables for each trial (i.e., trial IDs, variable names, and variable values). This external file is especially helpful when the values of some of the variables are unknown during data acquisition. This can happen, for example, in a Stroop task in which participants provide a vocal response that is coded to be correct or incorrect only at the end of the experiment. Another example is a memory experiment in which it is unknown during the encoding phase whether the stimulus will be remembered or forgotten. Therefore, CHAP allows the user to add information about trial accuracy or any other relevant information that does not appear in the data file, using an external .csv file. In the case in which the researcher wants to use this option, he/she should create a .csv file for each participant. This .csv file should have the same name as the main data file with the addition of a dedicated suffix _vars (e.g., sub01_vars.csv). This file should be located in the same folder as the main data file.

CHAP recognizes events using logs that consist of the string !E trial_event_var [event name]. For example, a possible string that indicates the appearance of a stimulus could be !E trial_event_var stimulus_onset. In addition, in contrast to the straightforward approach of logging events at the moment they occur, CHAP also supports the following pattern (which is used in EyeLink): [milliseconds before the trial’s ending] [event name]. This means that instead of logging the event’s information following the event’s onset, the user can send the relevant log at the end of the trial. This approach is useful when using third-party software, such as E-Prime. Similar to supporting the addition of external variables, CHAP also supports the addition of external events. By using dedicated .csv files, the user can specify events that were not logged into the data file during recording (see Appendix D). These files should be selected manually by the user during the data file loading.

Data preprocessing

After CHAP reads the data and converts it to a .chp file, pupil data (pupil size in pixels or any other units) is preprocessed. Preprocessing includes:

  1. 1.

    Exclusion of outlier samples (Akdoğan, Balcı, & van Rijn, 2016; Cohen et al., 2015; Wainstein et al., 2017). CHAP converts pupil size data to z score values based on the mean and standard deviation (SD) calculated for each trial separately. Z score values above or below a user-defined threshold, as entered in the Z Outliers text field in the Data Pre-processing GUI (see Fig. 2), will be converted to missing (not a number: NaN) values.

  2. 2.

    Blink correction. CHAP searches for blinks (or any other missing values) in the data and reconstructs the pupil size for each trial from the relevant samples using either linear interpolation (Bradley et al., 2008; Cohen et al., 2015; Siegle et al., 2003; Steinhauer, Condray, & Kasparek, 2000) or cubic-spline interpolationFootnote 1 (Mathôt, 2013; Mathôt et al., 2018; Smallwood et al., 2011; Wainstein et al., 2017). The user can select the interpolation method from a dropdown list that appears in the Data Pre-processing GUI (see Fig. 2). To find blink onset and offset, CHAP uses a novel algorithm that we have recently developed (Hershman, Henik, & Cohen, 2018), which takes into account the change in pupil size between subsequent samples. The user can see the blink correction by choosing the View trials checkbox in the Data Pre-processing GUI (see Fig. 2). Accurate correction of blinks is highly important, because it prevents artifacts in the data (Hershman et al., 2018).

  3. 3.

    Exclusion of outlier trials (Blaser, Eglington, Carter, & Kaldy, 2014; Cohen et al., 2015; Hershman & Henik, 2019; Nyström, Andersson, Holmqvist, & van de Weijer, 2013; Schmidtke, 2014; Wainstein et al., 2017). CHAP removes trials on the basis of a user-defined percentage of missing pupil observations within a trial (Missing values (%) text field in the Data Pre-processing GUI; see Fig. 2). Missing observations occur during blinks, head movements, or inability of the eyetracking system to track the pupil. Trials that contain a high percentage of missing samples should not be used in the analysis (Nyström et al., 2013). We recommend excluding trials with more than 20% missing samples.

  4. 4.

    Exclusion of participants. CHAP excludes participants that do not meet the user-defined criteria for a minimum number of valid trials per conditions (Min. trials text field in the Data Pre-processing GUI; see Fig. 2). If a participant does not reach the user-defined value (e.g., due to low tracking quality the participant has less than ten valid congruent trials), an error message will appear and the participant will not be included in the analysis.

Fig. 2
figure 2

Screenshot of the GUI for data preprocessing. This GUI allows the user to choose parameters for data exclusion, as well as the relevant variables and events. The variable names and their values (as they appear in the data file) are presented in a dedicated table (VARIABLE VALUES).

Selecting variables and events

The Data Pre-processing GUI presents lists of the variables and events that were logged during the experiment (see Fig. 2). The user can choose what variables and events he or she wants to analyze. After selecting the parameters for excluding trials and participants and the desired variables and events, the user should click the Continue button (see the screenshot in Fig. 2). Then, the Condition-selecting GUI will be opened. This GUI allows the user to select the desired conditions (up to seven) from a list. The list includes all the possible combinations, depending on the selected variables (see the example in Fig. 3).

Fig. 3
figure 3

A screenshot of the condition-selecting GUI. This GUI allows the user to select the desired conditions for analysis. In this example, the user chose experimental trials (experiment) with either congruent or incongruent stimuli that were answered correctly.

Time-course visualization

After the user selects the relevant variables and events, CHAP presents data for each selected condition (mean pupil size across all valid trials) and indicates the selected events on a dedicated graph (see Fig. 4). By default, the y-axis represents mean pupil size (with the given units from the data file) as a function of time (in milliseconds). Each curve represents a condition (the selected conditions appear in the legend) and the vertical lines represent the mean onset time of each selected event (as selected in the Data Pre-processing GUI). The title (in this case, 20170625a) represents the participant’s ID, as defined by the name of the file (in this case, 20170625a.txt)

Fig. 4
figure 4

Screenshot of the Advanced Processing Options and Time-Course Visualization GUI. This GUI allows the user to define processing parameters and to view a time-course visualization of the data.

For each of the selected conditions, CHAP presents the number of trials that were used to generate the mean, as well as the number of trials that were defined as outliers and therefore were removed from analysis (see Fig. 4). CHAP also presents the mean onset of the selected events relative to the beginning of the trial, as well as the mean offset of each condition.

Advanced processing options

In addition to basic preprocessing of the data (Fig. 5a), CHAP supports several advanced analysis features (Fig. 5b–g). These features can be selected by the user from the Advanced Processing Options and Time-Course Visualization GUI (see the configuration section in Fig. 4) and are outlined below.

Fig. 5
figure 5

Examples of CHAP’s features: Mean pupil size as a function of time in a two-color Stroop task run on 19 participants (Exp. 1 in Hershman & Henik, 2019). Participants were instructed to respond to the color of a word and to ignore its meaning. The task consisted of congruent and incongruent trials (e.g., congruent, blue; incongruent, red). The red curves represent correct incongruent experimental trials, and the green curves represent correct congruent experimental trials. The vertical lines close to 1,000 ms represent the mean time of the Stroop stimulus onset, and the vertical lines close to 1,500 ms represent the mean participant response. Panels a–g present data for one participant, whereas panel h presents average data across 19 participants. (a) Average pupil size across the different conditions, without using any of the advanced features. (b) Down-sampling the data by using bins of 250 ms. Here, each bin (points on the curves) represents averaging of 15 adjacent samples (since the sampling rate was 60 Hz). (c) Data from stimulus onset to the end of the trial. 0 (on the x-axis) represents the stimulus onset, and the vertical lines close to 500 ms represent the mean participant response times. (d) Aligned data in relative change (subtractive baseline correction, in pixels). (e) Aligned data in normalized relative change (subtractive baseline correction). The data are normalized by using z scores. (f) Normalized relative changes (divisive baseline correction, as a percentage) from 500 ms before Stroop stimulus onset until trial offset. (g) Normalized relative change (divisive baseline correction, as a percentage) from 500 ms before stimulus onset until trial offset. Here the shades around the curves represent one standard error from the mean. (h) Group analysis across 19 participants: Normalized relative change (divisive baseline correction, as a percentage) from 500 ms before stimulus onset until trial offset. The shades around the curves represent one standard error from the mean. For all figures with a baseline correction, the baseline was the average for 200 ms before Stroop stimulus onset.

Bins

Down-sampling (reducing the sampling rate) is performed by averaging adjacent samples of an overall X (user-defined) milliseconds. Specifically, CHAP divides the data into chunks that include samples with a total duration of X ms each. Then, CHAP calculates the average value for each of these bins (see Fig. 5b for an example). The onset of each bin is defined as the time of the first sample (see Fig. 6 for an example). By using this feature, the user can aggregate the data for analysis or for smoothing purposes (Diede & Bugg, 2017; Kang & Wheatley, 2015; Snell, Mathôt, Mirault, & Grainger, 2018). This option could also be useful in the case of comparing data collected using different eyetrackers or different sampling rates (Titz, Scholz, & Sedlmeier, 2018), or to correlate between pupil size and another measure, such as blood-oxygen-level dependent (BOLD) activity (Murphy, O’Connell, O’Sullivan, Robertson, & Balsters, 2014b; Yellin, Berkovich-Ohana, & Malach, 2015).

Fig. 6
figure 6

Schematic example of down-sampling using bins. In this examples, the sampling rate is 1,000 Hz (1 sample every 1 ms), and each bin is 3 ms (three samples, in this case). (a) Pupil data in millimeters for each sample. (b) Chunks of three samples (corresponds to 3-ms bins). (c) Average pupil size for each bin.

Time window

In most psychological experiments, each trial includes several events (e.g., fixation cross, target, intertrial interval). CHAP allows the user to select a specific time window (from one event to another) for analysis (Fig. 5c). When the user uses this feature, the data are aligned to the onset of the first selected event (Kloosterman et al., 2015; Snell et al., 2018; Turi, Burr, & Binda, 2018). This alignment of the data is especially important when the event does not start at a fixed time (e.g., a stimulus appears after 2 s in some trials, and after 2.5 s in other trials). This can happen when stimulus onset is determined by the participant response time (which varies from trial to trial) or when a stimulus appears after a variable inter-stimulus interval (ISI).

Relative change

Instead of using the units recorded by the eyetracker device (e.g., number of pixels, in the case of an EyeLink device), the user can convert the data to a relative change score (Mathôt et al., 2018). The relative change indicates either the difference from baseline (i.e., subtractive baseline correction; Binda & Murray, 2015; Binda, Pereverzeva, & Murray, 2014; Steinhauer, Siegle, Condray, & Pless, 2004), relative = value − baseline (Fig. 5d), or the percent change from baseline (divisive baseline correction; Binda et al., 2014; Kloosterman et al., 2015; Mathôt, van der Linden, Grainger, & Vitu, 2013; Snell et al., 2018): (Fig. 5f).

$$ relativ{\mathrm{e}}_{\%}=100\cdotp \frac{value}{baseline} $$

The baseline is defined by the user as the average X ms prior to onset of the first event (Binda et al., 2014; Mathôt et al., 2013; Snell et al., 2018).

Conversion to Z-scores/millimeters

Most eyetrackers provide pupil data in arbitrary units. These units (or values) are dependent on the eyetracker definitions during recording, the position of the camera, and the distance between the camera and the participant, as well as other parameters, such as the lighting conditions of the room. Normalization of the data (converting the data to comparable values, such as z-score values instead of arbitrary units) makes it possible to analyze and compare participants/experiments whose data were recorded with different conditions.

If the user chooses to convert arbitrary units to z scores (Cohen et al., 2015; Einhäuser et al., 2008; Kang & Wheatley, 2015; Wainstein et al., 2017), CHAP will calculate the z-score values on the basis of the entire time course of the participant (i.e., the mean and SD will be calculated on all valid trials for that participant; Fig. 5e). Alternatively, the user can choose to convert arbitrary units to millimeters (Binda & Murray, 2015; Binda et al., 2014; Blaser et al., 2014; Siegle, Steinhauer, & Thase, 2004) by recording an artificial pupil of fixed size and providing CHAP its millimeter and arbitrary-unit sizes. Pupil size is recorded in either diameter or area measurement, and CHAP recognizes the right measurement after the data are loaded.

CHAP uses the following equations to get the size in millimeters: In the case of diameter,

$$ {pupil}_{diameter}\left[ mm\right]={pupil}_{diameter}\left[ arbitrary\_ units\right]\cdot ratio $$

where ratio is the ratio between the artificial pupil diameter (AP) in millimeters and in pixels, described by

$$ ratio=\frac{A{P}_{diameter}\left[ mm\right]}{A{P}_{diameter}\left[ arbitrary\_\_ units\right]} $$

In the case of area,

$$ {pupil}_{diameter}\left[ mm\right]={pupil}_{diameter}\left[ arbitrary\_ units\right]\cdot ratio $$

where pupildiameter[arbitrary_units] is described by

$$ { pupi l}_{diameter}\left[ arbitrary\_ units\right]=2\sqrt{\frac{pupi{l}_{area}\left[ arbitrary\_ units\right]}{\pi }} $$

and ratio is the ratio between the artificial pupil diameter (AP) in millimeters and in pixels, described by

$$ ratio=\frac{A{P}_{diameter}\left[ mm\right]}{A{P}_{diameter}\left[ arbitrary\_ units\right]}=\frac{A{P}_{diameter}\left[ mm\right]}{2\sqrt{\frac{A{P}_{area}\left[ arbitrary\_ units\right]}{\pi }}} $$

For conversion of the data to millimeters, the user should add a .csv file for each participant, with the same name as the main data file and the addition of the suffix _mm (e.g., sub01_mm.csv). This file should be located in the same folder as the main data file (see Appendix E).

Scattering

The user can add scattering around the mean for each curve. The scattering is either the standard error or the 95% confidence interval (Fig. 5g).

Output files

CHAP saves four types of output files. The presented figure can be saved by the user as a .png (standard image file) or as a .fig (standard MATLAB figure file) by clicking the Save data button in the Advanced Processing Options and Time-Course Visualization GUI (Fig. 4). In addition, the processed data can be saved as a .csv or a MATLAB file that contains all the data concerning the relevant variables and events for each participant (by clicking the Save data button in the Advanced Processing Options and Time-Course Visualization GUI; see Fig. 4).

The .csv and .mat files include average pupil size for each condition across all valid trials (see Appendix F). These data could be used later for analysis by external code/third-party software. Other information that is saved by CHAP includes participant name (as defined by the data file name), trial number, value for each defined variable, and event onset relative to the beginning of the selected time window (see Appendix F). In addition to mean pupil size, CHAP also provides information about the mean pupil size in the first and last bins and the minimum and maximum pupil size values during the selected time window. CHAP also provides information about the number of eye blinks and their durations. This information could be useful in studies that are interested in blinks, such as studies assessing startle response (e.g., Graham, 1975) or blink length and eye-blink rate (Monster, Chan, & O’Connor, 1978), measures known to be correlated with dopamine level (Jongkees & Colzato, 2016; Karson, 1983).

Group analysis

Once users process one data file, they can run the same configuration for multiple data files (e.g., different participants). This option is available in the Advanced Processing Options and Time-Course Visualization GUI (see Fig. 4) by clicking on the Group analysis button. The user should select the folder that contains the data files and choose a name for the analysis. Then, output files will be created for each data file and for the mean of all participants (see Fig. 5h for the means across 19 participants). In addition to these files, CHAP also provides .csv files that include information about the number of trials that were used in the analysis (valid_trials.csv), as well as the number of excluded trials (outliers.csv), for each condition for each participants. Moreover, CHAP provides .csv files that include information about the mean event’s onset for each trial for each participant (time-course_data.csv and trials_data.csv; see Appendixes F & G).

Parameters for statistical analysis

CHAP provides commonly used parameters for analysis, such as the mean (Binda et al., 2014; de Gee, Knapen, & Donner, 2014; Hemmati, 2017; Laeng, Ørbo, Holmlund, & Miozzo, 2011), peak amplitude (Binda & Murray, 2015; Hemmati, 2017; Hess & Polt, 1964; Schmidtke, 2014), peak latency (Hess & Polt, 1964; Koelewijn, de Kluiver, Shinn-Cunningham, Zekveld, & Kramer, 2015; Laeng et al., 2011; Schmidtke, 2014), dip amplitude (Bitsios, Szabadi, & Bradshaw, 2004; Henderson, Bradley, & Lang, 2014; Steinhauer et al., 2000), and dip latency (Lanting, Strijers, Bos, Faes, & Heimans, 1991; Shah, Kurup, Ralay Ranaivo, Mets-Halgrimson, & Mets, 2018; Steinhauer et al., 2000). These parameters can be selected for a specific time window or for the entire trial. By selecting the desired time window (From and To fields in the Statistical Analysis GUI; Fig. 7), these parameters will be calculated on the basis of the data within the selected time window (see the table in Fig. 7).

Fig. 7
figure 7

Screenshot of the Statistical Analysis GUI. Here the user can select the approach for the analysis, define a time window of interest, and see both descriptive and inference results. The figure presents a comparison between congruent and incongruent trials across 19 participants. Both BF10 (blue curve) and BF01 (red curve) are presented as a function of time. The black and green horizontal lines below the curves represent the results of the Bayesian analysis. The black lines represent meaningful differences between conditions, and the green lines represent support for no differences between conditions. The Bayes factor threshold value that CHAP uses (hard-coded) for this analysis is 3 (Jeffreys, 1961). In the present example, there is a meaningful similarity between conditions from – 500 ms to 750 ms, and a meaningful difference between conditions from 1,000 to 2,000 ms.

Statistical analysis

CHAP provides two approaches to statistical analysis. CHAP has the option to run a repeated measures analysis of variance (ANOVA). The output of this analysis includes the F value (including the degrees of freedom), p value, ηp2, and MSE. In addition to the main effect, CHAP will run a series of orthogonal contrasts and will present them in the same table with the F value, p value, and MSE.

In addition to this parametric approach, CHAP also supports a Bayesian approach. Specifically, CHAP can run a Bayesian paired-sample t test with a Cauchy prior width of r = .707 for effect size based on the alternative hypothesis (Rouder, Morey, Speckman, & Province, 2012). In this analysis, the null hypothesis means that there is no difference between the tested conditions. The Bayesian analysis provides a Bayes factor (Kass & Raftery, 1995) for each condition. This Bayes factor quantifies the evidence in favor of the alternative over the null hypothesis. Similar to the output of the parametric analysis, by selecting the Bayesian approach (Statistical approach dropdown in the Statistical Analysis GUI; Fig. 7), CHAP will run and present the output for the Bayesian analysis. The output for each condition includes the t value, BF10 (evidence in favor of the alternative hypothesis), BF01 (evidence in favor of the null hypothesis), Cohen’s d, and the number of observations.

Temporal analysis

CHAP also supports temporal analysis of the data (Binda et al., 2014; Einhäuser et al., 2008; Mathôt et al., 2013; Siegle et al., 2003). By using temporal analysis, the user can investigate the temporal differences between conditions across the time course or in a selected time window.

Similar to the analysis described above, CHAP supports both Bayesian and classical approaches (selected from the Statistical approach dropdown in the Statistical Analysis GUI; see Fig. 7). Specifically, CHAP runs a series of paired-sample t tests between each two conditions over the entire selected time course (Fig. 7), as defined in the Advanced Processing Options and Time-Course Visualization GUI.

The output provided by CHAP (presented in a figure and also saved as a .csv file for each comparison) is either a Holm–Bonferroni-corrected p value as a function of time (by using the classical approach) or Bayes factors (both BF10 and BF01) as a function of time (by using the Bayesian approach). In addition to the descriptive information about the Bayes factor as a function of time (using the Bayesian approach), CHAP also provides inference information about the differences and similarities between conditions.

Discussion

In this article, we have presented CHAP, open-source software written in MATLAB for processing and analyzing pupillometry data. CHAP provides a user-friendly tool for researchers who are interested in preprocessing and analysis of pupillometry data. CHAP supports data coming from a wide range of eyetracker devices and includes, what we believe, the most up-to-date and cutting-edge processing and analysis options. By using well-established approaches, CHAP makes working with pupillometry data easier and provides efficient solutions for preprocessing, analysis, and visualization of the data. Besides that, by introducing CHAP we suggest uniform conventions for the preprocessing and analysis of pupillometry data. CHAP’s user interface makes it an easy-to-implement tool, for both experienced MATLAB users as well as for researchers who do not have any experience with programming. CHAP can be easily installed on Windows, Linux, and Mac operating systems (see Appendix C for instructions), and experienced users can also modify the code if they wish (since the MATLAB script is available after installation).

Several challenges in the analysis of pupil data should be addressed in future work. First, because pupil size is influenced by gaze position (Brisson et al., 2013; Gagl, Hawelka, & Hutzler, 2011), these data should be used to exclude trials with large eye movements or to correct for pupil size. We plan to develop a correction for measurement of pupil changes during eye movements. Such corrections will be incorporated in future CHAP versions. Second, currently CHAP supports only one-way ANOVA and t tests. In the future, we plan to add more options for data analyses. In addition, CHAP currently supports only a within-group analysis. We plan to add options for the analysis of between-group effects. Finally, we plan to create a Python version of CHAP so that it can be used by users who do not have MATLAB.

To summarize, this article has presented CHAP, a tool for processing and analyzing pupillometry data. CHAP is already being used by several groups, and it is our hope that more researchers will use it. To download CHAP or join our mailing list, please visit CHAP’s website: http://in.bgu.ac.il/en/Labs/CNL/chap.

Author note

This work was supported by funding from the European Research Council under the European Union’s Seventh Framework Programme (FP7/2007–2013)/ERC Grant Agreement no. 295644. We thank Desiree Meloul for helpful comments and useful input on this article. We also thank Yoav Kessler and Joseph Tzelgov for their advice regarding statistical analysis, and Stuart Steinhauer for his helpful input on pupil parameters. In addition, we thank Sam Hutton for his help with the adaptation of CHAP to EyeLink data, Reem Mulla for her help with the adaptation of CHAP to ASL data, Leah Fostick for her help with the adaptation of CHAP to Tobii data, and Nicole Amichetti for her help with the adaptation of CHAP for Mac users. Finally, we thank all present CHAP users for their helpful feedback and advice, especially Dina Devyatko and Dalit Milshtein, who also provided feedback on this article.