View Single Post
  #1  
Old 07-04-2019, 11:51 AM
hannahapz hannahapz is offline
Member
 
Join Date: Apr 2018
Posts: 22
Timer and Visibility Issue

This is my goal:

1) A appears for 500 msec (this is the cue)
2) Inter-stimulus interval of 650 msec (ISI)
3) B appears for 500 msec (this is the main stimulus) and then disappears

Right now, I have 1) and 2) successfully coded, but B doesn't want to go away (it stays on-screen).

When I try to time B to become invisible, it never appears in the first place. Below is the code representing this situation. The main_function calls the Timer/Visibility functions. A and B represent the cue and stimulus object nodes, respectively.


Code:
def cueshow():
    cue.setPosition([x,y,z])
    cue.visible(viz.ON) #make target visible
    starttimer(0, 0.5) # cue is visible for 500 msec
    callback(viz.TIMER_EVENT,CueTimer) #then make cue invisible
			
def CueTimer(num):
    cue.visible(viz.OFF)
		
def stimshow():
    starttimer(0, 1.15) # wait 1.15 seconds (500 msec of when cue first appears + 650 msec ISI)
    callback(viz.TIMER_EVENT,StimTimer) # then make target visible

def StimTimer(num):
    node.setPosition([x,y,z])
    node.visible(viz.ON)

def stimhide():
    starttimer(1, 1.65) # wait 1.65 seconds until turning stimulus off
    callback(viz.TIMER_EVENT,StimHideTimer)
		
def StimHideTimer(num):
    node.visible(viz.OFF)
			

def main_function():
    A.cueshow()
    B.stimshow()
    B.stimhide()
Reply With Quote