Giter Site home page Giter Site logo

yh-luo / psychopy_tobii_infant Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 4.0 29.71 MB

Create infant-friendly eyetracking experiments with PsychoPy and Tobii eyetrackers.

License: GNU General Public License v3.0

Python 100.00%
psychopy tobii-eye-tracker

psychopy_tobii_infant's People

Contributors

anonzebra avatar datalowe avatar yh-luo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

psychopy_tobii_infant's Issues

(using PsychoPy standalone) Space by itself doesn't end 'show subject relative position' phase

All demos include this piece of code:

# show the relative position of the subject to the eyetracker
# Press space to exit
controller.show_status()

It says 'press space to exit'. However, on my setup (Windows 10, PsychoPy standalone v2020.2.10, running the experiment from PsychoPy Coder view), this by itself doesn't work. I first need to do a mouse click and only then can I hit space to proceed.

After the experiment has finished, I can see in the coder view that any keyboard input I entered before doing a mouse click have resulted in corresponding characters being written in the script. It appears then that for some reason, 'focus' isn't shifted to the experiment window (even though it's in the foreground and fullscreen). Instead, Windows keeps routing any keyboard input to the coder window.

Sound stimuli with calibration?

Hi,

I have a question about your code from demo1_calibration. Is it designed to make a sound output when each keypress (0 - 9)? If not, is it possible to add sound?

Thanks!
Victoria

'Result message' becomes invisible if using a white background

The run_calibration and run_validation methods currently always use a white TextStim instance for displaying calibration/validation results. It's recommended however that "[for] good performance, choose a calibration background that matches the color and brightness of your stimuli.". IIUC, this means that if a white background is used in the experiment itself, it's appropriate to use a white background for the calibration as well. But this hides the result message in this package.

One way to get around this is to simply add another argument to run_calibration/run_validation, like I did here.

Request: Packaging psychopy_tobii_infant with PyHab?

Hi Yu-Han, I'm the creator of PyHab (Kominsky, 2019; https://github.com/jfkominsky/PyHab), and I was thinking about adding psychopy_tobii_infant to PyHab to make it easier for people to build eye-tracking experiments. You've done a really great job with it, and it's easy for PyHab to interface with it. I was thinking of literally just taking the module folder and adding it as a sub-folder within PyHab, giving you full credit for it of course!

Let me know if you're ok with that or have any questions.

Kominsky, J. F. (2019). PyHab: Open-source real time infant gaze coding and stimulus presentation software. Infant Behavior and Development, 54, 114-119. https://doi.org/10.1016/j.infbeh.2018.11.006

Cannot import infant_tobii_controller

Hello,

I am just getting started on implementing eye-tracking with infants and we are using PsychoPy with the Tobii Pro SDK. Your code seemed perfect as a starting point, but I am unable to import 'infant_tobii_controller'.

I am using Windows 10. Any ideas?

Thank you!

Calibration result view goes blank if just one point's calibration fails

Steps to reproduce:

  1. Run one of the demo's calibration procedure.
  2. (as the participant) Close your eyes or look away entirely from the screen for one of the calibration points, and focus on the remaining calibration points.
    i. It's possible that it has to be the last point that you look away for, but I think that the issue appears regardless of which point you close your eyes for.
  3. Proceed to the calibration results view.
    The calibration results view should now be entirely 'blank'.

What I expected to happen:

Rather than getting an entirely 'blank' calibration results view, I'd expect that only the one point/area for which you closed your eyes would be blank, while other calibration points would have corresponding red/green lines indicating how far participant gaze was from the target.

Cause of issue

In the package's init.py file inside of the _show_calibration_result method, there is the following check:

if self.calibration_result.status == tr.CALIBRATION_STATUS_FAILURE:
    # computeCalibration failed.
    pass

This status attribute is assigned its value through the return value of a tobii_research function call. Tobii's documentation here is somewhat opaque, but as far as I could understand, this value is set to the constant CALIBRATION_STATUS_FAILURE as soon as any point's calibration data collection fails (regardless of whether or not collection was successful for other points).

Suggested solution

Simply remove the self.calibration_result.status == tr.CALIBRATION_STATUS_FAILURE check. As far as I can tell, and from testing, this shouldn't cause any issues. The _show_calibration_result code relies on self.calibration_result.calibration_points, which as far as I can tell only includes points for which calibration data collection was 'successful' (ie participant gaze could be captured at all). I tried this in a branch and with the modification, the results presentation behavior is as I would expect.

In fact, now that I look at it again, it's probably possible to drop the if len(self.calibration_result.calibration_points) == 0: check as well, since if the length is indeed 0 then for this_point in self.calibration_result.calibration_points: loop won't do any iterations anyway. I unfortunately can't test this myself since I don't have access to an eyetracker now, but it might be worth considering, for cleaning the code.

If the solution seems appropriate, I can do a PR.

ValueError: You shouldn't create CalibrationPoint objects yourself

Many thanks for sharing this project. I have been using your tobii-infant-controller in an experiment, programmed in Psychopy3 and interfacing via iohub to a tobii X2-60 (running on Windows 7).

I get the following error message occasionally (copying the entire Psychopy console output for context):

Welcome to PsychoPy3!
v2021.1.2
12.8191 WARNING Couldn't connect to psychopy.org
Check internet settings (and proxy setting in PsychoPy Preferences.
28.6397 INFO Loaded monitor calibration from ['2022_01_24 11:57']
Generating PsychoPy script...

Running: C:\Users\Eyetracker2\Documents\StructureEyes\StructureEyes_final\Task_pred_struct_final_lastrun.py
34.6018 INFO Loaded monitor calibration from ['2022_01_24 11:57']
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
29.0727 WARNING t of last frame was 20.48ms (=1/48)
47.1880 WARNING Monitor specification not found. Creating a temporary one...
pressed e at 0.1514297748599347 ms
1070.5146 WARNING Monitor specification not found. Creating a temporary one...
2122.6566 WARNING Monitor specification not found. Creating a temporary one...
ioHub Server Process Completed With Code: 0
Traceback (most recent call last):
File "C:\Users\Eyetracker2\Documents\StructureEyes\StructureEyes_final\Task_pred_struct_final_lastrun.py", line 2326, in
controller.run_calibration(CALIPOINTS, decision_key='a')
File "C:\Users\Eyetracker2\Documents\StructureEyes\StructureEyes_final\Task\psychopy_tobii_infant_init_.py", line 718, in run_calibration
self.calibration_result = self.calibration.compute_and_apply()
File "C:\Program Files\PsychoPy3\lib\site-packages\tobiiresearch\implementation\ScreenBasedCalibration.py", line 270, in compute_and_apply
calibration_points.append(CalibrationPoint(position, tuple(calibration_samples)))
File "C:\Program Files\PsychoPy3\lib\site-packages\tobiiresearch\implementation\ScreenBasedCalibration.py", line 87, in init
"You shouldn't create CalibrationPoint objects yourself.")
ValueError: You shouldn't create CalibrationPoint objects yourself.
Error in atexit.run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\Eyetracker2\Documents\StructureEyes\StructureEyes_final\Task\psychopy_tobii_infant_init
.py", line 629, in close
"Data file is not found. Use start_recording() to record and "
RuntimeWarning: Data file is not found. Use start_recording() to record and save the data.
Experiment ended.

I have been in touch with Tobii support and also posted on the Psychpy Ddiscourse forum, but no luck. I am puzzled because the issue does not happen deterministically. Tobii support think the problem is not hardware-related. Attaching the psychopy program file. Thanks.

structure_pred_for_github.zip

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.