Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Casting issues with anaylising data from EyeLink(numpy and gazeplotter.py error)

denisringdenisring Posts: 1
edited November 2017 in PyGaze

Hi folks,

I'm trying to run analysis from an EyeLink file that has been converted from .edf to .asc. I'm using analysis.py found here https://github.com/esdalmaijer/PyGazeAnalyser , if anybody is familiar. I had previously used this to run analysis on data gotten from using an EyeTribe, which worked fine. I've edited parts of the analysis.py script to work with EyeLink. However, when I go to run the script, I get the following error:

cannot cast ufunc add output from dtype('float32') to dtype('uint8')

This points to line 402 in gazeplotter.py which reads:
screen[y:y+h,x:x+w,:] += img

Looking around online it seems that numpy became more strict on implicit casting and no longer allows casts between floating points and integers. I've tried downgrade to older numpy versions but that's sprang up different problems. There seems to be a number of solutions online, and I think I need to edit gazeplotter.py in some way but I'm not quite sure how.

Apologies if this isn't specific enough. If anybody has used PyGazeAnalyser on EyeLink data and encountered the same I'd love to hear from you.

Many thanks,
Denis

Comments

  • EdwinEdwin Posts: 655

    Hi Denis,

    Thanks for flagging this up! Seems to me like maybe we should make sure that both img and screen are of the same data type? If you edit the offending line to the following, does it help?

    screen[y:y+h,x:x+w,:] += img.astype(screen.dtype)
    

    Cheers,
    Edwin

Sign In or Register to comment.