def test1():
    streamhandler = StreamHandler()
    
    # Configure and start
    dev = MeasurementComputingMultiSignals(streamhandler = streamhandler)
    dev.configure( board_num = 0,
                          sampling_rate =1000.,
                          buffer_length = 60.,
                                )
    dev.initialize()
    dev.start()
    
    app = QtGui.QApplication([])
    w1=Oscilloscope(stream = dev.streams[0])
    w1.auto_gain_and_offset(mode = 2)
    w1.set_params(xsize = 20., refresh_interval = 100, mode = 'scan', ylims = [-8., 8.])
    w1.show()
    
    w2 = TimeFreq(stream = dev.streams[0], max_visible_on_open = 4)
    w2.set_params(refresh_interval = 100, xsize = 2.)
    w2.show()
    
    w3=OscilloscopeDigital(stream = dev.streams[1])
    w3.set_params(xsize = 20, mode = 'scan')    
    w3.show()
    
    app.exec_()
    
    # Stope and release the device
    dev.stop()
    dev.close()
def test1():
    streamhandler = StreamHandler()
    
    # Configure and start
    dev = FakeMultiSignals(streamhandler = streamhandler)
    dev.configure( 
                                nb_channel = 32,
                                sampling_rate =1000.,
                                buffer_length = 64.,
                                packet_size = 16,
                                )
    dev.initialize()
    dev.start()
    
    app = QtGui.QApplication([])
    w1=Oscilloscope(stream = dev.streams[0])
    w1.set_params(refresh_interval = 40,
                                                        xsize = 2.)
    w1.auto_gain_and_offset(mode = 2)
    w1.show()
    
    w2 = TimeFreq(stream = dev.streams[0], max_visible_on_open = 4)
    w2.set_params(refresh_interval = 40,
                                                        xsize = 2., nb_column = 1)
    w2.show()
    
    app.exec_()
    
    # Stope and release the device
    dev.stop()
    dev.close()
def main():
    streamhandler = StreamHandler()
    

    dev = EmotivMultiSignals(streamhandler = streamhandler)
    dev.configure(buffer_length = 1800)
    dev.initialize()
    dev.start()
    
    app = QtGui.QApplication([])
    w1=Oscilloscope(stream = dev.streams[0])
    w1.auto_gain_and_offset(mode = 2)
    w1.change_param_global(xsize = 10., refresh_interval = 100)
    w1.show()
    
    w2 = TimeFreq(stream = dev.streams[0], max_visible_on_open = 4)
    w2.change_param_global(refresh_interval = 100, xsize = 2.)
    w2.show()
    
    app.exec_()
    
    dev.stop()
    dev.close()
