本文整理汇总了Python中psychopy.iohub.Computer.currentSec方法的典型用法代码示例。如果您正苦于以下问题:Python Computer.currentSec方法的具体用法?Python Computer.currentSec怎么用?Python Computer.currentSec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类psychopy.iohub.Computer
的用法示例。
在下文中一共展示了Computer.currentSec方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: local2RemoteTime
# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import currentSec [as 别名]
def local2RemoteTime(self,local_time=None):
"""
Converts a local time (sec.msec format) to the corresponding remote
computer time, using the current offset and drift measures.
"""
if local_time is None:
local_time=Computer.currentSec()
return self.getDrift()*local_time+self.getOffset()
示例2: test_getTime
# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import currentSec [as 别名]
def test_getTime(self):
ta = Computer.currentSec()
tb = Computer.currentTime()
tc = Computer.getTime()
tp = getTime()
assert ta < tb < tc < tp
assert tp - ta < 0.002
示例3: sync
# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import currentSec [as 别名]
def sync(self):
sync_count=self.sync_batch_size
sync_data=['SYNC_REQ',]
feed=self.feed
unpack=self.unpack
pack=self.pack
recvfrom=self.sock.recvfrom
rcvBufferLength=self._rcvBufferLength
remote_address=self.remote_iohub_address
sendto=self.sock.sendto
min_delay=1000.0
min_local_time=0.0
min_remote_time=0.0
for s in range(sync_count):
# send sync request
sync_start=Computer.currentSec()
sendto(pack(sync_data),remote_address)
sync_start2=Computer.currentSec()
# get reply
feed(recvfrom(rcvBufferLength)[0])
sync_rep,remote_time=unpack()
sync_end=Computer.currentSec()
rtt=sync_end-(sync_start+sync_start2)/2.0
old_delay=min_delay
min_delay=min(min_delay,rtt)
if old_delay!=min_delay:
min_local_time=(sync_end+sync_start)/2.0
min_remote_time=remote_time
return min_delay, min_local_time, min_remote_time
示例4: test_getTime
# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import currentSec [as 别名]
def test_getTime(self):
ta = Computer.currentSec()
tb = Computer.currentTime()
tc = Computer.getTime()
tp = getTime()
assert ta <= tb <= tc <= tp
assert tp - ta < 0.002
ta = getTime()
tb = self.io.getTime()
tc = self.io.getTime()
tp = getTime()
assert ta <= tb <= tc <= tp
assert tp - ta < 0.01