Match mean screen luminance to mean luminance of stimuli drawn

I have a simple experiment built in the coder in psychopy - where I’m presenting garbor patches with different shapes ( eg. circle, square, etc) on a gray background/screen.
I need to find a way to obtain the mean luminance of my backgroud screen (window) , specified below, and also the mean luminance of my stimuli being drawn in the screen. All this so I can ultimately change or match the luminance of the background screen with that of the stimuli.
Hopefully my problem makes sense, I’m a little stuck as to where to start. Any help/suggestions greatly appreciated!

#Gray window
win = visual.Window(size=(1680, 1050), fullscr=False, screen=0, allowGUI=False, allowStencil=False,
monitor=‘G89’, color=[0.3,0.3,0.3], colorSpace=‘rgb’, units=‘deg’)

#Garbor Patch stimuli example
myGratingLeft= visual.GratingStim(win, tex=‘sin’, sf=[0.03,0], texRes=256, mask= polyShapeLeft, units=‘pix’,contrast= 0.5, size=masksizeLeft, pos=[-1.7, 0])

Luminance is a physical measure and at the end of the day, you strictly need a physical measurement with a photometer to verify this stuff. But hopefully this material by Jon is useful:

http://www.psychopy.org/recipes/isoluminance.html

Hello,

I am also trying to match the mean luminace of background with that of stimuli. Have you figured out how to do that? I would really apprecaite if you have any suggestions.

Best,
Xin

I didn’t figure it out, sorry. Good luck!

PsychoPy’s grating colors are designed to balance around the mean grey, so I think you do not need to worry about this problem. However, I used a black background so I am really concerned about it. Otherwise, my subjects will respond to brightness instead of Gabor with cetain spatial frequency. Anyway, thank you all the same!

It’s impossible if you are using a uniform black background since the mean luminance is zero.

Bumping this up again. Did anyone figure out how to equate background luminance with stimulus luminance?

Just wanted to say that I found a solution for this. I just gamma-calibrated my monitor using a PR655 photometer, then used DKL color space to modulate the luminance axis (keeping stimuli and background at constant luminance levels).