Selecting stimuli based on ratings

Thank you for the response @dvbridges.

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.

Does that make sense?

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?

Ah I see!
Yes that’s correct, the ratings followed by several blocks containing both stop and go trials and the goal is to run it 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.

https://run.pavlovia.org/dvbridges/foodratings/html/

foodRating.psyexp (15.2 KB)
foods.xlsx (7.8 KB)
stopGo.xlsx (7.8 KB)

1 Like

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?

I was running it from a windows PC while I was in work on Chrome, but I’ve just tried to run it on my mac using chrome and it works!

Hi @dvbridges,

I was running your experiment you gave here on builder and encountered these problems:

Traceback (most recent call last):
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py”, line 2313, in compileScript
self.generateScript(fullPath)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py”, line 2348, in generateScript
out = subprocess.check_output(cmd)
File “C:\Program Files (x86)\PsychoPy3\lib\subprocess.py”, line 336, in check_output
**kwargs).stdout
File “C:\Program Files (x86)\PsychoPy3\lib\subprocess.py”, line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘[‘C:\Program Files (x86)\PsychoPy3\pythonw.exe’, ‘-m’, ‘psychopy.scripts.psyexpCompile’, ‘D:\PsychoPy3 Demos\foodRating.psyexp’, ‘-o’, ‘D:\PsychoPy3 Demos\foodRating.py’, ‘-v’, ‘3.2.0’]’ returned non-zero exit status 120.

Why am I getting compiling and run errors? I am running it on Chrome on Win10.

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?

Hi @dvbridges,

The version is v3.1.3. I think I would have to update it to the latest version for running it, isn’t it?

Try setting it to blank, and see if the error occurs.

Ok. I’ll do it tomorrow and get back to you. Thanks again for your help.

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:
image

Hi @dvbridges

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

Is this easy to resolve?

Many thanks

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.

Sorry I said scripts but I only ever use builder.
I’m running version 3.1.2

@jemmasedgmond in your experiment settings what is useVersion set to?

@jon It’s set to latest.

Could you try setting it to the blank entry?

That’s worked perfectly! Thank you.