Giter Site home page Giter Site logo

esdalmaijer / pygaze Goto Github PK

View Code? Open in Web Editor NEW
669.0 49.0 210.0 5.12 MB

an open-source, cross-platform toolbox for minimal-effort programming of eye tracking experiments

Home Page: www.pygaze.org

License: GNU General Public License v3.0

Python 100.00%

pygaze's Introduction

PyGaze - the open-source toolbox for eye tracking

Copyright 2013 - 2022, Edwin Dalmaijer, Sebastiaan Mathôt, and contributors

For more information, see: https://www.pygaze.org/contributors

Citation

  • Dalmaijer, E.S., Mathôt, S., & Van der Stigchel, S. (2013). PyGaze: an open-source, cross-platform toolbox for minimal-effort programming of eye tracking experiments. Behaviour Research Methods. doi:10.3758/s13428-013-0422-2

Documentation

Installation

pip install python-pygaze

License

PyGaze is open source software and therefore free to use and modify at will. Warranty, however, is NOT given. If this software fails, causes your computer to blow up, your spouse to leave you, your toilet to clog and/or the entire supply of nuclear missles on earth to launch, or anything else that you might want to blame on us, the author(s) CANNOT IN ANY WAY be held responsible.

PyGaze was released under the GNU Public License (version 3), of which you should have received a copy of together with the software:

PyGaze is a Python package for easily creating gaze contingent experiments
or other software (as well as non-gaze contingent experiments/software)
Copyright (C) 2012-2020 Edwin S. Dalmaijer

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>

I hope PyGaze proves to be helpful to you!

pygaze's People

Contributors

brixius avatar cherepaha avatar ddetommaso avatar dschreij avatar esdalmaijer avatar faibk avatar grebdems avatar jdenhartog avatar kumortas avatar lparth avatar onesandzeroes avatar pedrotari7 avatar scattenlaeufer avatar smathot avatar teonbrooks avatar warren-park avatar wkruijne avatar zouharvi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pygaze's Issues

PyGaze crashes in OpenSesame during EyeTribe calibration

Hello,

We are encountering an error on the OpenSesame PyGaze template, during the calibration phase. The first calibration point is presented for about 1500ms, and then the experiment exits with a KeyError exception.

Unexpected error

item-stack: experiment[run].pygaze_init[run]
exception message: 'values'
time: Wed Jun 22 14:08:56 2016
exception type: KeyError

Traceback:
  File "dist\libqtopensesame\misc\process.py", line 140, in run
  File "dist\libopensesame\experiment.py", line 397, in run
  File "dist\libopensesame\item_store.py", line 95, in execute
  File "dist\libopensesame\item_store.py", line 110, in run
  File "dist\libopensesame\sequence.py", line 50, in run
  File "dist\libopensesame\item_store.py", line 110, in run
  File "C:\Program Files (x86)\OpenSesame\plugins\pygaze_init\pygaze_init.py", line 212, in run
  File "C:\Program Files (x86)\OpenSesame\pygaze\_eyetracker\libeyetribe.py", line 208, in calibrate
  File "C:\Program Files (x86)\OpenSesame\pygaze\_eyetracker\pytribe.py", line 1411, in pointend
KeyError: 'values'

We're using these versions:

  • OpenSesame 3.0.7
  • Python 2.7.10
  • Windows 7 Enterprise, Service Pack 1
  • EyeTribe SDK 0.9.77
  • PyGaze 0.6.0a10, the most recent Git commit

Psychopy visual.Circle fillcolor changes background color of screen object

Dear dr Dalmaijer,

Thank you for developing this software package!

While learning to work with PyGaze I noticed that setting fillcolor of visual.Circle changes the background color to the same color as the fillcolor of the circle object. I worked around it, but thought that it would be best to notify you. (I am using your WinPython-PyGaze-0.4 module.)

Regards,
Hanne Huygelier

Installer issue: installed in python3.4 package folder and not python 2.7. from Cogsci PPA

Hey there,

Sorry, I had no idea where else to report this...

Today I have tried to update my pygaze because the plugin version I was using did no longer work in Opensame 3.0 . However, both running sudo apt-get install python-pygaze, OR running sudo ./setup.py install manually did not properly update my package.

After some digging around I found out that both were installing the package in my /usr/local/lib/python3.4/dist-packages/pygaze/, thereby making it invisible to python 2.7 (and thereby invisible to opensesame and others). I could fix it by running python setup.py install instead, but perhaps the installer could/should be updated to assert both python dist's have the proper version running?

Thanks,
W

PsychoPyDisplay instance has no attribute 'expdisplay'

Dear Edwin,

I had the same problem as posted on this blog: http://forum.cogsci.nl/index.php?p=/discussion/2124/solved-cant-create-gabor/p1 .

However, the solution you posted there does not solve the problem (I also did not really understand the solution, since it was not integrated in a larger part of the code). With the code beneath I get the following error message: AttributeError: PsychoPyDisplay instance has no attribute 'units'.

