if mpos[1] > DISPCENTRE[1]:
                    mang = 90.0 + (90.0 - mang)
                if mpos[0] < DISPCENTRE[0]:
                    mang = 180.0 + (180.0 - mang)

                # Correct if angle is over MAXORI degrees
                mang = mang % MAXORI
                
                # Store the current response in variables
                respori = int(mang)

        if key == 'space' and respori != None:
            resp = True
        elif key == 'escape' and ESCKILL:
            log.write(["DEBUGKILL"])
            log.close()
            tracker.close()
            disp.close()
            raise Exception("DEBUG KILL")
        
        # auto response if needed
        if AUTORESP:
            resp = True
            respori = random.randint(0, MAXORI-1)
            
    # hide mouse again
    mouse.set_visible(False)
    
    # Log the response.
    line = [trialnr, trial['nstim'], fixonset, stimonset, maintenanceonset, \
        probeonset, presstime-probeonset, respori]
Beispiel #2
0
	timestring = "%s:%s:%s:%s" % (h, m, s, ms)
	# display
	scr.clear()
	scr.draw_text("The time passed from the experiment beginning is: %s" % timestring)
	disp.fill(scr)
	disp.show()

#time.pause()
scr.clear()
scr.draw_text("After you press space, the PyGaze test will pause for three seconds")
disp.fill(scr)
disp.show()
kb.get_key()
timer.pause(3000)


# # # # #
# close down

# ending screen
scr.clear()
scr.draw_text("That's all folks! Press Space to quit.")
disp.fill(scr)
t1 = disp.show()
log.write(["ending", t1])
kb.get_key()

# close
log.close()
disp.close()
timer.expend()
Beispiel #3
0
#			i = 0
#			triggered = False
#			while not triggered:
#				t, triggered, timed_out = trigbox.wait_for_sync(timeout=60.0)
#				i += 1
#				if i > 3:
#					print("DEBUG: TOO MANY TIMEOUTS! BROKEN SYNC!")
#					break

		#loop through trials 
		for iii, currTrial in enumerate(currBlock): 
			
			key, presstime = kb.get_key(keylist=['q', 'f', 'j'], timeout=1, flush=False)
			if key == 'q':
				event_log.write([presstime, "DEBUG KILL"])
				log.close()
				tracker.close()
				disp.close()
				raise Exception('DEBUG KILL')
			"""trial[runNo][blockNo][trialNo][infoNo]
			infoNo is:
			0 = distractor filename 
			1 = trial type 
			2 = ITI 
			3 = Stimonset 
			4 = screens 
				0 = face only screen
				1 = face + signal screen 
			"""

			#display ITI and pause for length of ITI 
Beispiel #4
0
        button_states = [False, False] # list of bools 
        if state[0] != 0: # if left button is not 0
            button_states[0] = True
        if state[1] != 0: # if right button is not 0 
            button_states[-1] = True 
        if state[2] != 0:
            end_press = True
        key, presstime = kb.get_key(keylist=['q', 'f', 'j'], timeout=1, flush=False)


    else:
        key, presstime = kb.get_key(keylist=['q', 'f', 'j'], timeout=1, flush=False)
        button_states = mouse.get_pressed()
    # Break loop on 'q' press.
    if key == 'q':
        log.close()
        tracker.close()
        disp.close()
        raise Exception('DEBUG KILL')
    # Rotate the stimulus accordingly.
    if  button_states[0]:
        pre_clamp = prac_scr.screen[2].ori - 1
        prac_scr.screen[2].ori = clamp_angle(int(pre_clamp))
    elif button_states[-1]:
        pre_clamp = prac_scr.screen[2].ori +1
        prac_scr.screen[2].ori = clamp_angle(int(pre_clamp))
    # if at target time add the length of this frame 
    angle = prac_scr.screen[2].ori
    # reduce the angle  
    angle =  angle % 360; 
    #force it to be the positive remainder, so that 0 <= angle < 360