Sorry to resurrect this - but I’m trying to do something similar using these commands. I’m trying to make sure that the total luminance of my window and stimuli are not varying as I randomise the phase of a blurred grating. So I just need the RGB values of all pixels in the frame, not specific x,y coords.
When I use the above code, I only get the RGB values of the grey background (128, 128, 128), with no values for my grating. I’ve attached some simplified code below which is giving me the same issue. Would you be happy to let me know if I’m doing something obviously wrong here?
Edit: I’m on psychopy 3.0.7
from psychopy import visual, core, data, event, gui, monitors, sound
import numpy as np
win = visual.Window(fullscr=True, screen=0,
monitor='HP_Elitebook', color=[0,0,0], colorSpace='rgb', useFBO=True, units='pix')
stim = visual.PatchStim(win, units='norm', size=(0.2, 0.5))
mouse = event.Mouse(win=win, visible = True) # set up mouse object
pixels = win._getFrame() # Gets image of window
pixels = np.array(pixels) # Convert image to numpy array, but shape suggests x, y are reversed into y, x