This is a snippet of my code:

    # Create window: pygaze works by default with pixels
    disp = Display(disptype = 'psychopy', screennr = 0, bgc = "grey") 
    win = pygaze.expdisplay

    fixation = TextStim(win = disp, text = "+", pos = [0,0], color = "white", height = monitorunittools.deg2pix(1.0, mon, correctFlat = False))

    instruction = ImageStim(win = disp, image = instr + instr_files[0], interpolate = True) 

import sys in libwebcam.py

Hello,

I just want to point out that I needed to add:

import sys

in PyGaze/additional_libraries/libwebcam.py

on Ubuntu 16.04.1 LTS, with Python 2.7

Best regards,
Camelia

Setting screen background color doesn't work as expected with PsychoPy

I tried to create an alternating black and white background by alternately showing screens white and black:

black = libscreen.Screen(bgc=(0,0,0))
white = libscreen.Screen(bgc=(255,255,255))

This works with PyGame. However, with PsychoPy the background just stays gray. I ran into a similar issue with OpenSesame, and solved it by drawing a big rectangle for non-standard backgrounds, see https://github.com/smathot/OpenSesame/blob/master/openexp/_canvas/psycho.py#L137 (But let me know if you find a better way.)

Eye image not shown in Eyelink calibration screen

pygaze commit afef6d9
Windows 7; Opensesame 2.8.3
tested on EyeLink CL (1000) and Eyelink 2000

When you are in the calibration menu of the EyeLink and select to see the eye image by pressing the key, you are presented with a black screen.The calibration and such works, so the eyelink can detect and record the eye and thus there seems to be no problem with the connection. This did work with previous versions of pygaze, so did something go wrong upstream maybe?

Fix documentation

website

  1. Save documentation for PyGaze 0.4 and make it downloadable on website.
  2. Update all online documentation to PyGaze 0.5 (and make it downloadable on website)
  3. Make Tutorial,

source

  1. Fix documentation for _eyetracker and _screen: remove docstring, and replace by see _baseclass.BaseClass
  2. Fix docstrings of all pygaze.[module] and pygaze.[module].init to have it say something relevant (e.g. from BaseClass), instead of the Mouse reference as it is now (artefact from copy-pasting source).

timecourse

Most likely after New Year's.

tobii data output calculates average gaze position incorrectly

I'm helping out someone who's trying to run a simple eyetracking experiment using Pygaze with a Tobii TX300. They were a bit confused by the data their experiment produced, since the GazePointX and GazePointY values recorded were often outside the 0.0-1.0 range that the tracker should produce (not sure if this is common across all makes of tracker but Tobii records coordinates in a 0.0-1.0 range where (0.0, 0.0) represents the top-left and (1.0, 1.0) the bottom right).

Examining the libtobii source code, it seems that someone already noticed an issue with how these values were calculated and recorded it as a comment, but wasn't sure enough to apply the fix. Currently when there are valid samples from both eyes, GazePointX and GazePointY are calculated as:

# if we have both samples, use both samples
else:
    # shouldn't these additions be divided by 2?
    ave = (g.LeftGazePoint2D.x+g.RightGazePoint2D.x,
           g.LeftGazePoint2D.y+g.RightGazePoint2D.y)

but I agree with the comment that they should instead be:

# if we have both samples, use both samples
else:
    ave = ((g.LeftGazePoint2D.x + g.RightGazePoint2D.x) / 2.0,
           (g.LeftGazePoint2D.y + g.RightGazePoint2D.y) / 2.0)

this makes the data from the current experiment look much more sensible. I've included a very small sample of (uncorrected) data, note the difference between samples with both eyes valid and the initial samples with only one eye valid

TimeStamp  GazePointXLeft      GazePointYLeft ValidityLeft    GazePointXRight     GazePointYRight ValidityRight GazePointX GazePointY 
      108.3              -1                -1          4           911.6937             613.3255             0     0.4748     0.5679
      116.6              -1                -1          4           942.5177              568.297             0     0.4909     0.5262
        125        990.9151          520.1005          0           922.5432             520.3522             0     0.9966     0.9634
      133.4        968.9799          526.1385          0           934.8946             459.9867             0     0.9916     0.9131
      141.7          977.76          479.3348          0           942.9805             418.0528             0     1.0004     0.8309
      149.9        999.6558          418.1523          0           960.1643             380.9476             0     1.0207     0.7399
      158.3       1001.4722          403.9405          0           946.8408             408.0108             0     1.0147     0.7518
      166.7          996.08           414.319          0           951.7222             412.8808             0     1.0145     0.7659

Calibration function EyeTribe error after two calibration attempts

When I use the tracker.calibrate() function it runs correctly for the first two calibration attempts, but if calibration has still failed after these two first attempts and you ask to restart the calibration, the following error comes up:

