def grab_some_data(emokit,blocking_queue): #ask reader to clear thoughts, pause til they do baselines = base_lines() baselines.get_base_lines(blocking_queue) blocking_queue.set_size(1) #this while loop is only for testing the drawing while True: #all processing goes here packet = blocking_queue.get() while(packet == []): packet = blocking_queue.get() gevent.sleep(0) list[0] = baselines.calculate_deviation('AF3',packet[0].sensors['AF3']['value']) list[1] = baselines.calculate_deviation('AF4',packet[0].sensors['AF4']['value']) list[2] = baselines.calculate_deviation('F7',packet[0].sensors['F7']['value']) list[3] = baselines.calculate_deviation('F3',packet[0].sensors['F3']['value']) list[4] = baselines.calculate_deviation('F4',packet[0].sensors['F4']['value']) list[5] = baselines.calculate_deviation('F8',packet[0].sensors['F8']['value']) list[6] = baselines.calculate_deviation('FC5',packet[0].sensors['FC5']['value']) list[7] = baselines.calculate_deviation('FC6',packet[0].sensors['FC6']['value']) list[8] = baselines.calculate_deviation('T7',packet[0].sensors['T7']['value']) list[9] = baselines.calculate_deviation('T8',packet[0].sensors['T8']['value']) list[10] = 0 list[11] = 0 list[12] = baselines.calculate_deviation('P7',packet[0].sensors['P7']['value']) list[13] = baselines.calculate_deviation('P8',packet[0].sensors['P8']['value']) list[14] = baselines.calculate_deviation('O1',packet[0].sensors['O1']['value']) list[15] = baselines.calculate_deviation('O2',packet[0].sensors['O2']['value']) eeg_draw.update_sensors(list) gevent.sleep(1) emokit.interrupt()
def grab_some_data(emokit, blocking_queue, screen): instruct = pygame.image.load("Instructions.jpg") right = pygame.image.load("Right.jpg") left = pygame.image.load("Left.jpg") up = pygame.image.load("Up.jpg") down = pygame.image.load("Down.jpg") baselines = base_lines() baselines.get_base_lines(blocking_queue) screen.blit(instruct, (0, 0)) pygame.display.flip() test = True while test: for event in pygame.event.get(): if event.type == pygame.locals.KEYDOWN: test = False gevent.sleep(0) screen.blit(right, (0, 0)) pygame.display.flip() file = open("right.txt", "w") gevent.sleep(4) lst = blocking_queue.get() if lst[1] != {}: file.write("made it") file.close() # for example: emokit.interrupt()
def grab_some_data(emokit,blocking_queue): #ask reader to clear thoughts, pause til they do baselines = base_lines() baselines.get_base_lines(blocking_queue) #this is where application code goes #for example: print baselines.readings