Hi all,
I am trying to present a movie with a concurrent rating scale. The code is working, but it flickers terrribly. I am using MovieStim2 and a standard rating scale.
The critical thing happens here (see below for full code):
mov.draw()
ratingScale.draw()
win.flip()
I don’t fully understand the techincal details of movies & python. When I change the code to present only the movie, not the ratingscale, it runs smooth - so it seems the two displays interact to cause trouble. Similarly, when I use the old movieStim in combination with ratingscale, the movie display is smoother, but then ‘stutters’ (i.e. is smooth for a while, but jumps abruptly).
Any help would be greatly appreciated.
Best, Ralf.
from psychopy import visual, core, event
from psychopy import visual, os, core, gui, event, logging, microphone, data, sound
import numpy as np
useFullScreen = False
videoPath= ‘01.mov’
globalClock = core.Clock()
localClock = core.Clock()
secondClock = core.Clock()
################
win = visual.Window([800,600], #1080,762], #[800,600], ###1920,1080],
monitor=“testMonitor”,
fullscr=useFullScreen,
units=“deg”,
waitBlanking=False)#,
#rgb=(-0.8,-08,-0.8))mov = visual.MovieStim2(win, videoPath,
size = (800, 600) , #800,600), #size=(960,540),
pos=[0, 0],
flipVert=False,
flipHoriz=False,
loop=False)
ratingScale = visual.RatingScale(
win,
low=1, high=7,
markerStart=4,
leftKeys=‘z’, rightKeys = ‘m’,
singleClick=False,
showAccept=False,
noMouse=True,
pos = (0.0, -0.7) )
############################
def play_movie(fileName, movieLength):
vals =
#mov._reset() mov.loadMovie(fileName) mov._createAudioStream() localClock.reset() mov_length = mov.duration start_time = localClock.getTime() mov.play() while localClock.getTime() < movieLength: secondvals = [] while secondClock.getTime() < 1: mov.draw() ratingScale.draw() win.flip() rating = ratingScale.getRating() secondvals.append(rating) if event.getKeys(['escape']): # this is to be able to interrupt win.close() core.quit() vals.append(np.mean(secondvals)) secondClock.reset() mov.stop() #logging.flush() return vals
RUN
vals = play_movie(‘01.mov’, 30)
print(vals)
core.quit()