[open] Merging Pygaze with other experimental library.
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
Hello,
This is additional information.
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?
When I tried to take Pygaze 'calibrate()' in my script, 'ValueError: Projection failed!' occurred.
Best,
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?
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
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,
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
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:
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!
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,
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,