• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.check_time函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyoperant.utils.check_time函数的典型用法代码示例。如果您正苦于以下问题:Python check_time函数的具体用法?Python check_time怎么用?Python check_time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了check_time函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: temp

        def temp():
            self.recent_state = block_num
            self.log.info('Starting %s'%(self.block_name(block_num)))
            utils.run_state_machine(    start_in='init',
                                        error_state='check',
                                        error_callback=self.error_callback,
                                        init=self._block_init('check'),
                                        check=self._check_block('poll_mid', reps, revert_timeout),
                                        poll_mid=self._poll(self.panel.center, 10, 'check', 'coin_flip'),
                                        coin_flip=self._rand_state(('check_right', 'check_center', 'check_left')),
                                        check_right=self._check_block('audio_right', reps, revert_timeout),
                                        audio_right=self._play_audio('poll_right', 'R'),
                                        poll_right=self._flash_poll(self.panel.right, 10, 'check_right', 'close_audio'),
                                        check_center=self._check_block('audio_center', reps, revert_timeout),
                                        audio_center=self._play_audio('poll_center', 'C'),
                                        poll_center=self._flash_poll(self.panel.center, 10, 'check_center', 'close_audio'),
                                        check_left=self._check_block('audio_left', reps, revert_timeout),
                                        audio_left=self._play_audio('poll_left', 'L'),
                                        poll_left=self._flash_poll(self.panel.left, 10, 'check_left', 'close_audio'),
                                        close_audio=self._close_audio('pre_reward'),
                                        pre_reward=self._pre_reward('reward'),
                                        reward=self.reward(2.5, 'check'))
            if not utils.check_time(self.parameters['light_schedule']):
                return 'sleep_block'
            if 'free_food_schedule' in self.parameters:
                if utils.check_time(self.parameters['free_food_schedule']):
                    return 'free_food_block'

            if self.responded_block:
                return self.block_name(block_num + 1)
            else:
                return self.block_name(block_num - 1)
开发者ID:gentnerlab,项目名称:pyoperant,代码行数:32,代码来源:shape_original.py


示例2: temp

 def temp():
     self.recent_state = block_num
     self.log.info("Starting %s" % (self.block_name(block_num)))
     utils.run_state_machine(
         start_in="init",
         error_state="check",
         error_callback=self.error_callback,
         init=self._block_init("check"),
         check=self._check_block("poll_mid", reps, revert_timeout),
         poll_mid=self._poll(self.panel.center, 10, "check", "coin_flip"),
         coin_flip=self._rand_state(("check_right", "check_center", "check_left")),
         check_right=self._check_block("audio_right", reps, revert_timeout),
         audio_right=self._play_audio("poll_right", "R"),
         poll_right=self._flash_poll(self.panel.right, 10, "check_right", "close_audio"),
         check_center=self._check_block("audio_center", reps, revert_timeout),
         audio_center=self._play_audio("poll_center", "C"),
         poll_center=self._flash_poll(self.panel.center, 10, "check_center", "close_audio"),
         check_left=self._check_block("audio_left", reps, revert_timeout),
         audio_left=self._play_audio("poll_left", "L"),
         poll_left=self._flash_poll(self.panel.left, 10, "check_left", "close_audio"),
         close_audio=self._close_audio("pre_reward"),
         pre_reward=self._pre_reward("reward"),
         reward=self.reward(2.5, "check"),
     )
     if not utils.check_time(self.parameters["light_schedule"]):
         return "sleep_block"
     if self.responded_block:
         return self.block_name(block_num + 1)
     else:
         return self.block_name(block_num - 1)
开发者ID:theilmbh,项目名称:pyoperant,代码行数:30,代码来源:shape.py


示例3: _check_free_food_block

 def _check_free_food_block(self):
     """ Checks if it is currently a free food block
     """
     if 'free_food_schedule' in self.parameters:
         if utils.check_time(self.parameters['free_food_schedule']):
             return True
     return
开发者ID:gentnerlab,项目名称:pyoperant,代码行数:7,代码来源:shape.py


示例4: sleep_main

 def sleep_main(self):
     """ reset expal parameters for the next day """
     self.log.debug("sleeping...")
     self.panel.house_light.off()
     utils.wait(self.parameters["idle_poll_interval"])
     if not utils.check_time(self.parameters["light_schedule"]):
         return "main"
     else:
         return "post"
开发者ID:theilmbh,项目名称:pyoperant,代码行数:9,代码来源:shape.py


示例5: check_session_schedule

    def check_session_schedule(self):
        """ Check the session schedule

        Returns
        -------
        bool
            True if sessions should be running
        """
        return utils.check_time(self.parameters['session_schedule'])
开发者ID:gentnerlab,项目名称:pyoperant,代码行数:9,代码来源:two_alt_choice.py


示例6: free_food_main

    def free_food_main(self):
        """ reset expal parameters for the next day """
        self.log.debug('Starting Free Food main.')
        utils.run_state_machine(start_in='wait',
                                error_state='wait',
                                error_callback=self.log_error_callback,
                                wait=self._wait_block(5, 5, 'food'),
                                food=self.deliver_free_food(10, 'checker'),
                                checker=self.food_checker('wait')
                                )

        if not utils.check_time(self.parameters['free_food_schedule']):
            return 'post'
        else:
            return 'main'
开发者ID:gentnerlab,项目名称:pyoperant,代码行数:15,代码来源:base.py


示例7: stimulus_pre

    def stimulus_pre(self):
        # wait for bird to peck
        self.log.debug("presenting stimulus %s" % self.this_trial.stimulus)
        self.log.debug("from file %s" % self.this_trial.stimulus_event.file_origin)
        self.panel.speaker.queue(self.this_trial.stimulus_event.file_origin)
        self.log.debug('waiting for peck...')
        self.panel.center.on()
        trial_time = None
        while trial_time is None:
            if self.check_session_schedule()==False:
                self.panel.center.off()
                self.panel.speaker.stop()
                self.update_adaptive_queue(presented=False)
                raise EndSession
            elif 'free_food_schedule' in self.parameters:
                if utils.check_time(self.parameters['free_food_schedule']):
                    self.panel.center.off()
                    self.panel.speaker.stop()
                    self.update_adaptive_queue(presented=False)
                    raise EndSession
                else:
                    trial_time = self.panel.center.poll(timeout=60.0)
            else:
                trial_time = self.panel.center.poll(timeout=60.0)

        self.this_trial.time = trial_time

        self.panel.center.off()
        self.this_trial.events.append(utils.Event(name='center',
                                                  label='peck',
                                                  time=0.0,
                                                  )
                                            )

        # record trial initiation
        self.summary['trials'] += 1
        self.summary['last_trial_time'] = self.this_trial.time.ctime()
        self.log.info("trial started at %s" % self.this_trial.time.ctime())
开发者ID:gentnerlab,项目名称:pyoperant,代码行数:38,代码来源:two_alt_choice.py


示例8: check_light_schedule

 def check_light_schedule(self):
     """returns true if the lights should be on"""
     return utils.check_time(self.parameters['light_schedule'])
开发者ID:MarvinT,项目名称:pyoperant,代码行数:3,代码来源:base.py


示例9: check

    def check(self):
        """ Returns True if the state should be active according to this schedule
        """

        return utils.check_time(self.time_periods)
开发者ID:siriuslee,项目名称:pyoperant,代码行数:5,代码来源:states.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.run_state_machine函数代码示例发布时间:2022-05-27
下一篇:
Python feed.LazyBuilder类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap