Howdy, Stranger!

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

Supported by

[open] Merging Pygaze with other experimental library.

rrrrrr
edited September 2015 in PyGaze

Hello,

The questions is about how can I merge Pygaze with other experimental library (http://www.expyriment.org/).

To measure eye movements, I try to add pygaze to my script which I have been using in experiment by python.
Is it possible just by adding some triger (stimulus onsets/offsets, keypress events) to my script for data analysis?
If so, do you have any examples or suggestions (which pygaze functions I should use)?

Best,

Comments

  • rrrrrr
    edited 7:53PM

    Hello,

    This is additional information.

    1. libscreen

    In Pygaze, the libscreen library is used to control the experiment display and stumuli.
    But, like in my case, which libraries should I use to control it, Pygaze (libscreen) or other experimental library?

    1. Value error

    When I tried to take Pygaze 'calibrate()' in my script, 'ValueError: Projection failed!' occurred.

    Best,

  • edited September 2015

    Hi,

    I'm not sure whether I understand what you mean with "merging Pygaze with expyriment". Would you mind explaining what exactly is your idea?

    Is it possible just by adding some trigger

    I think something like exp.pygaze_eyetracker.log("!V TRIAL_VAR <var_name> %s" % <value>) should do the trick. Doing it in this way, will create a variable with corresponding value in the logfile of your tracker that. If you just want to send a message, this will suffice:

    exp.pygaze_eyetracker.log("message")

    (At least that is what I do, when I use the eyelink eyetracker. I'm not sure whether it will work for any tracker.)

    Best,

    Eduard

    Buy Me A Coffee

  • rrrrrr
    edited 7:53PM

    Hello,

    1.
    What I mean is how send triggers and keep records (time, trialID, condition name, stimulus onsets/offsets, keypress, RT...) on edf files for data analysis using the Data Viewer.
    I already made python scripts for experiments, and try to add Pygaze to it.

    Is it sufficient to do it by exp.pygaze_eyetracker.log functions?

    2.
    When I tried to use Pygaze 'calibrate()' in my script, 'ValueError: Projection failed!' occurred. Do you have any ideas for this error?

    Best,

  • edited 7:53PM

    Hi,

    1) Yes, exp.pygaze_eyetracker.log() should be sufficient for that, but keep in mind that it generally only sends a message. If you want to have those variables in the data viewer and interact with them, you'll have to send them as a variable (the first I described above).

    2) Sorry, unfortunately, I don't know what this error is about.

    Eduard

    Buy Me A Coffee

  • edited 7:53PM

    Hi there,

    So, first things first: PyGaze is essentially an experimental library, so you could use it to run your experiments with, not unlike expyriment. If you prefer sticking with expyriment (probably the most time-effective thing here, considering you already have a script), we might need to do a bit of hacking here and there.

    There are two main options:

    1) You write your own back-end based on expyriment, and use this to get a handle to the active expyriment window. Then the rest of your script should run fine. Note that this is the most time-consuming solution, as it requires you to create your own Display implementation (and likely also others, such as Screen and Keyboard).

    2) You use the currently existing tools, and hack your way to the PyGame active Surface handle within expyriment:

    import pygaze
    from pygaze import EyeTracker
    from expyriment import control
    
    # EXAMPLE initialisation of expyriment
    exp = control.initialize()
    
    # get the active PyGame Surface
    window = exp.screen._surface
    
    # define a custom Display class
    # the parent is the actual Display class,
    # but we're going to overwrite the initialisation function
    class Display(pygaze.display):
    
        def __init__(self, pygamewindow):
    
            # use the passed handle to the active surface
            pygaze.expdisplay = window
            self.dispsize = window.get_size()
            self.fgc = (0, 0, 0)
            self.bgc = (128, 128, 128)
            self.mousevis = False
    
    # now initialise a dummy Display,
    # and pass the active PyGame window
    disp = Display(window)
    
    # and initialise an EyeTracker object
    tracker = EyeTracker(disp)
    
    # REST OF YOUR SCRIPT
    

    Now I can't promise this will work, but it should in theory. That is: as far as I understand the logic behind expyriment.

    On your other question: You can simply use tracker.log("example message") to log things to the EDF.

    Good luck!

  • rrrrrr
    edited 7:53PM

    Hello,

    This script causes an error,

    class Display(pygaze.display):
    TypeError: Error when calling the metaclass bases
    module.init() takes at most 2 arguments (3 given)

    What should I do?

    Best,

  • rrrrrr
    edited 7:53PM

    Hello,

    When I added just eyetracker.log to the onset/offset for triggers (no hacking of display as Edwin above), the error occurred below.

    Traceback (most recent call last):
    File "/Users〜/test.py", line 56, in
    eyetracker.log("start_trial %d" % trialnr)
    AttributeError: 'module' object has no attribute 'log'

    Should I add other modules or functions, except for tracker.start and end, logfile write and close, eyetracker.log (e.g., "trial %d" % trialnr)?

    Best,

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 http://45.77.173.118/ 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