def teleMir_CB():
       
    streamhandler = StreamHandler()
    
    # Configure and start
    #~ dev = FakeMultiSignals(streamhandler = streamhandler)
    #~ dev.configure( #name = 'Test dev',
                                #~ nb_channel = 14,
                                #~ sampling_rate =128.,
                                #~ buffer_length = 10.,
                                #~ packet_size = 1,
                                #~ )
    #~ dev.initialize()
    #~ dev.start()
    

    filename = '/home/ran/Projets/pyacq_emotiv_recording/alex/Emotiv Systems Pty Ltd #SN201105160008860.raw'
    #filename = '/home/ran/Projets/pyacq_emotiv_recording/caro/Emotiv Systems Pty Ltd  #SN201105160008860.raw'
    #filename = '/home/mini/pyacq_emotiv_recording/simple_blink/Emotiv Systems Pty Ltd  #SN201105160008860.raw'
    filenameImp = '/home/ran/Projets/EEG_recordings/anneLise/Emotiv Systems Pty Ltd #SN200709276578911.raw'
    filenameXY = '/home/ran/Projets/EEG_recordings/anneLise/Emotiv Systems Pty Ltd #SN200709276578912.raw'

    
    precomputed = np.fromfile(filename , dtype = np.float32).reshape(-1, 14).transpose()
    precomputedImp = np.fromfile(filenameImp , dtype = np.float32).reshape(-1, 14).transpose()
    precomputedXY = np.fromfile(filenameXY , dtype = np.float32).reshape(-1, 2).transpose()
    
    
    # Configure and start signal
    dev = FakeMultiSignals(streamhandler = streamhandler)
    dev.configure( #name = 'Test dev',
                                nb_channel = 14,
                                sampling_rate =128.,
                                buffer_length = 30.,
                                packet_size = 1,
                                precomputed = precomputed,
                                )
    dev.initialize()
    dev.start()
    
    #~ # Configure and start imp
    #~ devImp = FakeMultiSignals(streamhandler = streamhandler)
    #~ devImp.configure( #name = 'Test dev',
                                #~ nb_channel = 14,
                                #~ sampling_rate =128.,
                                #~ buffer_length = 30.,
                                #~ packet_size = 1,
                                #~ precomputed = precomputedImp,
                                #~ )
    #~ devImp.initialize()
    #~ devImp.start()
    
    # Configure and start gyroXY
    devXY = FakeMultiSignals(streamhandler = streamhandler)
    devXY.configure( #name = 'Test dev',
                                nb_channel = 2,
                                sampling_rate =128.,
                                buffer_length = 30.,
                                packet_size = 1,
                                precomputed = precomputedXY,
                                )
    devXY.initialize()
    devXY.start()
    
     ## Configure and start output stream (for extracted feature)
    fout = TransmitFeatures(streamhandler = streamhandler)
    fout.configure( #name = 'Test fout',
                                nb_channel = 14, # np.array([1:5])
                                nb_feature = 6,
                                nb_pts = 128,
                                sampling_rate =10.,
                                buffer_length = 10.,
                                packet_size = 1,
                                )
    fout.initialize(stream_in = dev.streams[0], stream_xy = devXY.streams[0]) 
    fout.start()
    
    #Osc server
    #p = Process(target=., args=('bob',))
    
    #color = 'summer'
    # Bleu
    #color = 'jet'
    # Rouge
    color = 'hot'
    # vert/jaune
    #color = 'summer'
    
    app = QtGui.QApplication([])
    
        
    # Impedances
    w_imp=Topoplot_imp(stream = dev.streams[0], type_Topo= 'imp')
    w_imp.show()
    
    # freqbands 
    w_sp_bd=freqBandsGraphics(stream = dev.streams[0], interval_length = 3., channels = [12])
    w_sp_bd.run()  
    
    # signal
    w_oscilo=Oscilloscope(stream = dev.streams[0])
    w_oscilo.show()
    w_oscilo.set_params(xsize = 10, mode = 'scroll')
    w_oscilo.auto_gain_and_offset(mode = 2)
    w_oscilo.gain_zoom(100)
    #w_oscilo.set_params(colors = 'jet')
    select_chan = np.ones(14, dtype = bool)
    w_oscilo.automatic_color(cmap_name = 'jet', selected = select_chan)
    
    # parametres
    w_feat1=Oscilloscope_f(stream = fout.streams[0])
    w_feat1.show()
    w_feat1.set_params(colormap = color)
    #w_feat1.auto_gain_and_offset(mode = 1)
    #w_feat1.set_params(xsize = 10, mode = 'scroll')
    #~ select_feat = np.ones(6, dtype = bool)
   #~ # print select
    #~ #w_oscilo.set_params(colormap = 'automn',  selected = select)
    #~ w_feat1.automatic_color(cmap_name = 'jet', selected = select_feat)
    w_feat1.showFullScreen()
    
    w_feat1.set_params(xsize = 10, mode = 'scroll')
    #~ select_feat = np.ones(4, dtype = bool)
    #~ w_feat1.automatic_color(cmap_name = 'jet', selected = select_feat)
    
    
    # topographie
    w_topo=Topoplot(stream = dev.streams[0], type_Topo= 'topo')
    w_topo.show()
    
    # temps frequence 1

    w_Tf=TimeFreq(stream = dev.streams[0])
    w_Tf.show()  
    w_Tf.set_params(xsize = 10)
    w_Tf.change_param_tfr(f_stop = 45, f0 = 1)
    w_Tf.set_params(colormap = color)
    #w_Tf.clim_changed(20)
    #w_Tf.change_param_channel(clim = 20)
    
    # temps frequence 2
    w_Tf2=TimeFreq2(stream = dev.streams[0])
    w_Tf2.show()  
    w_Tf2.set_params(xsize = 10)
    w_Tf2.change_param_tfr(f_stop = 45, f0 = 1)
    w_Tf2.set_params(colormap = color)
    
    
    # kurtosis 
    #w_ku=KurtosisGraphics(stream = dev.streams[0], interval_length = 1.)
    #w_ku.run()  
    

    ## Bien moins fluide
    # Spectre
    #~ w_sp=SpectrumGraphics(dev.streams[0],3.,channels=[11,12])
    #~ w_sp.run()
    
    w1 = spaceShipLauncher(dev.streams[0])
    w1.run()
    w1.showFullScreen()

    
    app.exec_()
    
    # Stope and release the device
    fout.stop()
    fout.close()  
    print 'ici'
    dev.stop()
    dev.close()
    print 'ici'
    devXY.stop()
    devXY.close()
    print 'ici'
    devImp.stop()
    devImp.close()
    print 'ici'
