Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

pylink detection saccades online


I am designing an experiment in which I want to make sure people are fixating and not making large saccades when a peripheral cue is presented. I initially thought to do this by getting the gaze position, however I would like it more if I could check online whether participants performed a saccade larger than 1 visual angle. To ensure both fixation and the absence of large saccades, I wrote this function

def showDisplaySampleGaze(showPlaceholders=False, showCue=False, showFixDots=False,

showAdapters=False, showTarget=False, showMasks=False, duration=None):

max_gaze_deviation = angle2pix(1)

failed_fix = 0

timeZero = core.getTime()


while core.getTime()-timeZero < (duration/1000): # duration specified in the function

# draw stimuli
if showAdapters:

for ad in adapters:


if showCue:

for cu in cues:


elif showPlaceholders:

for ph in placeholders:


if showFixDots:

for fd in fixdots:


if showTarget:


if showMasks:

for mk in masks:


# get eye data
eye_ev = pylink.getEYELINK().getNextData()

# if a saccade is detected then get its amplitude, start position and end position

if eye_ev == pylink.ENDSACC:

eye_dat = pylink.getEYELINK().getFloatData()

sac_amp = eye_dat.getAmplitude()

sac_start_pos = eye_dat.getStartGaze() # start position

sac_end_pos = eye_dat.getEndGaze() # end position

dis_start = np.sqrt(sac_start_pos[0]**2+sac_start_pos[1]**2)

dis_end = np.sqrt(sac_end_pos[0]**2+sac_end_pos[1]**2)

if sac_amp > max_gaze_deviation and dis_start<max_gaze_deviation and dis_end<max_gaze_deviation:


c = visual.GratingStim(win, tex=None, mask='circle',pos=(0,0), color='blue', size=fdSize)



elif sac_amp < max_gaze_deviation and (dis_start>max_gaze_deviation or dis_end>max_gaze_deviation):


c = visual.GratingStim(win, tex=None, mask='circle',pos=(0,0), color='blue', size=fdSize)



elif sac_amp <= max_gaze_deviation and dis_start<max_gaze_deviation and dis_end<max_gaze_deviation:





if sum(blue)!=0:

failed_fix = 1

edf_var('failed_fixation', failed_fix)

return failed_fix  

The problem is that pylink.getEYELINK().getNextData() returns a number and not an event type. How can I see whether the detected event is a saccade? Is there something wrong in the way I am thinking about this?

The while loop is presented every time a new stimulus is drawn and the stimuli might last on the screen for just 31ms. Does the function pylink.getEYELINK().getNextData() consider also the eye data collected before the while loop? That is, if a participant starts a saccade 80ms before, can I see it ending even if my while loop started 30ms ago? It is a bit convoluted, but I hope the explanation is clear. Many thanks for any help you might provide!


  • PS for some reason the indentations are messed up in the code that I pasted

  • Hi @SINE,

    Why do you want a saccade detection and not just a fixation check? Latter is much easier to implement. From personal experience, a few years ago, I also implemented a saccade detector and even though it worked in the end, the process was not nice, and the result was not the most robust algorithm. So, my advice would be to stick with checking the gaze position if you don't necessarily need saccades for some reason.

    In terms of your code, I can't help unfortunately, because I don't have experience with using pylink directly. I interacted with the eyetracker via pygaze (which is a higher-level wrapper around pylink for eyelink eyetrackers). If you are interested you can check out my algorithm (in helper_functions the wait_for functions. Perhaps that helps.

    Good luck!


    Buy Me A Coffee

  • Hi @eduard,

    thanks for the code, it looks very helpful! I was wondering whether you would know where I can find info about the pylink functions? I have been looking for a github repository or code on SRresearch, but I can't fine them.

    Thanks again!

  • Hi Sine,

    The SRResearch forum would be the place, they create the library. I am not sure whether there is a proper documentation anywhere, but the developers will be able to help you if you ask your questions there.

    Good luck!


    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games