本文整理汇总了Python中psychopy.clock.Clock类的典型用法代码示例。如果您正苦于以下问题:Python Clock类的具体用法?Python Clock怎么用?Python Clock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Clock类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _reset
def _reset(self):
self.duration = None
self.status = NOT_STARTED
self._numpy_frame = None
if self._texID is not None:
GL.glDeleteTextures(1, self._texID)
self._texID = None
# self._video_stream = None
self._total_frame_count = None
self._video_width = None
self._video_height = None
# TODO: Read depth from video source
self._video_frame_depth = 3
self._video_frame_rate = None
self._inter_frame_interval = None
self._prev_frame_sec = None
self._next_frame_sec = None
self._next_frame_index = None
self._prev_frame_index = None
self._video_perc_done = None
# self._last_video_flip_time = None
self._next_frame_displayed = False
self._video_track_clock = Clock()
self._audio_stream_clock = Clock()
self._vlc_instance = None
self._audio_stream = None
self._audio_stream_player = None
self._audio_stream_started = False
self._audio_stream_event_manager = None
开发者ID:RalRal,项目名称:psychopy,代码行数:30,代码来源:movie2.py
示例2: _reset
def _reset(self):
self.duration = None
self.status = NOT_STARTED
self._numpy_frame = None
self._frame_texture = None
self._frame_data_interface = None
self._video_stream = None
self._total_frame_count = None
self._video_width = None
self._video_height = None
# TODO: Read depth from video source
self._video_frame_depth = 3
self._video_frame_rate = None
self._inter_frame_interval = None
self._prev_frame_sec = None
self._next_frame_sec = None
self._next_frame_index = None
self._prev_frame_index = None
self._video_perc_done = None
self._last_video_flip_time = None
self._next_frame_displayed = False
self._video_track_clock = Clock()
self._vlc_instance = None
self._audio_stream = None
self._audio_stream_player = None
self._audio_stream_started = False
self._audio_stream_event_manager=None
self._last_audio_callback_time = core.getTime()
self._last_audio_stream_time = None
self._first_audio_callback_time = None
self._audio_computer_time_drift = None
开发者ID:9173860,项目名称:psychopy,代码行数:31,代码来源:movie2.py
示例3: __init__
def __init__(self, win,
filename="",
units='pix',
size=None,
pos=(0.0,0.0),
ori=0.0,
flipVert=False,
flipHoriz=False,
color=(1.0,1.0,1.0),
colorSpace='rgb',
opacity=1.0,
volume=1.0,
name='',
loop=False,
autoLog=True,
depth=0.0,
noAudio=False,
vframe_callback=None,
fps=None,
interpolate = True,
):
"""
:Parameters:
filename :
a string giving the relative or absolute path to the movie.
flipVert : True or *False*
If True then the movie will be top-bottom flipped
flipHoriz : True or *False*
If True then the movie will be right-left flipped
volume :
The nominal level is 100, and 0 is silence.
loop : bool, optional
Whether to start the movie over from the beginning if draw is
called and the movie is done.
"""
# what local vars are defined (these are the init params) for use
# by __repr__
self._initParams = dir()
self._initParams.remove('self')
super(MovieStim3, self).__init__(win, units=units, name=name,
autoLog=False)
retraceRate = win._monitorFrameRate
if retraceRate is None:
retraceRate = win.getActualFrameRate()
if retraceRate is None:
logging.warning("FrameRate could not be supplied by psychopy; defaulting to 60.0")
retraceRate = 60.0
self._retraceInterval = 1.0/retraceRate
self.filename = filename
self.loop = loop
self.flipVert = flipVert
self.flipHoriz = flipHoriz
self.pos = numpy.asarray(pos, float)
self.depth = depth
self.opacity = float(opacity)
self.interpolate = interpolate
self.noAudio = noAudio
self._audioStream = None
self.useTexSubImage2D = True
self._videoClock = Clock()
self.loadMovie(self.filename)
self.setVolume(volume)
self.nDroppedFrames = 0
#size
if size is None:
self.size = numpy.array([self._mov.w, self._mov.h],
float)
else:
self.size = val2array(size)
self.ori = ori
self._updateVertices()
#set autoLog (now that params have been initialised)
self.autoLog = autoLog
if autoLog:
logging.exp("Created %s = %s" %(self.name, str(self)))
开发者ID:papr,项目名称:psychopy,代码行数:80,代码来源:movie3.py
示例4: MovieStim3
class MovieStim3(BaseVisualStim, ContainerMixin):
"""A stimulus class for playing movies (mpeg, avi, etc...) in PsychoPy
that does not require avbin. Instead it requires the cv2 python package
for OpenCV. The VLC media player also needs to be installed on the
psychopy computer.
**Example**::
See Movie2Stim.py for demo.
"""
def __init__(self, win,
filename="",
units='pix',
size=None,
pos=(0.0,0.0),
ori=0.0,
flipVert=False,
flipHoriz=False,
color=(1.0,1.0,1.0),
colorSpace='rgb',
opacity=1.0,
volume=1.0,
name='',
loop=False,
autoLog=True,
depth=0.0,
noAudio=False,
vframe_callback=None,
fps=None,
interpolate = True,
):
"""
:Parameters:
filename :
a string giving the relative or absolute path to the movie.
flipVert : True or *False*
If True then the movie will be top-bottom flipped
flipHoriz : True or *False*
If True then the movie will be right-left flipped
volume :
The nominal level is 100, and 0 is silence.
loop : bool, optional
Whether to start the movie over from the beginning if draw is
called and the movie is done.
"""
# what local vars are defined (these are the init params) for use
# by __repr__
self._initParams = dir()
self._initParams.remove('self')
super(MovieStim3, self).__init__(win, units=units, name=name,
autoLog=False)
retraceRate = win._monitorFrameRate
if retraceRate is None:
retraceRate = win.getActualFrameRate()
if retraceRate is None:
logging.warning("FrameRate could not be supplied by psychopy; defaulting to 60.0")
retraceRate = 60.0
self._retraceInterval = 1.0/retraceRate
self.filename = filename
self.loop = loop
self.flipVert = flipVert
self.flipHoriz = flipHoriz
self.pos = numpy.asarray(pos, float)
self.depth = depth
self.opacity = float(opacity)
self.interpolate = interpolate
self.noAudio = noAudio
self._audioStream = None
self.useTexSubImage2D = True
self._videoClock = Clock()
self.loadMovie(self.filename)
self.setVolume(volume)
self.nDroppedFrames = 0
#size
if size is None:
self.size = numpy.array([self._mov.w, self._mov.h],
float)
else:
self.size = val2array(size)
self.ori = ori
self._updateVertices()
#set autoLog (now that params have been initialised)
self.autoLog = autoLog
if autoLog:
logging.exp("Created %s = %s" %(self.name, str(self)))
def reset(self):
self._numpyFrame = None
self._nextFrameT = None
self._texID = None
self.status = NOT_STARTED
def setMovie(self, filename, log=True):
"""See `~MovieStim.loadMovie` (the functions are identical).
This form is provided for syntactic consistency with other visual stimuli.
#.........这里部分代码省略.........
开发者ID:papr,项目名称:psychopy,代码行数:101,代码来源:movie3.py
示例5: MovieStim2
#.........这里部分代码省略.........
# that maintains the aspect ratio of the video.
self.size = numpy.array([size, size / self.aspectRatio], float)
else:
self.size = val2array(size)
self.ori = ori
self._updateVertices()
# set autoLog (now that params have been initialised)
self.autoLog = autoLog
if autoLog:
logging.exp("Created %s = %s" % (self.name, str(self)))
def _reset(self):
self.duration = None
self.status = NOT_STARTED
self._numpy_frame = None
if self._texID is not None:
GL.glDeleteTextures(1, self._texID)
self._texID = None
# self._video_stream = None
self._total_frame_count = None
self._video_width = None
self._video_height = None
# TODO: Read depth from video source
self._video_frame_depth = 3
self._video_frame_rate = None
self._inter_frame_interval = None
self._prev_frame_sec = None
self._next_frame_sec = None
self._next_frame_index = None
self._prev_frame_index = None
self._video_perc_done = None
# self._last_video_flip_time = None
self._next_frame_displayed = False
self._video_track_clock = Clock()
self._audio_stream_clock = Clock()
self._vlc_instance = None
self._audio_stream = None
self._audio_stream_player = None
self._audio_stream_started = False
self._audio_stream_event_manager = None
def setMovie(self, filename, log=True):
"""See `~MovieStim.loadMovie` (the functions are identical).
This form is provided for syntactic consistency with other visual stimuli.
"""
self.loadMovie(filename, log=log)
def loadMovie(self, filename, log=True):
"""Load a movie from file
:Parameters:
filename: string
The name of the file, including path if necessary
After the file is loaded MovieStim.duration is updated with the movie
duration (in seconds).
"""
self._unload()
self._reset()
if self._no_audio is False:
self._createAudioStream()
# Create Video Stream stuff
开发者ID:RalRal,项目名称:psychopy,代码行数:67,代码来源:movie2.py
示例6: MovieStim2
#.........这里部分代码省略.........
# treat size as desired width, and calc a height
# that maintains the aspect ratio of the video.
self.size = numpy.array([size, size/self.aspectRatio], float)
else:
self.size = val2array(size)
self.ori = ori
self._updateVertices()
#set autoLog (now that params have been initialised)
self.autoLog = autoLog
if autoLog:
logging.exp("Created %s = %s" %(self.name, str(self)))
def _reset(self):
self.duration = None
self.status = NOT_STARTED
self._numpy_frame = None
self._frame_texture = None
self._frame_data_interface = None
self._video_stream = None
self._total_frame_count = None
self._video_width = None
self._video_height = None
# TODO: Read depth from video source
self._video_frame_depth = 3
self._video_frame_rate = None
self._inter_frame_interval = None
self._prev_frame_sec = None
self._next_frame_sec = None
self._next_frame_index = None
self._prev_frame_index = None
self._video_perc_done = None
self._last_video_flip_time = None
self._next_frame_displayed = False
self._video_track_clock = Clock()
self._audio_stream_clock=Clock()
self._vlc_instance = None
self._audio_stream = None
self._audio_stream_player = None
self._audio_stream_started = False
self._audio_stream_event_manager=None
def setMovie(self, filename, log=True):
"""See `~MovieStim.loadMovie` (the functions are identical).
This form is provided for syntactic consistency with other visual stimuli.
"""
self.loadMovie(filename, log=log)
def loadMovie(self, filename, log=True):
"""Load a movie from file
:Parameters:
filename: string
The name of the file, including path if necessary
After the file is loaded MovieStim.duration is updated with the movie
duration (in seconds).
"""
self._unload()
self._reset()
if self._no_audio is False:
self._createAudioStream()
# Create Video Stream stuff
开发者ID:alexholcombe,项目名称:psychopy,代码行数:67,代码来源:movie2.py
示例7: MovieStim2
#.........这里部分代码省略.........
# treat size as desired width, and calc a height
# that maintains the aspect ratio of the video.
self.size = numpy.array([size, size/self.aspectRatio], float)
else:
self.size = val2array(size)
self.ori = ori
self._updateVertices()
#set autoLog (now that params have been initialised)
self.autoLog = autoLog
if autoLog:
logging.exp("Created %s = %s" %(self.name, str(self)))
def _reset(self):
self.duration = None
self.status = NOT_STARTED
self._numpy_frame = None
self._frame_texture = None
self._frame_data_interface = None
self._video_stream = None
self._total_frame_count = None
self._video_width = None
self._video_height = None
# TODO: Read depth from video source
self._video_frame_depth = 3
self._video_frame_rate = None
self._inter_frame_interval = None
self._prev_frame_sec = None
self._next_frame_sec = None
self._next_frame_index = None
self._prev_frame_index = None
self._video_perc_done = None
self._last_video_flip_time = None
self._next_frame_displayed = False
self._video_track_clock = Clock()
self._vlc_instance = None
self._vlc_event_manager = None
self._audio_stream = None
self._audio_stream_player = None
self._audio_stream_started = False
self._last_audio_callback_time = core.getTime()
self._last_audio_stream_time = None
self._first_audio_callback_time = None
self._audio_computer_time_drift = None
def setMovie(self, filename, log=True):
"""See `~MovieStim.loadMovie` (the functions are identical).
This form is provided for syntactic consistency with other visual stimuli.
"""
self.loadMovie(filename, log=log)
def loadMovie(self, filename, log=True):
"""Load a movie from file
:Parameters:
filename: string
The name of the file, including path if necessary
After the file is loaded MovieStim.duration is updated with the movie
duration (in seconds).
"""
self._reset()
self._unload()
self._createAudioStream()
self._video_stream = cv2.VideoCapture()
开发者ID:hanke,项目名称:psychopy,代码行数:67,代码来源:movie2.py
注:本文中的psychopy.clock.Clock类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论