else: p = mag_problems.pop(0) n1 = p[0] n2 = p[1] symbol = " OR " solution = str(max([n1, n2])) #Make Rectangles and numbers x = screen.size[0] / 4 y = screen.size[1] / 2 numbers = [n1, n2] random.shuffle(numbers) problem = "%s OR %s" % (numbers[0], numbers[1]) expText, expPort = printText(screen, problem, 80, (255, 255, 255)) subject.inputData(trial, "n1", n1) subject.inputData(trial, "n2", n2) subject.inputData(trial, "problem", problem) #format problem print "----------------------" print "PROBLEM: %s" % problem print "SOLUTION: %s " % solution print "----------------------" ns = [n1, n2] #default values for misfiring voice key misfire = 0
#default values for misfiring voice key misfire = 0 ACC = 1 #generate texts strat2 = "%s\n\nPlease describe your strategy" % problem info = "mems: %s/%s, tmems: %s, calcs: %s/%s, tcalcs: %s, heap: %s" % (len(memProblems), trials, len(memTemp), len(calcProblems), trials, len(calcTemp), len(problemHeap)) print "-------------------------------------" print "PROBLEM : %s" % problemString print "SOLUTION : %s" % solution print "STATUS : %s" % info print "-------------------------------------" stratText, stratPort = printText(screen, strat2, 80, (255, 255, 255)) expText, expPort = printText(screen, "%s\n \n" % problem, 80, (255, 255, 255)) #BLOCK 1 - Problem & RESPONSE p = Presentation(go_duration=('forever', ), viewports=[expPort]) p.add_controller(None, None, FunctionController(during_go_func=problem_controller, temporal_variables = FRAMES_ABSOLUTE)) p.go() #BLOCK 2 - STRATEGY SELECTION & GRADING p2 = Presentation(go_duration=('forever', ), viewports=[expPort, stratPort]) p2.add_controller(None, None, FunctionController(during_go_func=strategy_controller, temporal_variables = FRAMES_ABSOLUTE)) p2.parameters.handle_event_callbacks=[(pygame.locals.KEYDOWN, key_handler)] p2.go() subject.inputData(trial, "misfire", misfire)
else: p = mag_problems.pop(0) n1 = p[0] n2 = p[1] symbol = " OR " solution = str(max([n1, n2])) # Make Rectangles and numbers x = screen.size[0] / 4 y = screen.size[1] / 2 numbers = [n1, n2] random.shuffle(numbers) problem = "%s OR %s" % (numbers[0], numbers[1]) expText, expPort = printText(screen, problem, 80, (255, 255, 255)) subject.inputData(trial, "n1", n1) subject.inputData(trial, "n2", n2) subject.inputData(trial, "problem", problem) # format problem print "----------------------" print "PROBLEM: %s" % problem print "SOLUTION: %s " % solution print "----------------------" ns = [n1, n2] # default values for misfiring voice key misfire = 0
ACC = 1 #generate texts strat2 = "%s\n\nPlease describe your strategy" % problem info = "mems: %s/%s, tmems: %s, calcs: %s/%s, tcalcs: %s, heap: %s" % ( len(memProblems), trials, len(memTemp), len(calcProblems), trials, len(calcTemp), len(problemHeap)) print "-------------------------------------" print "PROBLEM : %s" % problem print "SOLUTION : %s" % solution print "STATUS : %s" % info print "-------------------------------------" stratText, stratPort = printText(screen, strat2, 80, (255, 255, 255)) expText, expPort = printText(screen, "%s\n \n" % problem, 80, (255, 255, 255)) #BLOCK 1 - Problem & RESPONSE p = Presentation(go_duration=('forever', ), viewports=[expPort]) p.add_controller( None, None, FunctionController(during_go_func=problem_controller, temporal_variables=FRAMES_ABSOLUTE)) p.go() #BLOCK 2 - STRATEGY SELECTION & GRADING p2 = Presentation(go_duration=('forever', ), viewports=[expPort, stratPort])
trial = 0 #trial number phase = 1 #phase of the experiment direction = "up" #direction of operands maxOp = 35 #maximum operand size memCount = 20 calcCount = 40 ###SET SCREEN screen = get_default_screen() screen.parameters.bgcolor = (0, 0, 0) pygame.font.init() ###UNCHANGING STIMULI #strat selection fixText, fixCross = printText(screen, '', 60, (255, 255, 255)) #generate texts strat2 = "\n\nDescribe your strategy" stratText, stratPort = printText(screen, strat2, 60, (255, 255, 255)) pauseText, pausePort = printText(screen, "paused", 60, (255, 255, 255)) p4 = Presentation(go_duration=(problemTime, 'seconds')) p = Presentation(go_duration=('forever', )) #strat selection startText, startCross = printWord(screen, 'Press the SPACEBAR to start', 60, (255, 255, 255)) pause = Presentation(go_duration=('forever', ), viewports=[startCross]) pause.parameters.handle_event_callbacks=[(pygame.locals.KEYDOWN, pause_handler)]
if len(ns1) == 1: ns1 = " %s" % ns1 if len(ns2) == 1: ns2 = " %s" % ns2 problem = " %s\n+ %s" % (ns1, ns2) problemString = "%s + %s" % (numbers[0], numbers[1]) #format problem print "----------------------" print "PROBLEM: %s" % problemString print "SOLUTION: %s " % solution print "----------------------" expText, expPort = printText(screen, problem, fontsize, (255, 255, 255)) subject.inputData(trial, "comparison", comparison) subject.inputData(trial, "n1", n1) subject.inputData(trial, "n2", n2) subject.inputData(trial, "problem", problemString) subject.inputData(trial, "type", stim) ns = [n1, n2] #default values for misfiring voice key misfire = 0 ACC = 1
elif event.key == K_q: print "QUIT PROGRAM WOOO" p2.parameters.go_duration = (0, 'frames') def pause_handler(event): if event.key == K_SPACE: print "BEGINNING EXPERIMENT" pause.parameters.go_duration = (0, 'frames') #default strategy strategy = None trial = 1 fixText, fixCross = printText(screen, '', 60, (255, 255, 255)) print "PRESS SPACE TO START" pause = Presentation(go_duration=('forever', ), viewports=[fixCross]) pause.parameters.handle_event_callbacks=[(pygame.locals.KEYDOWN, pause_handler)] pause.go() for p in problems: n1 = p[0][0] n2 = p[0][1] problem = "%s + %s" % (n1, n2) subject.inputData(trial, "n1", n1)
pause.parameters.go_duration = (0, 'frames') #initial variables trial = 1 #default strat strat = None ###UNCHANGING STIMULI #strat selection fixText, fixCross = printWord(screen, '', 60, (255, 255, 255)) #generate texts strat2 = "\n\nPlease describe your strategy" stratText, stratPort = printText(screen, strat2, 60, (255, 255, 255)) pre_problems = Problems(DB, sid, clear=False) post_problems = Problems(DB, sid, exp="post", clear=False) query = {'kind' : 'verified'} ver_pre = pre_problems.query(query) ns_list = [] for row in ver_pre: ns_list.append([row['ns'], row['strat']]) ns_list1 = copy.deepcopy(ns_list) ns_list2 = copy.deepcopy(ns_list)
#initial variables trial = 1 #default strat strat = None ###UNCHANGING STIMULI #strat selection fixText, fixCross = printWord(screen, '', 60, (255, 255, 255)) #generate texts strat2 = "\n\nPlease describe your strategy" stratText, stratPort = printText(screen, strat2, 60, (255, 255, 255)) pre_problems = Problems(DB, sid, clear=False) post_problems = Problems(DB, sid, exp="post", clear=False) query = {'kind': 'verified'} ver_pre = pre_problems.query(query) ns_list = [] for row in ver_pre: ns_list.append([row['ns'], row['strat']]) ns_list1 = copy.deepcopy(ns_list) ns_list2 = copy.deepcopy(ns_list)
if len(ns1) == 1: ns1 = " %s" % ns1 if len(ns2) == 1: ns2 = " %s" % ns2 problem = " %s\n+ %s" % (ns1, ns2) problemString = "%s + %s" % (numbers[0], numbers[1]) #format problem print "----------------------" print "PROBLEM: %s" % problemString print "SOLUTION: %s " % solution print "----------------------" expText, expPort = printText(screen, problem, fontsize, (255, 255, 255)) subject.inputData(trial, "comparison", comparison) subject.inputData(trial, "n1", n1) subject.inputData(trial, "n2", n2) subject.inputData(trial, "problem", problemString) subject.inputData(trial, "type", stim) ns = [n1, n2] #default values for misfiring voice key misfire = 0 ACC = 1 #BLOCK 1 - Problem & RESPONSE
misfire = 0 ACC = 1 #generate texts strat2 = "\n\nPlease describe your strategy" info = "mems: %s/%s, tmems: %s, calcs: %s/%s, tcalcs: %s, heap: %s" % (len(memProblems), trials, len(memTemp), len(calcProblems), trials, len(calcTemp), len(problemHeap)) print "-------------------------------------" print "PROBLEM : %s" % problem print "SOLUTION : %s" % solution print "STATUS : %s" % info print "-------------------------------------" stratText, stratPort = printText(screen, strat2, 60, (255, 255, 255)) expText, expPort = printText(screen, problem, 60, (255, 255, 255)) #BLOCK 1 - Problem & RESPONSE p = Presentation(go_duration=('forever', ), viewports=[expPort]) p.add_controller(None, None, FunctionController(during_go_func=problem_controller, temporal_variables = FRAMES_ABSOLUTE)) p.go() #BLOCK 2 - STRATEGY SELECTION & GRADING p2 = Presentation(go_duration=('forever', ), viewports=[expPort, stratPort]) p2.add_controller(None, None, FunctionController(during_go_func=strategy_controller, temporal_variables = FRAMES_ABSOLUTE)) p2.parameters.handle_event_callbacks=[(pygame.locals.KEYDOWN, key_handler)] p2.go() subject.inputData(trial, "misfire", misfire)
ACC = 1 #generate texts strat2 = "\n\nPlease describe your strategy" info = "mems: %s/%s, tmems: %s, calcs: %s/%s, tcalcs: %s, heap: %s" % ( len(memProblems), trials, len(memTemp), len(calcProblems), trials, len(calcTemp), len(problemHeap)) print "-------------------------------------" print "PROBLEM : %s" % problem print "SOLUTION : %s" % solution print "STATUS : %s" % info print "-------------------------------------" stratText, stratPort = printText(screen, strat2, 60, (255, 255, 255)) expText, expPort = printText(screen, problem, 60, (255, 255, 255)) #BLOCK 1 - Problem & RESPONSE p = Presentation(go_duration=('forever', ), viewports=[expPort]) p.add_controller( None, None, FunctionController(during_go_func=problem_controller, temporal_variables=FRAMES_ABSOLUTE)) p.go() #BLOCK 2 - STRATEGY SELECTION & GRADING p2 = Presentation(go_duration=('forever', ), viewports=[expPort, stratPort]) p2.add_controller(