本文整理汇总了Python中target.Target.set_new_target方法的典型用法代码示例。如果您正苦于以下问题:Python Target.set_new_target方法的具体用法?Python Target.set_new_target怎么用?Python Target.set_new_target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类target.Target
的用法示例。
在下文中一共展示了Target.set_new_target方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Trainer
# 需要导入模块: from target import Target [as 别名]
# 或者: from target.Target import set_new_target [as 别名]
#.........这里部分代码省略.........
self.timers['tr_8hz'] = Timer(self.TR_LIST[0])
self.timers['tr_4hz'] = Timer(self.TR_LIST[1])
self.timers['tr_2hz'] = Timer(self.TR_LIST[2])
self.timers['tr_1hz'] = Timer(self.TR_LIST[3])
self.timers['tr_p5hz'] = Timer(self.TR_LIST[4])
self.timers['tr_p25hz'] = Timer(self.TR_LIST[5])
self.timers['tr'] = self.timers['tr_2hz']
self.timers['reach'] = Timer(0)
self.timers['reach_hold'] = Timer(self.REACH_SUCCESS_TIME)
self.timers['block'] = Timer(self.BLOCK_TIME)
self.timers['reset_hold'] = Timer(self.RESET_HOLD_TIME)
def reset_all_timers(self):
for k,t in self.timers.iteritems():
t.reset()
def check_input(self):
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.quit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.quit()
elif event.key == pygame.K_0:
self.daq.set_volts_zero()
elif event.key == pygame.K_f:
if self.dof == 1:
self.set_dof(2)
elif self.dof == 2:
self.set_dof(1)
elif event.key == pygame.K_b:
self.target.set_new_target()
elif event.key == pygame.K_v:
self.training_mode = not(self.training_mode)
elif event.key == pygame.K_c:
self.target.set_fb_mode('hrf')
elif event.key == pygame.K_x:
self.target.set_fb_mode('impulse')
elif event.key == pygame.K_m:
if self.input_mode == 'mouse':
self.input_mode = 'sensor'
elif self.input_mode == 'sensor':
self.input_mode = 'mouse'
def run_timed(self):
###########################################
# main loop for time-to-target experiment #
###########################################
while True:
time_passed = self.clock.tick_busy_loop(self.FRAME_RATE)
self.check_input()
self.input_pos = self.get_pos()
self.cursor.update(self.input_pos)
self.target.update(self.cursor.pos)
if not(self.timers['reset_hold'].time_limit_hit):
gr.check_in_start(self, time_passed)
self.target.draw_bool = True
elif not(self.cursor.has_left):
gr.check_if_left(self)
self.target.draw_bool = False
elif self.training_mode:
self.target.draw_bool = True