Ejemplo n.º 5
0
def teleMir_CB():
       
    streamhandler = StreamHandler()
    
    # Configure and start
    #~ dev = FakeMultiSignals(streamhandler = streamhandler)
    #~ dev.configure( #name = 'Test dev',
                                #~ nb_channel = 14,
                                #~ sampling_rate =128.,
                                #~ buffer_length = 10.,
                                #~ packet_size = 1,
                                #~ )
    #~ dev.initialize()
    #~ dev.start()
    
    #filename = '/home/mini/pyacq_emotiv_recording/rec 2013-09-19 16:20:36.580141_Alex/Emotiv Systems Pty Ltd #SN201105160008860.raw'
    #filename = '/home/mini/pyacq_emotiv_recording/rec 2013-09-18 14:12:09.347990_Caro/Emotiv Systems Pty Ltd  #SN201105160008860.raw'
    filename = '/home/mini/pyacq_emotiv_recording/simple_blink/Emotiv Systems Pty Ltd  #SN201105160008860.raw'
    
    precomputed = np.fromfile(filename , dtype = np.float32).reshape(-1, 14).transpose()
    
    # Configure and start
    dev = FakeMultiSignals(streamhandler = streamhandler)
    dev.configure( #name = 'Test dev',
                                nb_channel = 14,
                                sampling_rate =128.,
                                buffer_length = 30.,
                                packet_size = 1,
                                precomputed = precomputed,
                                )
    dev.initialize()
    dev.start()
    
     ## Configure and start output stream (for extracted feature)
    fout = TransmitFeatures(streamhandler = streamhandler)
    fout.configure( #name = 'Test fout',
                                nb_channel = 14, # np.array([1:5])
                                nb_feature = 4,
                                nb_pts = 128,
                                sampling_rate =10.,
                                buffer_length = 10.,
                                packet_size = 1,
                                )
    fout.initialize(stream_in = dev.streams[0]) 
    fout.start()
    
    #Osc server
    #p = Process(target=., args=('bob',))
    
    
    app = QtGui.QApplication([])
    
    # Impedances
    #~ w_imp=Topoplot(stream = dev.streams[0], type_Topo= 'imp')
    #~ w_imp.show()
    
    # signal
    w_oscilo=Oscilloscope(stream = dev.streams[0])
    w_oscilo.show()
    w_oscilo.auto_gain_and_offset(mode = 1)
    w_oscilo.set_params(xsize = 10, mode = 'scroll')
    
    # temps frequence
    w_Tf=TimeFreq(stream = dev.streams[0])
    w_Tf.show()  
    w_Tf.set_params(xsize = 10)
    w_Tf.change_param_tfr(f_stop = 45, f0 = 1)
    #w_Tf.change_param_channel(clim = 20)
    
    # kurtosis 
    #w_ku=KurtosisGraphics(stream = dev.streams[0], interval_length = 1.)
    #w_ku.run()  
    
    # freqbands 
    w_sp_bd=freqBandsGraphics(stream = dev.streams[0], interval_length = 3., channels = [11,12])
    w_sp_bd.run()  
    
    ## Bien moins fluide
    # Spectre
    #~ w_sp=SpectrumGraphics(dev.streams[0],3.,channels=[11,12])
    #~ w_sp.run()
    
    w_feat1=Oscilloscope(stream = fout.streams[0])
    w_feat1.show()
    w_feat1.set_params(xsize = 10, mode = 'scroll')
    
    #w1 = glSpaceShip(dev.streams[0])
    #w1.run()
    #w1.showFullScreen()
    
       
    
    app.exec_()
    
    # Stope and release the device
    fout.stop()
    fout.close()  
    dev.stop()
    dev.close()
