psychopy.org | Reference | Downloads | Github

Pull stimuli from three columns of a spreadsheet

Hello! I’m running an experiment where I need to counterbalance a list of words. I need to have a test phase that includes old words (presented during an earlier study phase), new words (that they have not yet seen) and a list of conjunction words (which are words like baseball, basement, eyeball, and so on).

I have set up an excel spreadsheet that has 6 different counterbalanced conditions, but I’m not sure how to have psychopy pull from three columns of a spreadsheet (each condition would need to pull from the columns “old”, “new”, and “conjunction”). Is this something that can be done in builder? Or is it something I can do with some written code? I’m not super efficient with writing python code, but I have some general knowledge.

I assume you mean independent randomisation of the three columns, since taking from the same row for each column is trivial.

Have a look at my independent randomisation demo. I preload one column into a list,

Hi, yes, I would be randomly pulling from the three columns. I have it set up as three different rows because I want to have the data output file keep them organized into the three types of stimuli they are (old, new, and conjunction). If you have any ideas or suggestions that would be helpful!

If you preload your stimuli into three lists you can shuffle each list independently and then use thisOld = old.pop() thisNew = new.pop() thisConjunction = conjunction.pop() in your main trials loop to select the stimuli. Then save them using

thisExp.addData('Old',thisOld)
thisExp.addData('New',thisNew)
thisExp.addData('Conjunction',thisConjunction)

Hi! Thank you for this! I’m unsure of what you mean exactly though. Would you mind explaining how I would input this into the trials loop? And when you say old.pop and new.pop is that the column headers would be in the excel sheet?

Thank you again for helping me with this!