Hi, I’m trying to make a standard stop signal task with Builder view.
But the thinig is, unlike normal stop signal task, there should be no consecutive ‘stop’ trials in my experiments. Consecutive go trials are fine to happen.
This is my condition file. So the signal column really matters. The number of total trials is 150.
I want to have fullrandom (or pseudo-random) list of trials without any consecutive signal trials.
The original experiment used condition file with loop(not necessary since I can easily make excel file with 150 rows), but it seems bit annoying for builder to make more advanced trail randomization.
I tried to follow this link here: https://discourse.psychopy.org/t/randomisation-without-consecutive-presentations/8089
stimulus_list = ['v', 'b', 'n', 'm'] * 3
shuffle(stimulus_list)
# make sure the same target doesn't appear on consecutive trials
double_stim = False
list_ok = False
while list_ok == False:
for i in range(len(stimulus_list) - 1):
# check for equal neighbours:
if stimulus_list[i] == stimulus_list[i + 1]:
double_stim = True # D'oh!
break # can stop checking on this run
if double_stim == True:
shuffle(stimulus_list) # try a new order
double_stim = False
else:
list_ok = True # Yay! The loop won't run again.
print(stimulus_list)
Code here looks simple except for the meaning of variable ‘stimulus_list’.
The comment says I can add the code in the Begin Experiment tap,
but because I don’t know what stimulus_list means I cannot manipulate it.
expInfo = {‘participant’: ‘YWH’, ‘session’: ‘001’, ‘initialSSD’: ‘0.200’}
organize them with the trial handler
trials = data.TrialHandler(nReps=1, method=‘random’,
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions(‘realTrialConditions.xlsx’),
seed=None, name=‘realTrials’)listOk = False
double = 0while not listOk:
for thisTrial in trials:
print(str(trials.thisTrial[‘signal’]) + ’ ’ + str(trials.thisIndex))if (trials.thisIndex % 5 == 4): double += 1 else: double = 0 if double == 2: trials = data.TrialHandler(nReps=1, method='random', extraInfo=expInfo, originPath=-1, trialList=data.importConditions('realTrialConditions.xlsx'), seed=None, name='realTrials') double = 0 else: listOk = True
print(‘end’)
This is the code I tried to manage in Coder view format. I have no idea… what I should do to ‘shuffle’ the order of the trials variable? Only if anyone can provide good advice for it, things will be solved easily I guess. (I’m not familiar with the interface in the forum here, so don’t consider about indents because there’s no problem about it in my program!)
Thank you for your help! I’ll attach the program I built.
blocksSST.xlsx (9.7 KB) goOnlyConditions.xlsx (10.7 KB) realTrialConditions.xlsx (13.7 KB) SST_Finger.psyexp (27.9 KB) SST_Finger.py (30.8 KB)