tracker.calibrate()
File "C:\Python27\lib\site-packages\pygaze_eyetracker\libeyetribe.py", line 195, in calibrate
self.eyetribe.calibration.start(pointcount=len(calibpoints))
File "C:\Python27\lib\site-packages\pygaze_eyetracker\pytribe.py", line 1128, in start
{'pointcount':pointcount})
File "C:\Python27\lib\site-packages\pygaze_eyetracker\pytribe.py", line 391, in request
success = self.get_response()
File "C:\Python27\lib\site-packages\pygaze_eyetracker\pytribe.py", line 435, in get_response
self.resplist.append(self.parse_json(r))
File "C:\Python27\lib\site-packages\pygaze_eyetracker\pytribe.py", line 545, in parse_json
parsed = json.loads(jsonmsg)
File "C:\Python27\lib\json__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 381, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting object: line 1 column 311 (char 310)

wait_for_fixation_start() for Tobii tracker doesn't return the right time

If I understand the code correctly, wait_for_fixation_start() for Tobii tracker doesn't return the time the fixation started, but the time the fixation was detected. Those times have a difference of at least self.fixtimetresh.

Since I am not sure whether this is a wanted behaviour, I didn't just fix it and create a pull request, but reported this as an issue to check whether it is really an issue.

Libscreen docs update needed

In the example of using PsychoPy stimulus here, disp.expdisplay should probably be replaced by pygaze.expdisplay. The former was working in v0.4, but not anymore.

Advanced dummy mode's drift correct fixation is off in xpyriment and fullscreen

When running the advanced dummy mode with the xpyriment back-end, the fixation dot that is used to simulate the drift correct doesn't correspond to the expected mouse position. So, when hovering with the mouse over the fixation dot, nothing happens. However, after I moved it somewhat to the left of the dot (maybe 100 px) the fixation was accepted. This happens only in fullscreen and regardless of where exactly the fixation dot is drawn.
Switching to PsychoPy back-end did solve it, though.

Here is a minimal example of the issue

drift_correction in dummymode error

When using the drift_correction in dummy mode and with disptype set to Psychopy, I get the following error messages:

  1. FGC was not defined --> fixed this by importing the defaults into the script libdummytracker.py.

  2. After that I get this error message:
    tracker.drift_correction(fix_triggered = False)
    File "C:\Python27\lib\site-packages\pygaze_eyetracker\libdummytracker.py", line 104, in drift_correction
    self.draw_drift_correction_target(pos[0], pos[1])
    File "C:\Python27\lib\site-packages\pygaze_eyetracker\libdummytracker.py", line 404, in draw_drift_correction_target
    self.display.fill(self.screen)
    AttributeError: 'Window' object has no attribute 'fill'

I guess the .display.fill should be called on a display object and not a window object, but I'm not sure how to fix this the best way. Am I perhaps calling the drift_correction with the wrong arguments?

Calibration module does not work using eyetribe

Dear Edwin,

I'm trying to work with teh eyetribe and pygaze. Mainly it's calibration mode.
When running the current code:

from pygaze import libscreen
from pygaze.libscreen import Display
from pygaze import eyetracker
#import pygaze       
import scipy 

