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


Python utils.run_state_machine函数代码示例

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


在下文中一共展示了run_state_machine函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 self.responded_block:
         return self.block_name(block_num + 1)
     else:
         return self.block_name(block_num - 1)
开发者ID:theilmbh,项目名称:pyoperant,代码行数:30,代码来源:shape.py

示例2: temp

        def temp():
            self.recent_state = block_num
            self.log.warning('Starting %s'%(self.block_name(block_num)))
            if 'free_food_schedule' in self.parameters:
                if utils.check_time(self.parameters['free_food_schedule']):
                    return 'free_food_block'
            utils.run_state_machine(    start_in='init',
                                        error_state='wait',
                                        error_callback=self.error_callback,
                                        init=self._block_init('wait'),
                                        wait=self._wait_block(10, 40,'check'),
                                        check=self._check_block('flash_mid', 1, float('inf')),
                                        flash_mid=self._flash_poll(self.panel.center, 5, 'reward', 'pre_reward'),
                                        pre_reward=self._pre_reward('reward'),
                                        reward=self.reward(5, 'check2'),
                                        check2=self._check_block('wait', 1, float('inf')))


            # check if its time for free food
            if 'free_food_schedule' in self.parameters:
                if utils.check_time(self.parameters['free_food_schedule']):
                    return 'free_food_block'

            if not utils.check_time(self.parameters['light_schedule']):
                return 'sleep_block'
            return self.block_name(block_num + 1)
开发者ID:gentnerlab,项目名称:pyoperant,代码行数:26,代码来源:shape_original.py

示例3: 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:wohlmp,项目名称:pyoperant,代码行数:28,代码来源:shape.py

示例4: _run_sleep

 def _run_sleep(self):
     utils.run_state_machine(start_in='pre',
                             error_state='post',
                             error_callback=self.error_callback,
                             pre=self.sleep_pre,
                             main=self.sleep_main,
                             post=self.sleep_post)
     return self.block_name(self.recent_state)
开发者ID:wohlmp,项目名称:pyoperant,代码行数:8,代码来源:shape.py

示例5: _run_session

 def _run_session(self):
     utils.run_state_machine(start_in='pre',
                             error_state='post',
                             error_callback=self.log_error_callback,
                             pre=self.session_pre,
                             main=self.session_main,
                             post=self.session_post)
     return 'idle'
开发者ID:MarvinT,项目名称:pyoperant,代码行数:8,代码来源:base.py

示例6: _free_food

 def _free_food(self):
     self.log.debug('Starting _free_food')
     utils.run_state_machine(start_in='pre',
                             error_state='post',
                             error_callback=self.log_error_callback,
                             pre=self.free_food_pre,
                             main=self.free_food_main,
                             post=self.free_food_post)
     return 'idle'
开发者ID:gentnerlab,项目名称:pyoperant,代码行数:9,代码来源:base.py

示例7: _run_trial

 def _run_trial(self):
     self.log.debug('running trial')
     self.log.debug("number of open file descriptors: %d" %(utils.get_num_open_fds()))
     utils.run_state_machine(start_in='pre',
                             error_state='post',
                             error_callback=self.log_error_callback,
                             pre=self.trial_pre,
                             main=self.trial_main,
                             post=self.trial_post)
开发者ID:neuromusic,项目名称:pyoperant,代码行数:9,代码来源:two_alt_choice.py

示例8: run_shape

 def run_shape(self, start_state='block1'):
     self.log.info('Starting shaping procedure')
     utils.run_state_machine(    start_in=start_state,
                                 error_state='block1',
                                 error_callback=self.error_callback,
                                 block1=self.block1,
                                 block2=self.block2,
                                 block3=self.block3,
                                 block4=self.block4,
                                 block5=self.block5,
                                 sleep_block=self._run_sleep)
     self.log.info('Shaping procedure complete')
开发者ID:wohlmp,项目名称:pyoperant,代码行数:12,代码来源:shape.py

示例9: 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

示例10: run

    def run(self):

        for attr in self.req_panel_attr:
            assert hasattr(self.panel,attr)
        self.panel_reset()
        self.save()
        self.init_summary()

        self.log.info('%s: running %s with parameters in %s' % (self.name,
                                                                self.__class__.__name__,
                                                                self.snapshot_f,
                                                                )
                      )
        if self.parameters['shape']:
                self.shaper.run_shape(self.parameters['shape'])
        while True: #is this while necessary
            utils.run_state_machine(start_in='idle',
                                    error_state='idle',
                                    error_callback=self.log_error_callback,
                                    idle=self._run_idle,
                                    sleep=self._run_sleep,
                                    session=self._run_session)
开发者ID:MarvinT,项目名称:pyoperant,代码行数:22,代码来源:base.py

示例11: _run_stimulus

 def _run_stimulus(self):
     utils.run_state_machine(start_in='pre',
                             error_callback=self.log_error_callback,
                             pre=self.stimulus_pre,
                             main=self.stimulus_main,
                             post=self.stimulus_post)
开发者ID:neuromusic,项目名称:pyoperant,代码行数:6,代码来源:two_alt_choice.py

示例12: _run_punish

 def _run_punish(self):
     utils.run_state_machine(start_in='pre',
                             error_callback=self.log_error_callback,
                             pre=self.punish_pre,
                             main=self.punish_main,
                             post=self.punish_post)
开发者ID:neuromusic,项目名称:pyoperant,代码行数:6,代码来源:two_alt_choice.py

示例13: _run_consequence

 def _run_consequence(self):
     utils.run_state_machine(start_in='pre',
                             error_callback=self.log_error_callback,
                             pre=self.consequence_pre,
                             main=self.consequence_main,
                             post=self.consequence_post)
开发者ID:neuromusic,项目名称:pyoperant,代码行数:6,代码来源:two_alt_choice.py

示例14: _run_correction_reward

 def _run_correction_reward(self):
     utils.run_state_machine(start_in='pre',
                             error_callback=self.log_error_callback,
                             pre=self.correction_reward_pre,
                             main=self.correction_reward_main,
                             post=self.correction_reward_post)
开发者ID:neuromusic,项目名称:pyoperant,代码行数:6,代码来源:three_ac_matching.py


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