Ejemplo n.º 6
0
    def __init__(self):

        self.streamhandler = StreamHandler()
        ## Configure and start acquisition
        self.dev = EmotivMultiSignals(streamhandler = self.streamhandler)
        self.dev.configure(buffer_length = 1800)
        self.dev.initialize()
        self.dev.start()

            ## Configure and start output stream (for extracted feature)
        self.fout = TransmitFeatures(streamhandler = self.streamhandler)
        self.fout.configure( #name = 'Test fout',
                                    nb_channel = 14, # np.array([1:5])
                                    nb_feature = 6,
                                    nb_pts = 128,
                                    sampling_rate =10.,
                                    buffer_length = 10.,
                                    packet_size = 1,
                                    )
        self.fout.initialize(stream_in = self.dev.streams[0], stream_xy = self.dev.streams[2])
        self.fout.start()

        self.screensize = np.array((1920))

        # Impedances
        self.w_imp=Topoplot_imp(stream = self.dev.streams[0], type_Topo = 'imp')
        self.w_imp.show()

        # signal
        numscreen = 1
        self.w_oscilo=Oscilloscope(stream = self.dev.streams[0])
        self.w_oscilo.auto_gain_and_offset(mode = 2)
        self.w_oscilo.set_params(xsize = 10, mode = 'scroll')
        self.w_oscilo.automatic_color('jet')
        self.w_oscilo.move(self.screensize + (numscreen-1) * 800 ,200)
        #~ self.w_oscilo.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
        self.w_oscilo.show()

        #parametres
        numscreen = 2
        self.w_feat1=Oscilloscope(stream = self.fout.streams[0])
        self.w_feat1.auto_gain_and_offset(mode = 0)
        self.w_feat1.set_params(xsize = 10, mode = 'scroll')
        self.w_feat1.set_params(colors = [[0, 0, 255], [255, 0, 255], [255, 0 ,0], [255, 255, 0], [0, 255, 0],  [0, 255, 255]])
        self.w_feat1.set_params(ylims = [0,100])
        self.w_feat1.move(self.screensize + (numscreen-1) * 800 ,200)
        #~ self.w_feat1.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
        self.w_feat1.show()

        #topo
        numscreen = 3
        self.w_topo=Topoplot(stream = self.dev.streams[0], type_Topo = 'topo')
        self.w_topo.move(self.screensize + (numscreen-1) * 800 ,200)
        self.w_topo.show()

        # giro
        #~ self.w_xy=Oscilloscope(stream = self.devXY.streams[0])
        #~ self.w_xy.show()
        #~ self.w_xy.auto_gain_and_offset(mode = 1)
        #~ self.w_xy.set_params(xsize = 10, mode = 'scroll')

        # temps frequence
        numscreen = 4
        self.w_Tf=TimeFreq(stream = self.dev.streams[0])
        self.w_Tf.set_params(xsize = 10)
        self.w_Tf.change_param_tfr(f_stop = 45, f0 = 1)
        self.w_Tf.move(self.screensize + (numscreen-1) * 800 ,200)
        self.w_Tf.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
        self.w_Tf.show()

        numscreen = 5
        # self.w_Tf2=TimeFreq2(stream = self.dev.streams[0])
        # self.w_Tf2.set_params(xsize = 10)
        # self.w_Tf2.change_param_tfr(f_stop = 45, f0 = 1)
        # self.w_Tf2.move(self.screensize + (numscreen-1) * 800 ,200)
        # self.w_Tf2.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
        # self.w_Tf2.show()
        #w_Tf.change_param_channel(clim = 20)

        #~ # freqbands
        numscreen = 6 # dans le code
        self.w_sp_bd=freqBandsGraphics(stream = self.dev.streams[0], interval_length = 3., channels = [11])
        self.w_sp_bd.run()
