Howdy, Stranger!

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

Supported by

[solved] Pupil size obtention

edited March 2015 in PyGaze


I want to obtain the pupil size of my subject, and to do this I have made the following modifications to, in the flushData(self) function :

  • addition of 'L.PupilSize' and 'R.PupilSize' in self.datafile.write('\t'.join(['TimeStamp',
  • addition of g.LeftPupil ande g.RightPupil in self.datafile.write('%.1f\t%.4f\t%.4f\t%d\t%.4f\t%.4f\t%d\t%d\t%d'%(

The function now looks like :


        # time of the first event
        timeStampStart = self.gazeData[0].Timestamp

        # loop through all data points
        for g in self.gazeData:

            # write timestamp and gaze position for both eyes to the datafile
                                g.LeftGazePoint2D.x*self.disp.dispsize[0] if g.LeftValidity!=4 else -1.0,
                                g.LeftGazePoint2D.y*self.disp.dispsize[1] if g.LeftValidity!=4 else -1.0,
                                g.RightGazePoint2D.x*self.disp.dispsize[0] if g.RightValidity!=4 else -1.0,
                                g.RightGazePoint2D.y*self.disp.dispsize[1] if g.RightValidity!=4 else -1.0,

My problem is that in the output file colums of R.PupilSize and L.PupilSize I have only '3' or '4' when the sample is valid, -1 if not.
What is my mistake ? Why don't I obtain a pupil size ?

Thanks for any help !


  • edited 8:21PM

    I finally found the error...

    t%d was just not the good way to treat the value as a decimal, I replace it by t%.4f and it works fine.

    '3' and '4' were just the whole part of the pupil size.

    Sorry for the useless question.

  • edited 8:21PM


    Indeed, %d is for integers, and will effectively round floats down.

    Btw, if you feel that this a wortwhile addition to PyGaze that other people might benefit from as well, you could consider sending Edwin a pull request with the changes through GitHub. The repository is here:


    Buy Me A Coffee

  • edited 8:21PM

    This is brilliant, thanks for adding this clearly important feature I neglected!

  • Hi @Edwin , I was wondering if this feature is included in the latest version of PyGaze. I also found it'd be very helpful to record pupillary data. I believe that in my current version, pupil size is included for the eye tribe tracker output but not for tobii ouput.


  • edited September 2018

    Hi @hanzh,

    Yes, it should be possible! What Tobii back-end are you using? Are you using tobii or tobii-legacy in the latest version of PyGaze, or perhaps using an older version that only has tobii (which is the current tobii-legacy)?

    Edit: I just checked, and the functionality above was never pull-requested into the tobii-legacy back-end. It should be supported by the tobii back-end, I believe, which is based on the new Tobii Pro SDK. If you're using the Tobii legacy back-end, I would be very happy to implement the pupil size solution mentioned above.


  • Hi @Edwin,

    I am using an older version of PyGaze where we only have the tobii backend because we run a Tobii T60. I think it's time for me to update the package, but it would be really nice to add pupillary measures to it!


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