Presentation is loading. Please wait.

Presentation is loading. Please wait.

Eye tracking experiments August 29th, 2014 Daniel Schreij VU Cognitive Psychology departement

Similar presentations


Presentation on theme: "Eye tracking experiments August 29th, 2014 Daniel Schreij VU Cognitive Psychology departement"— Presentation transcript:

1 Eye tracking experiments August 29th, 2014 Daniel Schreij VU Cognitive Psychology departement

2 Today Creating eye tracking experiments using OpenSesame and PyGaze Get from EDF (Eyelink Data Format) to other more easily usable data formats Analyze data with Pandas and Python

3 PyGaze Download from Standalone Python module to communicate with any Eyetracker, with a unified interface (so the code for each eye tracker is the same) Has OpenSesame plug-in

4 Pygaze | Items Initialize Eyetracker (connection & calibration) Drift correct Log message(s) Start recording Stop recording Pause recording

5 PyGaze | Typical experiment Calibrate Per trial/block – Drift correct Per trial – Start recording – Log variables – Stop recording Basic steps

6 PyGaze | Another way Start recording at beginning of experiment and stop at the end Drift correct is done afterwards Preferable for pupil dilation data, or similar experiments that require a constant dat stream (even in between trials)

7 PyGaze | Initialize

8 PyGaze | Logging messages

9 Data files After you have run your experiment you often get data files in proprietary formats (.EDF) Developers like you to use their tools... You can then either – Use proprietary tools to look at data – export them to a textual format Working with the data in textual format enables you to use your own tool chain such as Python and all its modules

10 Data Files | EDF Eyelink data format You can import them to Eyelink Data viewer and then create reports – Saccade, fixation, etc. You can use the tool EDF2ASC to convert the EDF file to an ASCII format and then parse it yourself (or with available scripts https://github.com/tknapen/analysis_tools/ ) https://github.com/tknapen/analysis_tools/

11 Data Files | EDF2ASC MSG TRIALID T1Rg START LEFT RIGHT EVENTS PRESCALER 1 VPRESCALER 1 EVENTS GAZE LEFT RIGHT SFIX L SFIX R MSG SYNCTIME MSG DRAWN NEW TARGET EFIX L EFIX R SSACC L SSACC R ESACC R SFIX R ESACC L MSG ERASED OLD TARGET SFIX L EFIX R SSACC R EFIX L SSACC L ESACC L ESACC R

12 Eyelink Data Viewer

13 Eyelink Data Viewer | Fixations

14 Eyelink Data Viewer | Saccades

15 Eyelink Data Viewer | Samples

16 Eyelink Data Viewer | Heatmap

17 EDF | Saving variables During the experiment, you can send trial variables to the Eyelink to be stored in the EDF file If you use the appropriate syntax, the EDV will recognize them as variables (and not as random messages) These variables can be included in reports which you subject to your analysis scripts later ALWAYS SAVE AS MUCH OPENSESAME VARIABLE DATA AS POSSIBLE TO THE EDF FILE

18 EDF | Variable syntax !V TRIAL_VAR In OpenSesame, send this with send_command() in script exp.eyetracker.send_command("!V TRIAL_VAR RespTime 350") Alternatively, you can use the pygaze_log item

19 Example experiment

20 Example Experiment | log variables Setting background image: !V IMGLOAD FILL

21 Eyelink Data Viewer | Variables

22

23 Eyelink Data Viewer | Interest Periods Example OpenSesame script for showing stimuli self.fix_canvas.show() self.sleep(1000) exp.eyetracker.send_command("SHOWING target display") self.target_canvas.show() Right before target display is shown, Eyelink receives the message "SHOWING target display"

24 Eyelink Data Viewer | Interest Periods

25

26 Full trial period From Target presentation

27 Eyelink Data Viewer | Interest Areas Just like variables, you can send commands during your experiment to define interest areas in your display area It is also possible to draw these interest areas after all data has been collected (but this is much more work)

28 Eyelink Data Viewer | Interest Areas Basic syntax !V IAREA [label] For a rectangle !V IAREA RECTANGLE cue For a circle !V IAREA ELLIPSE target For a custom shaped polygon !V IAREA FREEHAND... [label]

29 Eyelink Data Viewer | Interest Areas

30

31 Eyelink Data Viewer | Reports EDV has options to export EDF data to other tabular formats as csv or Excel You can create reports containing lists of – Saccades – Fixations – Interest areas – Samples – Trials

32 Eyelink Data Viewer | Reports

33

34 Reports | Analysis You can use your favorite software to read in and start analyzing these report files – Excel, MatLab, R, SPSS, Pandas, etc. For pandas raw_data = pd.read_csv("SaccadeReport.csv")

35 Analysis example try: raw_data except: raw_data = pd.read_csv("ExampleData.csv",sep=";") # Drop empty columns (don't know why these are there....) raw_data = raw_data.drop(raw_data.columns[-10:],axis=1) # Filter data to only contain real and correct trials work_data = raw_data.query("TRIAL_INDEX > 96 and correct==1") # Only get first saccades criteria = "CURRENT_SAC_INDEX == 1 and " criteria += "CURRENT_SAC_NEAREST_END_INTEREST_AREA_LABEL != '.'" first_saccades = work_data.query(criteria) # Create pivot table cols = ["onset","CURRENT_SAC_NEAREST_END_INTEREST_AREA_LABEL"] fs_pt = first_saccades.pivot_table("rt",index="cue", columns=cols, aggfunc="count") # Plot data (fs_pt/fs_pt.sum().sum()).plot(kind="bar")

36 Analysis example

37 # RT pivot table cols = ["onset","CURRENT_SAC_NEAREST_END_INTEREST_AREA_LABEL"] fs_pt = first_saccades.pivot_table("rt",index="cue", columns=cols,aggfunc="mean") fs_pt.plot(xlim=[-0.5,1.5],ylim=[650,1000],style="o-")


Download ppt "Eye tracking experiments August 29th, 2014 Daniel Schreij VU Cognitive Psychology departement"

Similar presentations


Ads by Google