Cross task dependent randomisation

OS: Win11
PsychoPy version: 2024.1.5 Py 3.10
Standard Standalone Installation? Yes
Do you want it to also run online? No

What are you trying to achieve?:
I am using fNIRS to measure brain activity in monolinguals and bilinguals during a verbal fluency task. For monolinguals, this will consist of 9 English verbal fluency tasks presented in a block of 3 verbal tasks (60 sec on, 30 sec res) followed by a break where the participant will “press spacebar to continue” to begin the next block.

In bilinguals, participants will complete 9 verbal fluency tasks: 3 presented in English, 3 presented in their first language, and 3 presented in both languages to allow for response in both.

What I am trying to do, is develop a way of randomising which verbal fluency tasks are presented in each block out of the 9 potential VFTS, and prevent repetition of the VFTs in each block.

I have attached a screenshot of the stimuli spreadsheet that I am planning on using in each version of the experiment (Monolingual and Bilingual). I want to know if there is a way for each block of the experiment to be aware of the rows that have been used in the previous blocks (all stim are written in the same order across the languages) and avoid presenting this in the next block.

I have also attached the current builder I have generated for this experiment, however I am unsure of how to implement this randomisation. Any help would be greatly appreciated!

I had a similar issue for my stimuli (I believe). I combined two of Wake Carters Demos for this (for sure the independend randomisation, and I think the Trials Switching one). Here’s what I did:

  1. I preloaded my stimuli into separate lists (1 list per category = in your case 1 list per verbal fluency task).
    eco =
    moral =
    for row in myData.trialList:
    if row[‘Classification’] == ‘eco’:
    eco.append(row)
    elif row[‘Classification’] == ‘moral’:
    moral.append(row)
    #ensure random stimuli selection per participant from the stim pool
    shuffle(eco)
    shuffle(moral)

  2. I then used the stimuli conditionsfile to only indicate the type of stimuli it should use (in your case verbal fluency task)

  3. I used a code component and the pop function to get stimuli from the respective lists in each trial (the pop function made sure that stimuli did not repeat).
    if stimtype == ‘eco’:
    thisCondition = eco.pop()
    thisAns = ecoRecomANS.pop()
    elif stimtype == ‘moral’:
    thisCondition = moral.pop()
    thisAns = moralRecomANS.pop()
    else:
    thisCondition = ‘undefined’
    thisAns = 999

thisExp.addData(‘StimText’,thisCondition[‘StimText’])
thisExp.addData(‘Classification’,thisCondition[‘Classification’])
thisExp.addData(‘StimTextNR’,thisCondition[‘StimTextNR’])
thisExp.addData(‘ClassificationNR’,thisCondition[‘ClassificationNR’])
thisExp.addData(‘thisAns’, thisAns)

Hope this helps.