Hello,
I’m trying to figure out how to use the warper object and I’m currently facing an issue running this piece of code:
from psychopy import visual, monitors, event
from psychopy.visual.windowwarp import Warper
warp = True
mon = monitors.Monitor('tryMonitor')
mon.setDistance(20)
stimWin = visual.Window(
[1920,1200],screen = 0,fullscr = True,
monitor = mon, units = 'degFlat',
useFBO = True,
allowStencil = True,
)
monitorWidthDeg = 104.8
gratingBack = visual.GratingStim(
stimWin,tex = 'sqr', mask = None, units = 'degFlat',
maskParams = None, pos = (0.0, 0.0),
size = [monitorWidthDeg, 10],
sf = 1,
ori = 0.0, phase = (0.0, 0.0), texRes = 128,contrast = 0.9,
opacity = 1.0,autoDraw = False
)
if warp:
warper = Warper(
stimWin,
warp = 'spherical',
warpGridsize = 300,
eyepoint = [0.5, 0.5]
)
warper.dist_cm = 20
warper.changeProjection('spherical')
keepGoing = True
event.clearEvents('keyboard')
while keepGoing:
if len(event.getKeys(keyList=('escape','q'))) > 0:
event.clearEvents('keyboard')
keepGoing = False
break
gratingBack.draw()
stimWin.flip()
I know my monitor width in degrees, and I can confirm it because, by not using the warper, I generate a stimulus like this one:
Moreover, i know the width is correct because if I reduce the size of the grating to 99% the original size, I get this stimulus:
However, when applying the warper, the size of the warped stimulus is extended beyond the limits of my screen. Now I need to downscale the size of the grating to 80% to be able to see the entire stimulus:
This raises a problem: If you specify the position or the size of a stimulus in degrees, its actual position on the monitor is not physically accurate anymore after the warping. Am I missing something or is this the expected behavior?
is it correct to set the units to degFlat in this instance?