OS: Windows 11
PsychoPy version v2023.2.3
Standard Standalone? (y/n) Y
What are you trying to achieve?:
My experiment ran smoothly, and I was happy until I noticed repeats. It’s a little complicated, but it involves making many decisions, and then it randomly breaks into an ‘execution trial’, meaning it picks one of the rows (and thereby a text) to display. The reason it is complicated is that it involves assigning an Excel sheet based on ExpInfo and then selecting rows based on their choices.
if R_Level < 8:
groupFile = ‘below.xlsx’
elif R_Level > 9:
groupFile = ‘above.xlsx’
else:
groupFile = ‘same.xlsx’
if Effort.contains(mouse) or Reward1_2.contains(mouse):
Comb_list = [1, 1]
Reject += 1
elif image_7.contains(mouse) or image_8.contains(mouse):
Comb_list = [RewardLevel, EffortLevel]
Accept += 1
if Comb_list:
all_selections = [‘0:9’, ‘10:19’, ‘20:29’, ‘30:39’, ‘40:49’, ‘50:58’]
rl = ‘t’ + str(Comb_list[0]) + ‘.jpeg’
el = ‘b’ + str(Comb_list[1]) + ‘.jpeg’
selected_rows_range = all_selections[Comb_list[1] - 1]
I have figured out how to do this with the help of this community. However, no matter what i do, repeats are still happening.
it involves 3 loops, 1 outer loop and 2 inner loops.
What did you try to make it work?:
- Searched and tried multiple ways of fixing through this forum, even took suggestions from AI
- made the outer loop sequential (it was original random too).
- Tried creating a new column in all the excel sheets, which assigns a unique number to each row/text (called TextNum). And then adding in code, which stores used_TextNums and then if repeats happen (by comparing current TextNum to used_textNum), it replaces it with a new row/TextNum (selected_textNum)
- Tried purely doing it via selected rows, and saying if this row repeats, then find a new row.
What specifically went wrong when you tried that?:
There were no errors messages. It did it’s job, but repeats happened basically and then excel sheet indicated it wasn’t working.
I have now gone back to basic and my old code. I was wondering if anyone has unique solutions or some ways of fixing this or any suggestions (no matter how simple)? Perhaps something else is causing this issue? Please let me know if you want any more information. I didn’t want to make this too long.