def teleMir_CB():
    streamhandler = StreamHandler()

    # Configure and start
    dev = EmotivMultiSignals(streamhandler=streamhandler)
    dev.configure(buffer_length=1800, device_path="")  # doit être un multiple du packet size
    dev.initialize()
    dev.start()

    ## Configure and start output stream (for extracted feature)
    fout = TransmitFeatures(streamhandler=streamhandler)
    fout.configure(  # name = 'Test fout',
        nb_channel=14,  # np.array([1:5])
        nb_feature=6,
        nb_pts=128,
        sampling_rate=10.0,
        buffer_length=10.0,
        packet_size=1,
    )
    fout.initialize(stream_in=dev.streams[0], stream_xy=dev.streams[2])
    fout.start()

    # 1 : Rouge
    # ~ color = 'hot'
    # 2 : vert/jaune
    # ~ color = 'summer'
    # 3 : Bleu
    color = "jet"

    app = QtGui.QApplication([])

    # Impedances
    w_imp = Topoplot_imp(stream=dev.streams[1], type_Topo="imp")
    w_imp.show()

    # freqbands
    w_sp = freqBandsGraphics(stream=dev.streams[0], interval_length=1.0, channels=[12])
    w_sp.run()

    # spaceship
    # ~ w_spsh=spaceShipLauncher(dev.streams[2], cubeColor = color)
    # ~ w_spsh.run()

    # signal
    w_oscilo = Oscilloscope(stream=dev.streams[0])
    w_oscilo.show()
    w_oscilo.auto_gain_and_offset(mode=2)
    # w_oscilo.gain_zoom(10)
    w_oscilo.set_params(xsize=10, mode="scroll")
    select_chan = np.ones(14, dtype=bool)
    w_oscilo.automatic_color(cmap_name="jet", selected=select_chan)

    # parametres
    w_feat1 = Oscilloscope_f(stream=fout.streams[0])
    w_feat1.show()
    w_feat1.set_params(xsize=10, mode="scroll")
    select_feat = np.ones(6, dtype=bool)
    w_feat1.automatic_color(cmap_name="jet", selected=select_feat)

    # topographie
    w_topo = Topoplot(stream=dev.streams[0], type_Topo="topo")
    w_topo.show()

    # temps frequence 1
    w_Tf1 = TimeFreq(stream=dev.streams[0])
    w_Tf1.show()
    w_Tf1.set_params(xsize=10)
    w_Tf1.set_params(colormap=color)
    w_Tf1.change_param_tfr(f_stop=45, f0=1)

    # temps frequence 2
    w_Tf2 = TimeFreq2(stream=dev.streams[0])
    w_Tf2.show()
    w_Tf2.set_params(xsize=10)
    w_Tf2.change_param_tfr(f_stop=45, f0=1)
    w_Tf2.set_params(colormap=color)

    # ~ timer = QTimer()
    # ~ timer.setInterval(3000) # 5 seconds
    # ~ timer.start()
    # ~ timer.timeout.connect(app.quit)

    app.exec_()
    # app.startTimer(2000)

    # Stope and release the device
    fout.stop()
    fout.close()
    dev.stop()
    dev.close()