本文整理汇总了Python中VisionEgg.FlowControl.Presentation.is_in_go_loop方法的典型用法代码示例。如果您正苦于以下问题:Python Presentation.is_in_go_loop方法的具体用法?Python Presentation.is_in_go_loop怎么用?Python Presentation.is_in_go_loop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisionEgg.FlowControl.Presentation
的用法示例。
在下文中一共展示了Presentation.is_in_go_loop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import is_in_go_loop [as 别名]
#.........这里部分代码省略.........
anchor='center',
on=False)
# Show initializing message
self.initialize.add_controller(self.mess, 'text', FunctionController(during_go_func=self.showMess))
# Set control's parameters and corresponding function. Controlling targers
self.targetShow.add_controller(self.TopTarget, 'on', FunctionController(during_go_func=self.topFlick))
self.targetShow.add_controller(self.BotTarget, 'on', FunctionController(during_go_func=self.botFlick))
self.targetShow.add_controller(self.LeftTarget, 'on', FunctionController(during_go_func=self.leftFlick))
self.targetShow.add_controller(self.RightTarget, 'on', FunctionController(during_go_func=self.rightFlick))
# Controlling others
# self.p2.add_controller(self.text, 'on', FunctionController(during_go_func=self.appear))
self.cueShow.add_controller(self.arrow, 'on', FunctionController(during_go_func=self.arrow_appear))
self.cueShow.add_controller(self.arrow, 'texture', FunctionController(during_go_func=self.random_cue))
def on_execute(self):
if self.on_init() == False:
self._running = False
# Prompting
self.initialize.go()
# Experiment goes..
for i in range(0,numTrial):
self.cueShow.go()
self.targetShow.go()
self.on_writing()
# TODO
# Maybe we need a method for closing the program
#################################################
# Controlling methods: Flickering #
#################################################
def topFlick(self,t):
return int(t*TopRate*2.0) % 2
def botFlick(self,t):
return int(t*BotRate*2.0) % 2
def leftFlick(self,t):
return int(t*LeftRate*2.0) % 2
def rightFlick(self,t):
return int(t*RightRate*2.0) % 2
def arrow_appear(self, t):
flag = True
if flag:
#self.writedata(t, 1)
flag = False
if self.targetShow.is_in_go_loop():
return False
else:
return True
def random_cue(self,t):
start_time = self.cueShow.last_go_loop_start_time_absolute_sec
# TODO
# Add try catch to handle errors regarding start_time's type problem
# TODO
# Add event so that the transition processes only taken place once
if not isinstance(start_time, type(None)):
i = int((start_time-duration_init)/duration_trial) # eliminate initializing duration factor
cur_target = order_appear[i] # current target
self.TargetLog[i, :] = np.array([cur_target, start_time]) # return real time
if cur_target == 1:
return Texture('images/up2.bmp')
elif cur_target == 2:
return Texture('images/left2.bmp')
elif cur_target == 3:
return Texture('images/right2.bmp')
elif cur_target == 4:
return Texture('images/down2.bmp')
else:
return Texture('images/left2.bmp') # Just return something, add_controller need it
def showMess(self, t):
return 'Ready ...'
#################################################
# Writing data methods #
#################################################
def on_writing(self):
# Open file for writing data
file = open("Recordingfile.txt", "w")
for i in range(self.TargetLog.shape[0]):
target = self.TargetLog[i, 0]
time = self.TargetLog[i, 1]
line = str(target) + '\t' + str(time) + '\n'
file.write(line)