当前位置: 首页>>代码示例>>Python>>正文


Python Computer.currentSec方法代码示例

本文整理汇总了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()
开发者ID:balajisriram,项目名称:psychopy,代码行数:10,代码来源:net.py

示例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
开发者ID:Lx37,项目名称:psychopy,代码行数:10,代码来源:test_computer.py

示例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
开发者ID:balajisriram,项目名称:psychopy,代码行数:40,代码来源:net.py

示例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
开发者ID:DennisEckmeier,项目名称:psychopy,代码行数:18,代码来源:test_computer.py


注:本文中的psychopy.iohub.Computer.currentSec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。