Selecting rows from stimuli based on data in one of the columns

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

I’m creating a think/no-think experiment where stimuli is randomised. I have tried following tutorials to get it randomised in PsychoPy but as i have no knowledge of python I’ve not been able to get this done.

I was wondering if its possible, when importing stimuli into a loop to randomly select rows based on the contents of one of their columns.

In one of the phases i need it to only select some rows based on a condition and dont know how to do it in code so was wondering if it was possible just in the ‘selected rows’ section?

I hope someone can understand what im saying because i feel like im talking nonsense!
Many thanks,
Gemma

Do you mean, for example, selecting the first 50 rows if the participant is in condition 1 and the second 50 for condition 2?

useRows = '50:100'
if expInfo['condition'] == '1':
     useRows = '0:50'


Hi,

Thank you so much for your quick response!
I should have explained better and added photos.

I would like to try and only include the stimuli (which is taken from the ‘word 1’ column) in the loop if it has a ‘1’ in the ‘include’ column.

I’m open for changing how I set this up but I thought it would be easiest to do in the ‘selected rows’ section - think I might be incorrect though.

Many thanks,

Gemma Hemens

1 Like