Taking advice and suggestions from Wakefield's Daily Tips - #4 by wakecarter and Wakefield's Daily Tips - #23 by wakecarter, I’ve tried changing my approach, but now I have a different question (but the same problem - repeating rows). [see original post here - Randomization problem: No error message, yet still repeating rows no matter what i do]
Why do you think it is not registering my items in the list as ‘single items’? It seems to be taking the whole list, and when printing, it doesn’t print the selected row (for the execution trial), instead just the whole range. What can I do to fix it? Is this the reason I am having the issue of using these techniques to prevent repeated rows? Similarly, when I used lists and .pop(), it also had an error.
I changed all the selections from - 0:10, 10:20 etc to the below.
all_selections = [
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
[20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
[30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],
[40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],
[50, 51, 52, 53, 54, 55, 56, 57, 58, 59]
]
And then kept everything the same. This worked sometimes, and yet others I would have a repeat. (I have examples of output if people are interested). For instance, my print statement for this was [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].
# Generate file names based on Comb_list
rl = 't' + str(Comb_list[0]) + '.jpeg'
el = 'b' + str(Comb_list[1]) + '.jpeg'
selected_rows = all_selections[Comb_list[1] - 1]
So then I thought perhaps I should try shuffling the list? While the order was randomised (for example, 8, 3, 6, 2, 9, 1, 0, 10, 7, 4, 5]. It did not fix my problem; honestly, it increased the repeats.
shuffle(selected_row)
I then thought okay, let’s try what this suggested.
selected_range = all_selections[Comb_list[1] - 1]
selected_row_range = shuffle(selected_range)
selected_rows = selected_row_range.pop()
Sadly, this did not work at all. It caused Psychopy to crash without any error and then said there was an attribute error with pop being a nontype.
selected_rows = selected_row_range.pop()
AttributeError: ‘NoneType’ object has no attribute ‘pop’