I posted on the forum a few months ago with a feasibility question regarding whether or not the trickiest element of my experiment was possible to programme in builder and I’m now ready to tackle that element…
At the beginning of my experiment participants will rate foods based on how much they like them. I then want to allocate these foods to the conditions of the task based on the ratings, i.e. the foods with ratings between x and y go to condition 1 and the foods with the ratings between a and b go to condition 2 (unfortunately it can’t just be min and max ratings).
At the moment I can’t find any examples of anyone who has done this previously so I’d be very grateful if anyone could point me towards any documentation that might assist me.
Hi @jemmasedgmond, if you had the results of the ratings by condition output into a spreadsheet, how would the data be stored and presented? For example, would you have a single column for all foods, and another column for the condition, or would you have two columns, one for each condition, and the food populating each row of the column?
Sorry if I’ve misunderstood, but I wouldn’t have a column for the conditions as they wouldn’t have been assigned at that point. I can provide more information if that helps.
At the beginning of the experiment, participants will rate 24 healthy and 24 unhealthy foods. These ratings will be stored in 2 separate columns.
In the experiment there are 2 conditions or trial types; stop and go. I would like to assign 4 healthy foods with ratings between X and X to the go trials, and 4 unhealthy foods with ratings between X and X to the stop trials.
In addition to the 4 unhealthy and 4 healthy foods, each food also has an additional 3 exemplars that I would like to be included. E.g if ‘h1a’ was selected for the go trials, I would also like to assign the corresponding exemplars h1b, h1c and h1d.
Ok good. I was asking about the file because we can create a new conditions file based on the ratings, and the new conditions file can be used in the following loop. So you have your block of ratings, followed by a block of stop go trials? Also, will this task be run online?
A different plan is needed to run it online. I had planned to create a new conditions file, but thats not as easy online, but this works. In the example attached, I use words presented on screen for the stimuli, where h1a and h2a are healthy foods, u1a etc are unhealthy foods.
foodRatings routine and trials loop
The food words are stored in a conditions file called foods.xlsx. Each food is presented using a text component and the ratings are collected using a Slider, with categories for good and bad. In a code component, there are two variables created in the Begin Experiment tab. The foodChoices variable contains two sets of lists, one for healthy food and one for unhealthy food. The exemplars variable contains the list of exemplars, these will have to be typed in by you. Good foods are added to the healthy category, along with exemplars, and bad foods are added to the unhealthy category, along with exemplars. Exemplars are filtered by matching the first two characters of a food e.g., h1 to all exemplars starting with h1. Each time a food is added to the foodConditions container, each list is shuffled for randomisation.
stopGo and trials_2
This routine presents the words rated as good or bad, along with their exemplars, that were stored in foodCondtions. The loop has a template conditions file called stopGo, that has keys (either “h” or “u”) to access the healthy or unhealthy food choices in foodConditions. The order of healthy and unhealthy is randomised via the loop. Press space for go on this routine. This loop only runs for 1 block, if you want more, just change the nReps value in Trials_2 to your number of blocks required.
Things to do
Decide what makes a stop and go trial, and add an extra column to the stopGo conditions file, to help calculate error rates. The extra column will containspace for each go trial, or whatever the correct response should be.
Add instructions
Here are the example files to run, and the URL to see it running online.
This is so helpful - thank you!
I’m unable to run the pavlovia link ( * TypeError: Cannot read property ‘readPixels’ of undefined), but this is great for me to be getting on with.
No problem. Are you running the task from a Linux box? Also, which browser (and version) are you using? Do you get the same error with Chrome and FireFox?
Hi @Shardul_Shankar, I think it relates to PsychoPys version folder on your system, it is trying to run 3.2.0 but has been unable to download this from git. If you go experiment settings, what is the version in the “use version” dropdown?
I am sorry to bother you again. I have done what you asked me to do, but now all the previous experiments that I created have stopped working. Even the ones that were running previously. I have created a separate query if you want to see the errors.
P.S.: This is how my experiment setting looks like:
I’ve been trying to wrap my head around the stimulus selection based on ratings and I’m getting there but unfortunately the script isn’t running for me and I think that might help me understand better.
I’m getting the following error:
File “/Users/jemma/OneDrive - Cardiff University/PhD/Chapter4_Hybrid/Study1 - Explicit Attitudes/Programming_Psychopy/Hybrid/StimulusSelection/foodRating_lastrun.py”, line 74, in
units=‘height’)
File “/Users/jemma/.psychopy3/versions/psychopy/visual/window.py”, line 490, in init
self.lastFrameT = core.getTime()
File “/Users/jemma/.psychopy3/versions/psychopy/core.py”, line 69, in getTime
return monotonicClock.getTime(applyZero)
TypeError: getTime() takes 1 positional argument but 2 were given
Hi @jemmasedgmond, this relates to a recent update to PsychoPy to allow better timing, and one of your scripts may not contain those changes. Are you running your task from Coder? If so, try rerunning from Builder.