display = libscreen.Display()
eyetracker = `eyetracker.EyeTracker(display)
#eyetracker.TRACKERTYPE = "eyetribe"
eyetracker.calibrate()

Once, what appears to be the calibration module, I'm asked to return a space, a q or a s. None of the entries seem to work. I don't get an error, only the warnings. Any idea what I should do differently?

In [1]: runfile('C:/Python27/Lib/site-packages/xy/temp13.py', wdir='C:/Python27/Lib/site-packages/xy')
C:\Python27\lib\site-packages\psychopy\visual\helpers.py:176: FutureWarning: comparison to None will result in an elementwise object comparison in the future.
if color==None:
C:\Python27\lib\site-packages\psychopy\visual\basevisual.py:943: FutureWarning: comparison to None will result in an elementwise object comparison in the future.
if value == None:

In [1]: runfile('C:/Python27/Lib/site-packages/xy/temp13.py', wdir='C:/Python27/Lib/site-packages/xy')
C:\Python27\lib\site-packages\psychopy\visual\helpers.py:176: FutureWarning: comparison to None will result in an elementwise object comparison in the future.
if color==None:
C:\Python27\lib\site-packages\psychopy\visual\basevisual.py:943: FutureWarning: comparison to None will result in an elementwise object comparison in the future.
if value == None:

Kind regards,
Jan Koopman

Documentation error

Hey there,

for libinput.Keyboard.get_key() it says in the documentation that the default value is 'None'. This seems not to be correct, it seems to be set to 0.

Cheers,

Arne

TobiiTracker doesn't use SACCVELTHRESH and SACCACCTHRESH

In the __init__ for TobiiTracker the values for saccade_velocity_threshold and saccade_accelaraiton_threshold are hard coded to be set to 35 and 9500 respectively. These values should be set in defaults.py or constants.py but the settings in those files are ignored.

Logging long variables (e.g. lists) to the edf file

Hi edwin,

I just found out that the messages that are logged to the edf file have a maximum length of 128 characters. As such, if you for instance want to log a list variable at the end of your experiment, you may well lose some information. According to SR research it's not something that can be fixed directly; (rather you'd have to log separate elements of the list in a for-loop, say).

Luckily I found this in time myself, but it may be important to implement something that warns people for this when they do log a long variable?

Cheers,
Josh

Specifying `disptype` through keyword gives exception

Most of the settings can be overridden by creating constants.py or by passing keyword arguments to the constructor. However, the keyword way gave me some trouble. For example, I would expect this to work:

from pygaze import libscreen
screen = libscreen.Screen(disptype='pygame')

Instead it gives an Exception, because pygame has not been imported. The problem appears to be due to the fact that the import statements are based only on the values set in either defaults.py or constants.py, but not based on the keywords. I'm not sure what the best solution would be. One option would be to create a function that ascertains that pygame is imported, and call this function in the constructor of Display, Screen, and wherever we need to make sure that pygame is available. An analogous function would need to be created for psychopy, of course.

def importPygame():

    """Make sure that PyGame is imported."""

    if 'pygame' not in globals():
        global pygame
        import pygame

Problems with `defaults` and `constants`

The problem

Right now, configuration options are stored in the module defaults and overwritten by values from the module constants if available. This works fine when you indeed use a constants.py file to set options. But if you try to change options at runtime things get rough.

Basically, what happens is that all modules start like this:

from pygaze.defaults import *
try:
    from constants import *
except:
    pass

What this does is copy the values into the module itself. This means that changing an option in defaults, like so ....

from pygaze import defaults
defaults.DISPTYPE = 'opensesame'

... only works when no modules have been loaded yet. If a module has already been loaded, it needs to explicitly reloaded in order for the option to take effect. For the plug-ins, this required a hack, which is implemented in pygaze_init.reload_pygaze().

Another problem is that you can specify many options through keywords as well as the config system. When you actually start using the keywords, things easily get messy and confusing.

A solution

In general terms, there should be a config system in which all options are stored in a single place, without any copying of config options. (Copying now happens implicitly due to the import structure shown above.)

There are many ways to do this, but one way would be to mimick the config system of OpenSesame.

Basically, there is a single instance of the config class, called cfg (a singleton design pattern), and this can be accessed from anywhere in the code, like so:

from libqtopensesame.misc.config import cfg
cfg.my_option = 'a value' # Set the option
print cfg # Get the option

Perhaps the constants.py file could be read and then used to set options through this config system on start-up.

I would also do away with all the keyword arguments, such as disptype, that should really be set through the config system.

What do you think?

Disabled combobox in drift_correct is re-enabled after switching items

In the pygaze_drift_correct plug-in in OpenSesame 2.9.6 on Windows 7 x64:
The Target color and Target style both get disabled (grayed out) after unchecking Show display with drift-correction target as they should. But after switching to another item in the Overview and switching back to the pygaze_drift_correct item; the Target color (type line_edit) is still disabled but the Target style (type combobox) is re-enabled!

I also reported this as an OpenSesame issue open-cogsci/OpenSesame#347 but it appears to be a plug-in issue. Overriding edit_widget in the plug-in seems to work.

3cccbc04-3088-11e5-8a14-5961df0dec66

Crash during testing with pygaze_trackertest

I am trying to test pygaze on my system, and it seems to fail on the following part of the trackertest:

$ python PyGaze_trackertest.py 
starting recording ...
returned 0
Start realtime mode ...
Wait for block start ...
done ...
stopping recording ...
done ...
status message: now testing sample function
starting recording ...
returned 0
Start realtime mode ...
Wait for block start ...
done ...
stopping recording ...
done ...
libeyelink.libeyelink.fix_triggered_drift_correction(): success
status message: now testing wait_for_event functions
Traceback (most recent call last):
  File "PyGaze_trackertest.py", line 159, in <module>
    eventfuncs[i]()
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_eyetracker/libeyelink.py", line 843, in wait_for_fixation_start
    spos = self.sample()
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_eyetracker/libeyelink.py", line 621, in sample
    "Error in libeyelink.libeyelink.sample(): Recording was not "
Exception: Error in libeyelink.libeyelink.sample(): Recording was not started before collecting eyelink data!

I am using pygaze version 0.6.0a6, synced with git today.
python 2.7
Ubunutu 14.04
most recent pylink version.

I also tried the other example programs, and they all seem to crash on the "wait_for_xxxx" function calls. Any ideas why this might be the case? Any ideas on how to dig deeper to debug?

Thanks so much,

Cyrus

Compatability with OpenSesame 3.0.0

Does anyone know if the current versions of the OpenSesame plugins on the master branch work with OpenSesame 3.0.0? If not, is there a branch for testing this yet?

I tried them today and I got this error (below)

Thanks!

Unexpected error

item-stack: experiment[run].practice_loop[run].block_sequence[run].block_loop[run].trial_sequence[run].pygaze_log[run]
exception message: eval_text not found
time: Thu Oct 22 15:44:44 2015
exception type: AttributeError

Traceback:
  File "/usr/lib/pymodules/python2.7/libqtopensesame/runners/inprocess_runner.py", line 38, in execute
    self.experiment.run()
  File "/usr/lib/pymodules/python2.7/libopensesame/experiment.py", line 390, in run
    self.items.execute(self.var.start)
  File "/usr/lib/pymodules/python2.7/libopensesame/item_store.py", line 95, in execute
    self.run(name)
  File "/usr/lib/pymodules/python2.7/libopensesame/item_store.py", line 110, in run
    self[name].run()
  File "/usr/lib/pymodules/python2.7/libopensesame/sequence.py", line 49, in run
    self.experiment.items.run(_item)
  File "/usr/lib/pymodules/python2.7/libopensesame/item_store.py", line 110, in run
    self[name].run()
  File "/usr/lib/pymodules/python2.7/libopensesame/loop.py", line 143, in run
    self.experiment.items.execute(self.var.item)
  File "/usr/lib/pymodules/python2.7/libopensesame/item_store.py", line 95, in execute
    self.run(name)
  File "/usr/lib/pymodules/python2.7/libopensesame/item_store.py", line 110, in run
    self[name].run()
  File "/usr/lib/pymodules/python2.7/libopensesame/sequence.py", line 49, in run
    self.experiment.items.run(_item)
  File "/usr/lib/pymodules/python2.7/libopensesame/item_store.py", line 110, in run
    self[name].run()
  File "/usr/lib/pymodules/python2.7/libopensesame/loop.py", line 143, in run
    self.experiment.items.execute(self.var.item)
  File "/usr/lib/pymodules/python2.7/libopensesame/item_store.py", line 95, in execute
    self.run(name)
  File "/usr/lib/pymodules/python2.7/libopensesame/item_store.py", line 110, in run
    self[name].run()
  File "/usr/lib/pymodules/python2.7/libopensesame/sequence.py", line 49, in run
    self.experiment.items.run(_item)
  File "/usr/lib/pymodules/python2.7/libopensesame/item_store.py", line 110, in run
    self[name].run()
  File "/usr/share/opensesame/plugins/pygaze_log/pygaze_log.py", line 60, in run
    self.experiment.pygaze_eyetracker.log(self.eval_text(msg))
  File "/usr/lib/pymodules/python2.7/libopensesame/item.py", line 280, in __getattr__
    raise AttributeError(u'%s not found' % var)
AttributeError: eval_text not found

how to get the timestamp (time.time()) from the corrected time stamp in the pygaze output

hi,

I'm struggling to get the timestamp from the tsv output. I developed my own script to present stuff with pygame and it records the timestamp from the time.time() function.
I see that in pyGaze that is corrected by the 'tracker timestamp'. I have no idea what it is and I would love to find a way to convert the 'time'-timestamp in the tsv into the time.time()-timestmap.
Why is this correction useful anyway, and what is the internal time of the eyetracker?
can this be done? I hope so otherwise I'm in big troubles..
thanks so much in advance!

OpenSesame plugin crashes after calibration with EyeTribe

The calibration of the EyeTribe tracker finishes without a problem, but after completion the experiment is aborted with the following error message

exception message: request
exception type: KeyError

Traceback (also in debug window):
  File "C:\Users\Daniel\Documents\GitHub\OpenSesame\libqtopensesame\misc\process.py", line 139, in run
    exp.run()
  File "C:\Users\Daniel\Documents\GitHub\OpenSesame\libopensesame\experiment.py", line 333, in run
    self.items[self.start].run()
  File "C:\Users\Daniel\Documents\GitHub\OpenSesame\libopensesame\sequence.py", line 47, in     run
    self.experiment.items[item].run()
  File "C:\Users\Daniel\AppData\Roaming\.opensesame\plugins\pygaze_init\pygaze_init.py", line 180, in run
    self.experiment.pygaze_eyetracker.calibrate()
  File "C:\Python27\lib\site-packages\pygaze\_eyetracker\libeyetribe.py", line 189, in calibrate
    self.eyetribe.calibration.start(pointcount=len(calibpoints))
  File "C:\Python27\lib\site-packages\pygaze\_eyetracker\pytribe.py", line 1113, in start
response = self.connection.request('calibration', 'start', {'pointcount':pointcount})
  File "C:\Python27\lib\site-packages\pygaze\_eyetracker\pytribe.py", line 394, in request
    elif self.resplist[i]['request'] == request:
KeyError: 'request'

EyeTribe: Error in 'calibration' 'pointend' request for new SDK 0.9.77

I am pretty sure this is an issue on the EyeTribe side, but since I am not totally aware of all the inner workings, I wanted to leave this here as well:

On a Windows (7 and 8) machine, calibration using PyGaze crashes after the first calibration point.
The error thrown tells me that the 'calibration' 'pointend' request returned None.

Everything else, except for calibration, seems to work fine: Logging messages to the tracker log, start & stop recording.

Here's my post in the eyetribe-forums, in case you want to follow up there.

http://theeyetribe.com/forum/viewtopic.php?f=9&t=605&p=2557&sid=229616157d158b5b2a54d31582438cb4#p2557

Thanks for coming up with PyGaze. It's absolutely great.

Felix

Add monitor as a parameter for PsychoPyDisplay.__init__()

This problem arises when I create a PsychoPy stimulus with parameters expressed in visual degrees rather than pixels. For instance, dot_stim = visual.DotStim(win=pygaze.expdisplay, dotSize=3, units='deg') throws

...
  File "C:\Python27\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\contrib\lazy_import.py", line 120, in __call__
    return obj(*args, **kwargs)

  File "C:\Python27\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\visual\dot.py", line 143, in __init__
    self._update_dotsXY()

  File "C:\Python27\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\visual\dot.py", line 466, in _update_dotsXY
    self._updateVertices()

  File "C:\Python27\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\visual\basevisual.py", line 502, in _updateVertices
    win=self.win, units=self.units)

  File "C:\Python27\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\tools\monitorunittools.py", line 82, in convertToPix
    return unit2pixFunc(vertices, pos, win)

  File "C:\Python27\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\tools\monitorunittools.py", line 33, in _deg2pix
    return deg2pix(pos + vertices, win.monitor)

  File "C:\Python27\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\tools\monitorunittools.py", line 236, in deg2pix
    raise ValueError(msg % monitor.name)

ValueError: Monitor __blank__ has no known size in pixels (SEE MONITOR CENTER)

Probably, adding the monitor parameter to PsychoPyDisplay.__init__() and passing it down to psychopy.visual.Window() would solve this

Cannot get mouse position from PsychoPy

Not sure if it's a general issue or a local config problem, but for me the following code throws an exception

from pygaze import libscreen, libinput

disp = libscreen.Display(disptype='psychopy')
mouse = libinput.Mouse(disptype='psychopy')

test_screen = libscreen.Screen(disptype='psychopy')    
disp.fill(screen=test_screen)
disp.show()    
current_mpos = mouse.get_pos()
disp.close()
Traceback (most recent call last):

  File "<ipython-input-1-90c7ba8a9569>", line 1, in <module>
    runfile('C:/Python27/pygaze_issue_1.py', wdir='C:/Python27')

  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
    execfile(filename, namespace)

  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 71, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "C:/Python27/pygaze_issue_1.py", line 9, in <module>
    current_mpos = mouse.get_pos()

  File "C:\Python27\lib\site-packages\pygaze\libinput.py", line 406, in get_pos
    return psychopos2pos(self.mouse.getPos())

  File "C:\Python27\lib\site-packages\psychopy\event.py", line 390, in getPos
    lastPosPix[1] = self.win.size[1]/2-lastPosPix[1]

AttributeError: 'weakref' object has no attribute 'size'

Again, I'm quite sure something's wrong with my PsychoPy settings (attached just in case), so I'll appreciate any suggestions

psychopy_userPrefs.cfg.txt

The opensesame plugin pygaze_init needs a prepare phase/function

Hey Edwin -- Nice work on pygaze!

I found a small issue in the OS plugins . This minimal example, which is basically:

pygaze_init 
pygaze_drift_correct_ 
pygaze_start_recording, 
pygaze_stop_recording 

...causes a crash, because pygaze_eyetracker is not available in exp.

I think it's because since there is no prepare in pygaze_init, the pygaze_eyetracker hasn't been set yet, which is needed by the other items
e.g. line 88 in pygaze_drift_correct.py

The reason you may not have noticed this before is that if you put the items in a loop-item (as people tend to do) initialization is run before any item is prepared. (See here)

The simple solution seems to be that it needs a prepare phase that sets the variables needed.
I don't really have time right now to review what parts of the init would have to go in that prepare function -- hence no pull request with a proposed fix from me :) -- but it seems like this could be an easy fix for you

hard crash when calling send_command() with eyelink

pygaze commit afef6d9
Windows 7; OpenSesame 2.8.3
Occurs on EyeLink CL/1000 and EyeLink 2000

When the pygaze_eyetracker.send_command() is called with EyeLink as the eyetracker type, the experiment crashes with a segmentation fault (thus quite serious). It does not depend on the contents you pass to send_command(). I've tried with various strings and all cause the crash.

PyGaze compatibility with psychopy version 1.82

Dear Edwin,

I am used to programming experiments with psychopy version 1.82. I tried to integrate the PyGaze package in my python distribution, including psychopy 1.82, but that gave rise to many bugs. I then tried using your distribution. However, the psychopy version 1.75.01 that is used in that distribution does not support all the functionality that I need for my experiment. Are you planning on updating PyGaze so that it will be possible to integrate it with newer psychopy versions?

Regards,
Hanne Huygelier

Fixation triggered drift correct not working with EyeTribe

Drift correct works fine when using the spacebar triggered mode (thus fixate at center dot while pressing spacebar), but does not continue in 'fixation triggered mode'. The experiment just simply gets stuck on the drift correct fixation display. I've checked that the calibration is correct.

OpenSesame 2.9.2
pygaze 0.5.0
pytribe #18f66d8

GP3 support

I would be happy if Gazepoint GP3 would be supported by PyGaze/OpenSesame.

Our story

I have written a mail to the psychologist colleague of mine about PyGaze. He was were very enthusiastic. He bring the GP3 device to our university from his work place and we started to experimenting with the device with the vendor's software. But we have a limited support for the analysis software of GP3. OGAMA was recommended by someone, but I like Python very much and I prefer Python to C# and I do not want to use Windows for the analysis.

Can I help you?

I would happily give PyGaze a try, but as I have read on forum, it does not support it. I would be hard to get it work with PyGaze/OpenSesame? If it is not hard, perhaps I would help you. (I have written some Python programs as you can see on Github, I am not a beginner.) But I need help:

  • I do not know where to start.
  • I know GP3 has an interface API based on TCP/IP, but I do not know, how to reach it on OS-es other than Windows (I use Ubuntu and Debian).
  • I have not investigated the structure of PyGaze yet and I have not used is yet, because I have no other device to try it.
  • I have found a MATLAB code, that could be the starting point of the code: https://github.com/mperez4/gazepoint_toolkit

Can't run the annoying_message.py example

Trying to run the annoying_message.py example with Python2.7 gives me this error:

manos@manos-530U3C:~/PyGaze/examples/annoying_message$ python annoying_message.py 
Traceback (most recent call last):
  File "annoying_message.py", line 18, in <module>
    disp = Display()
  File "/usr/local/lib/python2.7/dist-packages/pygaze/display.py", line 43, in __init__
    from pygaze._display.psychopydisplay import PsychoPyDisplay  as Display
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_display/psychopydisplay.py", line 30, in <module>
    from pygaze.libtime import clock
  File "/usr/local/lib/python2.7/dist-packages/pygaze/libtime.py", line 29, in <module>
    from pygaze._time.psychopytime import PsychoPyTime as Time
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_time/psychopytime.py", line 22, in <module>
    import psychopy.core
ImportError: No module named psychopy.core

Trying to run it with Python3 gives me this error:

manos@manos-530U3C:~/PyGaze/examples/annoying_message$ python3 annoying_message.py 
Traceback (most recent call last):
  File "annoying_message.py", line 14, in <module>
    from pygaze.libscreen import Display, Screen
  File "/usr/local/lib/python3.3/dist-packages/pygaze/libscreen.py", line 22, in <module>
    from screen import Screen
ImportError: No module named 'screen'

send_command() causes TypeError when used with EyeTribe eyetracker

When calling the exp.pygaze_eyetracker.send_command() from OpenSesame when the tracker type is EyeTribe, the program quits with the following message:

Error while executing inline script
phase: run
item: stimulus_display
line: 603
exception message: request() takes exactly 4 arguments (2 given)
exception type: TypeError

Traceback (also in debug window):
  File "C:\Users\Daniel\Documents\GitHub\OpenSesame\libopensesame\inline_script.py", line 173, in run
    self.experiment.python_workspace._exec(self.crun)
  File "C:\Users\Daniel\Documents\GitHub\OpenSesame\libopensesame\python_workspace.py", line 111, in _exec
    exec(bytecode, self._globals)
  File "<string>", line 10, in <module>
  File "C:\Python27\lib\site-packages\pygaze\_eyetracker\libeyetribe.py", line 604, in send_command
    self.eyetribe._connection.request(cmd)
TypeError: request() takes exactly 4 arguments (2 given)

OpenSesame 2.9.2
pygaze 0.5.0
pytribe #18f66d8

Saccade detection on Tobii trackers produces problems due to missing chin rest

If I analysed the code for Tobii eye trackers correctly, there might be a problem with the detection of saccades.

In the paper mentioned in the README.md it is stated that saccades are detected based on thresholds for the velocity and deg/s and the acceleration in deg/s², which then are converted to pixel/s and pixel/s² respectively during calibration. This is no problem, if the distance between the eyes and the display is fixed during the experiment as it's the case with eye trackers using a chin rest, but might cause problems if this distance changes. (I ignore at this point the fact that there are also slight errors with a fixed eye-screen distance due to the fact that the distance increases towards the corners of the screen, but I'm guessing that this error is negligible.)

Since at least the Tobii TX300 doesn't use a chin rest, but detects the eye position within a box roughly the same length as it's distance to the screen there might be bigger issues with a consistent detection of saccades on the front end of this box compared to the back end. Due to the fact that only the velocity and acceleration are only measured in pix and not deg, an eye movement which isn't registered as an saccade near the screen might be at higher distances.

A possible fix for this issue would be working with the gaze vector and not only the gaze point on the screen. All the necessary data to calculate the gaze vector is given in the GazeDataItem provided in the Tobii SDK and stored within the TobiiController in PyGaze. The down side of this would be of course that calculating the gaze vector would be by far more computational effort than is used by the current method.

I am not sure whether this also effects other eye trackers since I am only familiar with the Tobii TX300 and have no other trackers to look into the issue, but if there are other trackers working without any form of fixation for the participant's head, there is a high possibility that those are also effected.

It might also be the case, that I am missing something in the code, so it would be nice to get some feedback on this train of thought.

EDF transfer freezes with OpenSesame plug-ins

For some reason, transferring the edf from the EyeLink machine to the experimental PC freezes when using the OpenSesame PyGaze plug-ins. It is not clear to me why, because it works fine with the old EyeLink plug-ins (which are almost identical) or standalone PyGaze. It's really in the context of the OpenSesame plug-ins that the data transfer freezes up. The line that hangs is in libeyelink.close():

def close(self):
    # The line below hangs ...
    pylink.getEYELINK().receiveDataFile(self.eyelink_data_file, \
        self.local_data_file)

A zero-byte file is created on the experimental PC and the EyeLink PC shows a 'transferring data' message. But that's it, the data transfer never completes. I also posted this issue on the SR Research forum:

Any ideas? This is the last (that I know of) critical issue. Other than this, the OpenSesame plug-ins work fine, at least on the EyeLink.

EyeTribe get_frame() error

While using the EyeTribe eyetracker, an error occurs (see error message below). This error seems to occur while a pause screen is presented to the user (before presenting this screen I stop recording with the eyetracker). If I print out the content of response, the dictionary does not contain u'frame' after the values, but it contains u'calibresults'. Is it wrong to stop the recording during pauze screens in the experiment? (This error also occurred while trying to run the simple_tracker_experiment example after one of the first trials).

Exception in thread samplestreamer:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 763, in run
self.__target(_self.__args, *_self.__kwargs)
File "C:\Python27\lib\site-packages\pygaze_eyetracker\pytribe.py", line 238, in _stream_samples
sample = self._tracker.get_frame()
File "C:\Python27\lib\site-packages\pygaze_eyetracker\pytribe.py", line 851, in get_frame
return { 'timestamp': response['values']['frame']['timestamp'],
KeyError: 'frame'

Support for EyeLink DataViewer protocol

This issue mostly just something to think about.

Quite some people are using the EyeLink DataViewer for analysis. DataViewer uses a simple protocol that requires certain messages. For example, the start of a trial should be:

TRIALID [trialid]

Whereas the OpenSesame plugins use by default:

start_trial [trialid]

And variables are logged as:

!V TRIAL_VAR [name] [value]

Whereas PyGaze uses by default:

var [name] [value]

People can override our defaults, or they can override the DataViewer's defaults. But many people don't realize that, so it's not very user friendly. I'm wondering what the best way to deal with this is.

  • We could simply take over the DataViewer protocol. That would make interoperability easiest. The downside of this is that it would break backwards-compatibility. I also don't think their syntax is very readable (what's up with the !V?), but that's maybe not super-important.
  • We could allow users to specify whether they want to write PyGaze-style or DataViewer-style messages. If we do that, at what level should this be specified? In the PyGaze Python library, or the OpenSesame plugins?

Thoughts?

Getting error and no calibration fixation dots.

Dear Edwin,

I hope you are doing well today. I have spent all day trying to get PyGaze to work, but I am stuck on an error.

When it tries to calibrate, the fixation circles are not appearing. I am using the example script:

python simple_tracker_experiment.py Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_eyetracker/eyelinkgraphics.py", line 246, in draw_cal_target
    self.play_beep(pylink.CAL_TARG_BEEP)
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_eyetracker/eyelinkgraphics.py", line 264, in play_beep
    if EYELINKCALBEEP:
NameError: global name 'EYELINKCALBEEP' is not defined

This variable is defined in my constants.py file.

also, I get this error too, if I bypass the calibration:

Traceback (most recent call last):
  File "simple_tracker_experiment.py", line 66, in <module>
    checked = tracker.drift_correction()
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_eyetracker/libeyelink.py", line 353, in drift_correction
    return self.manual_drift_correction(pos)
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_eyetracker/libeyelink.py", line 367, in manual_drift_correction
    self.draw_drift_correction_target(pos[0], pos[1])
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_eyetracker/libeyelink.py", line 1053, in draw_drift_correction_target
    self.scr.draw_fixation(fixtype='dot', colour=FGC, pos=(x,y), pw=0, \
NameError: global name 'FGC' is not defined

Do you have any idea what is going on?

I am using:
PyGaze version 0.5 (01-10-2014)
Ubuntu 14.04
pylink version (1, 0, 0, 37)
Eyelink 1000+

Thanks,

Cyrus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.