issues with accessing stimuli uploaded from file
Dear all,
I'm new to OpenSesame and am currently trying to implement an experiment for my Master's thesis. It's going to be a language experiment using RSVP. A sentence is a trial and every word is presented after the other in the middle of the screen.
Here's my problem:
I'm loading the stimuli from a file in the block loop. Later on, I'm using an inline_script for the RSVP-part (following the advanced tutorial). I have issues accessing the stimuli. If I understood it correctly it should be saved in a 'dm'-variable. I tried to access it like below, but I get error messages all the time.
Any help is highly appreciated. Thanks a lot!
Best,
Robin
My code:
import random
import string
##defining presentation time
var.word_dur = 345
##defining interstimulus rate
var.isi = 95
##defining sentence index
sentenceIndex = 0
##setting word_canvas_list
word_canvas_list = []
##saving stimulus in word_canvas_list
for word in enumerate(items.dm[sentenceIndex]):
word_canvas = canvas()
word_canvas.text(word)
word_canvas_list.append(word_canvas)
sentenceIndex += 1
blank_canvas = canvas()
Comments
Hi Robin,
It's simpler than you think, because OpenSesame automatically takes the variables from the DataMatrix, and sets them as experimental variables. So say that you have a column with the name
wordin the spreadsheet that you use as a source for the loop table, then you can refer to it asvar.word. Does that make sense?Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
That sounds easy. I'm having whole sentences in a column. Do they behave like lists? So if I have a column 'sentence', can I index the first word with var.sentence[0]?
Thanks!
Robin
Hi Robin,
No, a sentence specified in a
loopwould be a string (or strictly speaking aunicodeobject). To split this into separate words by spaces, you can simply use theunicode.split()method:Does that make sense?
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Yes, it works now.
Thanks a lot!
Best,
Robin