예제 #1
0
            # wait for remaining time to next frame show
            tickFPS = Clock.tick(fps)

            # update window title
            pygame.display.set_caption("Press Esc to quit. FPS: %.2f PACKETS: %d" % 
                                       (Clock.get_fps(), pulled))

            # erase screen to black
            screen.fill((255,255,255))

            # plot the signals
            gr_height = 600 // 14
            gr_width = 750

            # get a handle to the buffer
            buf = eeg.buffer()

            for s in range(14):
                chan_name = counter_to_sensor_id[s]

                zero_ax_y = gr_height * s + gr_height // 2

                # draw the zero axis
                pygame.draw.line(screen, (0, 0, 255), (50, zero_ax_y), (800, zero_ax_y))

                # draw the signal onto the screen
                sig = buf[:,s]
                zero_lev = np.mean(sig)
                sig_amp = max(np.max(sig) - zero_lev, zero_lev - np.min(sig))
                if sig_amp == 0:
                    sig_amp = 1.0
예제 #2
0
from emotiv_device import EmotivDevice
from emotiv_data_packet import EmotivDataPacket
from signal_buffer import SignalBuffer



if __name__ == '__main__':
    
    print("Setting up device ...")

    dev = EmotivDevice('SN20120229000254')
    
    print("Starting reader ...")

    dev.start_reader()

    rb = SignalBuffer(64, 14)
    
    for rbp in range(10):
        pp = rb.pull_packets(dev)
        print("Pulled %d packets." % pp)
        print rb.buffer().shape
        time.sleep(0.2)

    print("Stopping reader ...")

    dev.stop_reader()

    print("Done.")