I have 1 conditions/input file with 337 rows representing 336 trials. These trials are split into 14 blocks, with 24 trials per block. For every block, I have a different target stimulus, so I have 14 different target stimuli. At the end of each block, I want to inform participants of the upcoming target stimulus.
Here’s a screenshot of what I’m trying to do, and have no idea if it’s even possible as when I run the experiment, it just fails:
I’m quite new to PsychoPy, so apologies if this doesn’t make much sense. I’m also a new user on the forum! I’m using PsychoPy version: 2023.1.3. Please feel free to ask me any questions for clarification.
What is the error message?
Hi there! This is the error message:
I haven’t tested this yet but try putting square brackets around the list… [‘0:10’,‘20:30’]
I tried that… it doesn’t work unfortunately!
what you can do is to surround your trial-loop with another loop, e.g. called block, insert a routine, e.g. setRows, before your trial-routine outside the trial-loop inside of the block-loop and set the rows to read in setRows.
In the Begin experiment tab of setRows, write
useRows = '0:0'
In the Begin routine tab of setRows write
if block.thisN == 0:
useRows = '0:24'
elif block.thisN == 1:
useRows = '25:48'
The loop-definition of trial looks like this
Depending on your planned data analysis, you can check (default) or uncheck the Is trials-parameter of your block-loop.
Best wishes Jens
Thank you so much! This works. Now, I have a probably naive question, but I want to get through all 14 blocks, so how would I do that in the code component for setRows? i.e., I want 14 ranges of trials, not just ‘0:24’ and ‘25:48’.
Using @JensBoelte 's suggestion, you could do the following:
useRows = str(block.thisN*24) + ':' + str((block.thisN+1)*24)
N.B. One row will be skipped if you use 0:24 and 25:48
If this is all sequential then it doesn’t actually do anything more than run the entire spreadsheet. Is there some randomisation needed?
Hi, thank you for your suggestion! I’ve written a script that already randomized the order of trials/stimuli, so I may leave the trial loop as sequential.