Image selection based on response rates

Hello, I am working on a task on Windows 10 using v.2021.2.3
The goal seems pretty simple - the task is a little long, (1 1/2 hours), so we have periodic breaks. Currently, I have the code set up to give breaks after every 72 trials. During these breaks, I provide feedback to the participants on how well they are doing. Right now, I just have the number of answers they’ve gotten correct out of the total number of trials for that block, (e.g., 68 / 72 correct). I also want to add an image that is a face that is smiling if they are doing better than 80% accuracy or frowning if they are doing worse than 80% accuracy. I already have a ‘counter’ going, where my variable ‘num_corr_sec’ totals how many trials they have gotten correct for that block.

The only idea I had so far was to add both images to the feedback section, and set their opacity to zero. Above that, I added a code that does this:
if num_corr_sec >=58:
Face1st.opacity = 1
elif num_corr_sec <58:
Face5th.opacity = 1

where Face1st is the ‘happy face’ and Face5th is the ‘sad face’. Although there were no errors in the code, neither of the faces appeared, regardless of how well I did. I figure I probably need a different approach - what can I do instead?

Are you writing inside Each Frame?

Would you like to share your experiment here for me to check?

Here is what the entire feedback (“rest”) period looks like,

here is the code at the top that is designated for changing the opacity of the faces.

Let me know if there is anything else I can show you that would be helpful! thank you!

The code looks like it should be in Begin Routine of the feedback routine. Please could you show the code that controls the variables mentioned?

here’s the direct code for those face1st and face5th variables:

Face1st_p = visual.ImageStim(
win=win,
name=‘Face1st_p’,
image=“stimuli/react_feedback/1st”, mask=None,
ori=0.0, pos=(0, 0), size=(0.5, 0.5),
color=[1,1,1], colorSpace=‘rgb’, opacity=None,
flipHoriz=False, flipVert=False,
texRes=128.0, interpolate=True, depth=-5.0)
Face5th_p = visual.ImageStim(
win=win,
name=‘Face5th_p’,
image=“stimuli/react_feedback/5th”, mask=None,
ori=0.0, pos=(0, 0), size=(0.5, 0.5),
color=[1,1,1], colorSpace=‘rgb’, opacity=1.0,
flipHoriz=False, flipVert=False,
texRes=128.0, interpolate=True, depth=-6.0)

Although I’m not sure why the opacity look different, as I set them up identically. Here’s screenshots from the builder:

image

image

Also, here is the code for the ‘counter’ - that keeps track of the number of correct responses (It only let me uploaded 2 images at a time, apologies for the double message):


(the top part is for initially setting up each variable of interest, the bottom part is where I reset the count for each block)

and here is the code that updates the # of correct counts for each correct response. I know this part works, since I display this at each feedback rest period, and that is working fine.

Just to note, I tried moving the first code I presented to the ‘Begin Routine’ section, and it was not showing up still. (here I am referring to the following code)
if num_corr_sec >=58:
Face1st.opacity = 1
elif num_corr_sec <58:
Face5th.opacity = 1

Hopefully I covered everything here but do let me know what other info you might need! thanks in advance!

If you reset the opacity to 0 every frame it will never be visible. Either set it to 0 constant or a variable every frame.

y’know that makes perfect sense… working great now. Thank you for your time and assistance!