I have tried indexing it through: image = shapeValues[retrievalShape[0]] but it throws an indexing error (shapeValues being the array of original stimuli).
Any suggestions on what I could try?
Cheers everyone!
The code is in the Each Frame tab as it would refresh to a new image on each iteration of the component - would you suggest to put it in the Begin Routine tab?
Yes I would like to use one value from it - I have tried random.choice() to select from the array but that does not seem to work. Any suggestions?
In terms of the loop, I was hoping that it would randomise the order of storedShapes and assign to a new array randShapes. I have tried simply:
Please could you clarify what exactly you are wanting to achieve?
Could you have an image component with the image set to $storedShapes[0] every repeat?
where in code you shuffle storedShapes?
Where do the six storedShapes come from? Why do you need to check the image attribute of each stimulus rather than using whatever text or variable you are using to set the stimuli?
During the encoding phase, 6 shapes are randomly displayed from an array of 360 shapes. Each shape will be randomly assigned a colour from 360 CIELa*b colours, and the stimuli will be displayed on a imaginary circle. In the retrieval phase, the participant will be displayed either the colour, shape or location as a cue and will have to respond to the corresponding colour/shape/location by means of a colour wheel, shape wheel or location wheel, respectively.
In terms of the retrieval image, I would like it to be one of the 6 displayed images but in order to display the image, I would need to store the information of the presented stimuli (which I have done in the End Routine tab of the encoding phase).
I can share my experiment with you, if that helps at all?
The original 360 shapes are in a coded array.
The experiment is coded for local debugging at the moment, but I would like it to eventually run online through Pavlovia.
Here is the link to my git: GitHub - dtgoldenhausmanning/Experiment-1. You will find a copy of my experiment, along with a zip file of my stimuli and a figure of the experimental procedure.
Your experiment needs a fair amount of attention. I just had a look at encoding_code and found the following in Each Frame. It might get totally ignored because there are no components in that routine.
from numpy.random import rand, shuffle
import math as math
import psychopy.tools.colorspacetools as cst
from psychopy import core, visual
cielabColor = (70, 20, 38) # CIE*L*a*b colour space
rgbColor=cst.cielab2rgb(cielabColor)
win = visual.Window([1000, 1000],
monitor="testMonitor", color=[0.168,0.168,0.168])
print("FRAME")
# locations of the stimuli
distFromFix = 6
stim1POS = [0, 0.4]
stim2POS = [0, -0.4]
stim3POS = [0.4, 0.2]
stim4POS = [-0.4, 0.2]
stim5POS = [-0.4, -0.2]
stim6POS = [0.4, -0.2]
colorTrials, shapeTrials, locationTrials = generate_stimuli(set_size)
#print(colorTrials)
#print(shapeTrials)
#print(locationTrials)
# encoding stimuli parameters
stimulus1 = visual.ImageStim(win, image = shapeValues[shapeTrials[0]])
stimulus1.colorSpace = "rgb"
stimulus1.color = [x / 255 for x in colorValues[colorTrials[0]]]
stimulus1.size = 0.3
stimulus1.pos = stim1POS
print(stimulus1.color)
stimulus2 = visual.ImageStim(win, image = shapeValues[shapeTrials[1]])
stimulus1.colorSpace = "rgb"
stimulus2.color = [x / 255 for x in colorValues[colorTrials[1]]]
stimulus2.size = 0.3
stimulus2.pos = stim2POS
stimulus3 = visual.ImageStim(win, image = shapeValues[shapeTrials[2]])
stimulus1.colorSpace = "rgb"
stimulus3.color = [x / 255 for x in colorValues[colorTrials[2]]]
stimulus3.size = 0.3
stimulus3.pos = stim3POS
stimulus4 = visual.ImageStim(win, image = shapeValues[shapeTrials[3]])
stimulus1.colorSpace = "rgb"
stimulus4.color = [x / 255 for x in colorValues[colorTrials[3]]]
stimulus4.size = 0.3
stimulus4.pos = stim4POS
stimulus5 = visual.ImageStim(win, image = shapeValues[shapeTrials[4]])
stimulus1.colorSpace = "rgb"
stimulus5.color = [x / 255 for x in colorValues[colorTrials[4]]]
stimulus5.size = 0.3
stimulus5.pos = stim5POS
stimulus6 = visual.ImageStim(win, image = shapeValues[shapeTrials[5]])
stimulus1.colorSpace = "rgb"
stimulus6.color = [x / 255 for x in colorValues[colorTrials[5]]]
stimulus6.size = 0.3
stimulus6.pos = stim6POS
stimulus1.draw()
stimulus2.draw()
stimulus3.draw()
stimulus4.draw()
stimulus5.draw()
stimulus6.draw()
core.wait(1.0, hogCPUperiod=0.2)
win.flip()
core.wait and win.flip are not code that should appear in Builder based experiments at all.
What I do for a routines where I want a duration but don’t have any non-code components is add a text box displaying a single space either for the desired duration or without a duration if I want to end the routine in code.
In theory I think that you might be able to use wait and flip if you only put code into Begin Routine and have no other components.