psychopy.org | Reference | Downloads | Github

Run two blocks separately in a single routine

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): macOSBig Sur
PsychoPy version (e.g. 1.84.x): (v2021.1.4)
Standard Standalone? (y/n) Yes
What are you trying to achieve?:
I’m writing to ask you how I can run two blocks separately in a single routine. I want half of the participants to see block x, and another half to see Block y.

What did you try to make it work?:
There is a single routine with two blocks in my experiment. I created an excel spreadsheet for each block (familiarlangBlock.xlsx; unfamiliarlangBlock.xlsx) and then did another spreadsheet (chooseBlocks.xlsx) for the outer loop. Everything worked well when I ran the experiment. However, both blocks repeated sequentially.

So I moved to the counterbalancing step. I created two more spreadsheets (chooseBlocksA.xlsx; chooseBlocksB.xlsx) and typed below command $"chooseBlocks"+expInfo['group']+".xlsx" in conditions field in inner loop. I also added my group beginning of the experiment under the Experiment Setting tab.

HSsS.psyexp (8.4 KB)
chooseBlocksB.xlsx (8.5 KB)
chooseBlocksA.xlsx (8.5 KB)
unfamiliarlangBlock.xlsx (8.8 KB)
familiarlangBlock.xlsx (8.9 KB)
chooseBlocks.xlsx (8.6 KB)
What specifically went wrong when you tried that?:
It seemed to work, but when I ran the experiment, there was a warning message:

“/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/data/utils.py”, line 300, in importConditions
raise ValueError(msg % os.path.abspath(fileName))
ValueError: Conditions file not found: /Users/Zelish/Desktop/HappySoundsExp/$"chooseBlocks"+expInfo['group']+".xlsx"

I do not know what I’m doing wrong and appreciate it if someone points out my mistake.

Many thanks for your help!
Best wishes,
Zehra

Include pasted full error message if possible. “That didn’t work” is not enough information.

For some reason it looks like your conditions file code isn’t being interpreted, despite the $ symbol.

Hi @wakecarter

Thanks for your response.
Do you think it is a technical problem? Should I report to PsychoPy?

Best,
Zehra

I’ve just opened your psyexp file and discovered that your block selection says chooseBlocks.xlsx. I cant see where you are trying to select chooseBlocks A or B.

@wakecarter, thanks for your response.

I have two conditions files (familiar language and unfamiliar language), and I want the inner loop to select whether the next trial would be a familiar language or an unfamiliar language trial.

However, I can’t figure out how to tell the inner loop to select one of the conditions files. Do you think I should write a code for this? Or write something selected rows box in the inner loop?


Thanks.
Best,
Zehra

Hi,
I solved this issue, want to share anyone who struggles this issue and looking for a solution.
It’s valid for between-subject design, just type $np.random.choice((0,1), size =1) in Selected rows of outer loop.
Hope it helps:)

Check this thread How to randomize two different conditions?