Pygaze_log variables in EDF dataviewer?
Hello,
I'm trying to figure out how to find/call the sketchpad item names from my OS file in the EDF dataviewer 'sample report' output. The only variables that I get in the EDF output csv under 'sample_message' are 'start_trial' and 'stop_trial', which correspond to the 'pygaze_start_recording' and 'pygaze_stop_recording' plugins respectively. I have the 'automatically log all variables' button checked for the pygaze plugin, but are the variables being logged only referring to the pygaze plugins?
I had hoped that I could also log stimuli presentations to the EDF file - is this possible? Perhaps I am missing something obvious.
The reason I am trying to do this is that the sketchpad names correspond to different parts of the trial and I would like to be able to trim the pupil data based on specific onsets (although the timing is constant, there is slight variablility (2-4ms) in presentation times which makes it problematic to simply trim based on the sample # or timestamp).
Any assistance would be greatly appreciated!
Thanks,
Mikael
Comments
Hi Mikael,
If you use the
pygaze_logplugin, and enable 'Automatically log all variables', then the EDF will contain all experimental variables. You probably don't see them because they are not in the format that the EDF dataviewer expects. They are logged as messages in the following format:You can specify this somewhere in the settings of the dataviewer. But I don't know exactly where, because I don't have or use that program myself. But in case, the data should be there!
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Okay great, thank you!
Isn't the syntax
to log variables for the Eyelink Dataviewer?
By default, yes. But that's not the syntax used by
pygaze_log, so you need to explicitly indicate the PyGaze format in the Dataviewer. Maybe this should be made configurable in PyGaze though.Check out SigmundAI.eu for our OpenSesame AI assistant!
So I checked the ascii file of the edf output, and even though the pygaze_log 'log all variables' box is checked, in the ascii file they are not in the !V TRIAL_VAR [name] [value] format.
Does that mean I need to manually add an inline_script item after the pygaze_log (or before?) with the !V TRIAL_VAR [name] [value] for each variable I want logged to the edf file?
Thank you!
Right, because (as I said) that's the format used by
pygaze_log. But that's fine, because you can indicate in the EyeLink DataViewer that it should look for lines withvarinstead of!V TRIAL_VAR.Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
I contacted SR-research and while I can indeed indicate to look for lines with var: "DataViewer needs the !V Data Viewer command to be parsed and actively interpreted. Otherwise, the contents is not flagged as something that Data Viewer should regard any differently than a pure text message." I apologize if that wasn't clear. While I can use a batch fix on the data I already collected to append !V as a prefix to var, I was trying to figure out how to add the !V part within OpenSesame - I realize that wasn't completely clear from the previous post and apologize for the confusion.
Thank you for your patience and your help!
Mikael
Hello,
So I have an updated (and more informed, hopefully) question.
If I want to log all (or as many variables) as possible within the !V TRIAL_VAR [name] [value], I understand how to do this for variables that are in the workflow (like sketchpad items, keyboard responses etc.), but I am not sure how to concisely also include variables from loop & merge (so I have a column named congruence with incon and con values - do I need a separate line for !V TRIAL_VAR congruence incon and !V TRIAL_VAR congruence con? Or is there a straightforward solution I am missing).
Also, if there is any way to append !V to the pygaze log files that would be amazing (but my understanding is that there is not?)
Thank you again!
Mikael
Hi Mikael,
What exactly do you mean with "variables from loop & merge"? To my knowledge, using
!V TRIAL_VAR [name] [value]should work for all types of variables. So, if you have defined a variable in yourloop tablethat is called congruence, which can have the valuesinconandconon different trials, you just log the variablecongruenceand the respective value will be written to the edf file. Does this make sense?By the way, not sure whether it helps you, but you can also send those variables to the eyetracker from within an
inline_script, like so:Hope this helped.
Eduard
You could even be fancy and log all variables like so:
See also:
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Eduard,
So I have tried the inline script and the py_gaze widget manual messages and I seem to get the same issue both times.
For my inline script I use:
exp.pygaze_eyetracker.log("!V TRIAL_VAR congruence %s" % var)For my py_gaze log message I use:
!V TRIAL_VAR congruence [var]The variable
congruenceappears in the sample output report for dataviewer, but when I export the variables in both cases the column is filled with:<libopensesame.var_store.var_store object at 0x032BDB30>I also tested it with a 'count' variable that is automatically generated by OS:
exp.pygaze_eyetracker.log("!V TRIAL_VAR count_Target_1 %s" % var)and I got the same result of:
<libopensesame.var_store.var_store object at 0x032BDB30>It seems like there is some issue with using 'var' to call the value for whatever variable I specify (i.e. so if I specify the variable congruence using 'var' doesn't seem to get me the values for congruence (incon and con)). I'm really not familiar with python so I tried a few syntactical variations like or [var] but it didn't work out. Do you have any further thoughts?
Thank you!
Mikael
P.S. Sebastiaan I tried your suggestion as well, and also used
exp.pygaze_eyetracker.logas the function but in both cases got the error:TypeError: 'builtin_function_or_method' object is not iterablewhich leads me to further suspect some issue with called 'var'.Hi Mikael,
Just to be sure, did you see your actual variable names, or literally "var"?
So, if
congruenceis the variable you want to record, you have to use:where the first congruence, specifies the name the variable will have in your edf file, and the second is providing the actual value.
However, if you copied Sebastiaan's code literally, I don't understand why it didn't work for you.
Eduard
Theres an error in Sebastiaans snippet. It says IV instead of !V at the start
Hi Eduard,
I was using 'var'. I tried the actual variable name in both places:
exp.pygaze_eyetracker.log("!V TRIAL_VAR congruence %s" % congruence)but it gives me the error:NameError: name 'congruence' is not defined This also holds true for OS generated variables likecount_Target`.Hi Daniel, I caught that as well, but it didn't seem to make any difference. The only thing I noticed is that
varsin my snippet is in blue, whereas in Sebastiaan's it is white (which means it is a defined variable?). Is that meaningful or not?Am I potentially missing a plugin or something? I get all the eye tracking data just fine...it's only difficulty logging variables in the !V TRIAL_VAR format, from OS, that is giving me trouble.
Thanks for all your help, sorry for the difficulty.
Did you define congruence in the loop table? If so, you have to use var.congruence. The same is true for OS defined variables. In
inline_scriptsthey need to be called with var., where is the actual variable name.Eduard
Ahh, that did it, thank you so much!!