I am using Windows 10; PsychoPy version: 3; Python version 3.
My experiment has 2 conditions represented by 2 colors- red and green. I want to display a change of color from 0 saturation to 1 (full saturation) within a duration of 3 seconds. This is why I am using HSV format.
I have tried to modify the code earlier posted in this forum (please follow link here)
Since I am new with Python and PsychoPy, I tried using the build version first and then working on the script generated by it.
This is how my script looks like where I tried to implement the change of colour.
(Imager- assigning the colour in np.array; but the main color pointer is indicated in the excel file called conditions, where it gets the input for the colour according to the conditions)
angleStart = 3/2 * np.pi
angleStop = 2 * np.pi
angleStepNum = 100
angles = np.linspace(angleStart, angleStop, num=angleStepNum)
Imagery = visual.Polygon(
edges=1000, size=(0.1, 0.1),
ori=0, pos=(0, 0),
lineWidth=0.3, lineColor=[1,1,1], lineColorSpace=‘rgb’,
fillColor= Imager, fillColorSpace=‘hsv’,
opacity=1, depth=-2.0, interpolate=True)
for angle in angles:
#for frame in range(nFrames):
Imager = [Imager,np.cos(angle),Imager]
The script is running perfectly with no error. However, in this particular window it takes the colour values (i.e. Imager) directly from the excel sheet instead of changing the saturation level. It appears that the script is not taking the loop into consideration.
Also, I have not taken the time into consideration yet. Any suggestions regarding that would also be nice.
Any help from the forum will be extremely helpful.
Thanks in advance,
University of Geneva