Chapter 5 Preparing scripts for analysis and visualization in Data Viewer 90
Trial segmentation 91
Trial variables 93
Interest Areas 95
Background graphics 97
Size of the screen 97
Image 97
Video 98
Simple drawing 99
Draw list file 101
Target position 102
Examples in PsychoPy 102
The Stroop task 102
Custom graphics for calibration 106
The DISPLAY_COORDS message 107
The TRIALID and TRIAL_RESULT messages 107
Record status message 107
Background graphics: the IMGLOAD message 107
Trial variables messages 107
Messages marking critical trial events 108
Video playback 108
Pursuit task 113
Chapter 6 Retrieving gaze data over the link 119
Samples and events 119
Retrieving sample data 121
3
Commands for sample retrieval 121
Example in PsychoPy: Gaze-contingent window 124
Retrieving eye events 127
Commands for event retrieval 127
Example in PsychoPy: Fixation trigger 133
Recording playback 136
Chapter 7 Advanced Pylink Functions 141
Drawing to the Host PC 141
Option 1: Using the draw commands 141
Option 2: Sending images to the Host 142
Option 3: The bitmapBackdrop command 143
Send TTL via the Host PC 145
Broadcasting 148
Calibration and custom CoreGraphics 151
Chapter 8 Data analysis and visualization in Python 163
EyeLink EDF data file 163
Samples 163
Events 164
Other useful information in the EDF data file 165
EDF2ASC Converter 166
Extract data from the ASC files 169
Parse the ASC file with the string function split() 169
Parse ASC files with regular expressions 174
Data visualization 176
Gaze trace plots 177
Heat maps 180
Scan path 183
Interest area-based visualization 183
Chapter 9 Miscellaneous 185
Predefined constants in Pylink 185
Frequently used EyeLink Host commands 185
References 187
Dr. Zhiguo Wang is a research professor at Zhejiang University. He received his Ph.D. from the Graduate University of Chinese Academy of Sciences and had his post-doctoral training at Vrije Universiteit (the Netherlands) and Macquarie University (Australia). He was a senior scientist at SR Research Ltd. (Canada) before joining the Center for Psychological Sciences at Zhejiang University.
Dr. Zhiguo Wang was a recipient of the prestigious Australian Research Council Discovery Early Career Researcher Award. His current research work focuses on issues in engineering psychology, but he is also interested in research topics in vision, eye movements, visual working memory, spatial attention, and developmental disorders
Several Python programming books feature tools designed for experimental psychologists. What sets this book apart is its focus on eye-tracking.
Eye-tracking is a widely used research technique in psychology and neuroscience labs. Research grade eye-trackers are typically faster, more accurate, and of course, more expensive than the ones seen in consumer goods or usability labs. Not surprisingly, a successful eye-tracking study usually requires sophisticated computer programming. Easy syntax and flexibility make Python a perfect choice for this task, especially for psychology researchers with little or no computer programming experience.
This book offers detailed coverage of the Pylink library, a Python interface for the gold standard EyeLink ® eye-trackers, with many step-by-step example scripts. This book is a useful reference for eye-tracking researchers, but you can also use it as a textbook for graduate-level programming courses.