Dynamic source files and path issues
in OpenSesame
I'm designing a lab-based experiment in OS 3.3.14 on a MacOS 12. As I am a new user migrating from PsychoPy, I have already run into some trouble using source files and setting durations. Here are the two issues I'm facing, for which I couldn't find an answer on the forum.
- For each participant, I have already individual excel sheet (e.g., p1_stim.xlsx) with holds a column (e.g., stimPath) having file names (face1.jpg) pointing to the stimuli (faces) to be presented. I wanted to add an inline code which sets a variable to the correct excel sheet per subject. Then set the "Source/File" in the block loop to this variable. Even if I manually set
var.stimFile = "p1_stim.xlsx"
and the block loop source is set to the the variable name itself (in the GUI or the script), I get an error ("Failed to read text file:var.stimFile
" or "No such file or directory: 'var.stimFile' " - ) even though I can see the correct variable name and value in the Inspector. How do I make this work?
- What if I were to use a separate folder for these stimuli excel sheets, within the folder where the experiment sits?
- I can fix the first problem by manually updating the source excel in the block loop for each participant. But then, all faces (file names are in the excel column) would have to be in the same folder as the experiment, which isn't neat. I could get around to this by adding all faces to the pool in advance, but this is a large dataset that the file pool cannot handle. And the number of faces used per participant is a pre-determined subset of this database. Not efficient. It would therefore be nice to somehow append a path to the file name used in the sketchpad.
- Finally, an unrelated problem. I would like each face to be presented for a full 3 seconds and associated KB response to timeout after 3 seconds. Basically, each face should remain on the screen for 3 seconds, and the participant must respond in this time or the trial moves forward to next. I can't seem to make this work. Setting the duration of face to 3 seconds, and KB timeout to 3 seconds makes each trial last 6 seconds. Setting face to 3s and KB to zero or infinite also doesn't work.
I've attached a sample of the excel and the experiment.
Please help. Thanks!
Sam
Comments
Update to the question above:
var.stimFile = (u'p%s_stim.xlsx' % var.subject_nr)
Hi Sam,
Good that you figured most of it out by yourself!
I would like each face to be presented for a full 3 seconds and associated KB response to timeout after 3 seconds
The easiest would be to use co-routines: https://osdoc.cogsci.nl/4.0/manual/structure/coroutines/
If this is no option for you, you would need to resort to Python coding, but that's also not super complicated. I suggest you start with the co-routines, and if this doesn't work out, I can help you with the other option.
Good luck!
Eduard