def __init__(self): print 'debut vol' self.streamhandler = StreamHandler() ## Configure and start self.dev = EmotivMultiSignals(streamhandler = self.streamhandler) self.dev.configure(buffer_length = 1800) self.dev.initialize() self.dev.start() self.fout = TransmitFeatures(streamhandler = self.streamhandler) self.fout.configure( #name = 'Test fout', nb_channel = 14, # np.array([1:5]) nb_feature = 9, nb_pts = 128, sampling_rate =10., buffer_length = 10., packet_size = 1, ) # <pyacq.core.streamtypes.AnalogSignalSharedMemStream object at 0x000000001A8D5A20> self.fout.initialize(stream_in = self.dev.streams[0]) #, stream_xy = self.dev.streams[2]) self.fout.start() mainScreen = 1920 subScreen = 640 # signal numscreen = 4 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(mainScreen + (numscreen-1) * subScreen- 30 , -40) self.w_oscilo.resize(810,530) # self.w_oscilo.setWindowState(QtCore.Qt.WindowFullScreen) self.w_oscilo.setWindowFlags(QtCore.Qt.CustomizeWindowHint) self.w_oscilo.show() #parametres numscreen = 5 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.automatic_color('jet') self.w_feat1.set_params(colors = [[0, 0, 255], [255, 0, 255], [255, 0 ,0], [255, 255, 0], [0, 0, 0], [0, 0, 0], [0, 255, 0], [0, 255, 255], [0, 0, 0]]) self.w_feat1.set_params(selected = [True, True, True, True, False, False, True, True, False]) self.w_feat1.set_params(xsize = 10, mode = 'scroll', selected = [True, True, True, True, False, False, True, True, False]) self.w_feat1.set_params(ylims = [-10,110]) self.w_feat1.move(mainScreen + (numscreen-1) * subScreen- 30 , -40) self.w_feat1.resize(800,500) # self.w_feat1.setWindowState(QtCore.Qt.WindowFullScreen) # self.w_feat1.setWindowFlags(QtCore.Qt.CustomizeWindowHint) self.w_feat1.show() self.timer = QTimer(singleShot=True, interval=13000) self.timer.timeout.connect(lambda :self.w_oscilo.auto_gain_and_offset(mode = 2)) self.timer.start()
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 = ComediMultiSignals(streamhandler = streamhandler) dev.configure( device_path = '/dev/comedi0', sampling_rate =15000., buffer_length = 60., ) dev.initialize() dev.start() app = QtGui.QApplication([]) w1=Oscilloscope(stream = dev.streams[0]) #w1.auto_gain_and_offset(mode = 0) visibles = np.zeros(dev.nb_channel, dtype = bool) visibles[21] = True w1.set_params(xsize = 3.7, refresh_interval = 100, mode = 'scan', ylims = [-1.5, 1.5], visibles = visibles, gains = np.ones(dev.nb_channel), offsets = np.zeros(dev.nb_channel), ) w1.show() app.exec_() dev.stop() dev.close() w1.stop()
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 test1(): streamhandler = StreamHandler() filename = 'cerveau_alex.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() app = QtGui.QApplication([]) w1=Oscilloscope(stream = dev.streams[0]) w1.show() w1.auto_gain_and_offset(mode = 1) w1.set_params(xsize = 10.) app.exec_() # Stope and release the device dev.stop() dev.close()
def trigger_analog1(): streamhandler = StreamHandler() # Configure and start dev = FakeMultiSignals(streamhandler = streamhandler) dev.configure( #name = 'Test dev', nb_channel = 32, sampling_rate =1000., buffer_length = 64, packet_size = 100, last_channel_is_trig = True, ) dev.initialize() dev.start() def print_pos(pos): print pos trigger = AnalogTrigger(stream = dev.streams[0], threshold = 0.25, front = '+', channel = dev.nb_channel-1, #~ debounce_mode = 'no-debounce', debounce_mode = 'after-stable', #~ debounce_mode = 'before-stable', debounce_time = 0.05, callbacks = [ print_pos, ] ) app = QtGui.QApplication([]) w1=Oscilloscope(stream = dev.streams[0]) w1.show() visibles = np.ones(dev.nb_channel, dtype = bool) visibles[4:] = False w1.set_params(xsize = 4.7, mode = 'scan', visibles = visibles) time.sleep(.5) w1.auto_gain_and_offset(mode = 2) app.exec_() print 1 # Stope and release the device trigger.stop() print 2 dev.stop() print 3 dev.close() print 4
def teleMir_CB(): streamhandler = StreamHandler() # Configure and start dev = EmotivMultiSignals(streamhandler = streamhandler) dev.configure(buffer_length = 1800, # doit être un multiple du packet size device_path = '',) 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() app = QtGui.QApplication([]) #impédances w_imp=Topoplot(stream = dev.streams[1], type_Topo = 'imp') w_imp.show() w_oscilo=Oscilloscope(stream = dev.streams[1]) w_oscilo.show() app.exec_() # Stope and release the device fout.stop() fout.close() dev.stop() dev.close()
def teleMir_CB(): streamhandler = StreamHandler() # Configure and start dev1 = EmotivMultiSignals(streamhandler = streamhandler) dev1.configure(buffer_length = 1800, # doit être un multiple du packet size device_path = '/dev/hidraw3',) dev1.initialize() dev1.start() dev2 = EmotivMultiSignals(streamhandler = streamhandler) dev2.configure(buffer_length = 1800, # doit être un multiple du packet size device_path = '/dev/hidraw5',) dev2.initialize() dev2.start() app = QtGui.QApplication([]) # gyro 1 w_oscilo1=Oscilloscope(stream = dev1.streams[2]) w_oscilo1.show() # gyro 2 w_oscilo2=Oscilloscope(stream = dev2.streams[2]) w_oscilo2.show() app.exec_() # Stope and release the device dev1.stop() dev1.close() dev2.stop() dev2.close()
def __init__(self): self.streamhandler = StreamHandler() ## Configure and start self.dev = EmotivMultiSignals(streamhandler = self.streamhandler) self.dev.configure(buffer_length = 1800) # doit être un multiple du packet size self.dev.initialize() self.dev.start() # Impedances self.w_imp=Topoplot_imp(stream = self.dev.streams[1], type_Topo = 'imp') self.w_imp.show() self.w_oscilo=Oscilloscope(stream =self.dev.streams[1]) self.w_oscilo.show()
class TeleMir_Calibration: def __init__(self): self.streamhandler = StreamHandler() ## Configure and start self.dev = EmotivMultiSignals(streamhandler = self.streamhandler) self.dev.configure(buffer_length = 1800) # doit être un multiple du packet size self.dev.initialize() self.dev.start() # Impedances self.w_imp=Topoplot_imp(stream = self.dev.streams[1], type_Topo = 'imp') self.w_imp.show() self.w_oscilo=Oscilloscope(stream =self.dev.streams[1]) self.w_oscilo.show() def close(self): #close window # self.w_imp.close_osc() self.w_imp.close() self.w_oscilo.close() # Stope and release the device self.dev.stop() self.dev.close()
def test1(): streamhandler = StreamHandler() # Configure and start dev = FakeMultiSignals(streamhandler = streamhandler) dev.configure( #~ nb_channel = 16, #~ sampling_rate =1000., #~ buffer_length = 64, #~ packet_size = 100, nb_channel = 8, sampling_rate =10000., buffer_length = 64, packet_size = 100, last_channel_is_trig = True, ) dev.initialize() print dev.streams[0] print dev.streams[0]['port'] dev.start() app = QtGui.QApplication([]) w1=TriggeredOscilloscope(stream = dev.streams[0]) w1.set_params(channel = dev.nb_channel-1, left_sweep = -.1, right_sweep = +.3, threshold = .25, #~ debounce_mode = 'no-debounce', debounce_mode = 'after-stable', #~ debounce_mode = 'before-stable', debounce_time = 0.05, ) w1.show() w2=Oscilloscope(stream = dev.streams[0]) w2.show() w2.auto_gain_and_offset(mode = 0) w2.set_params(xsize = 5, mode = 'scroll') app.exec_() w1.stop() # Stope and release the device dev.stop() dev.close()
def on_pc2(): streamhandler = StreamHandler() converter2 = AnaSigPlainData_to_AnaSigSharedMem( streamhandler, "tcp://localhost:{}".format(info_port), buffer_length=20.0, timeout_reconnect=0.5 ) app = QtGui.QApplication([]) w1 = Oscilloscope(stream=converter2.sharedmem_stream) w1.show() w1.auto_gain_and_offset(mode=1) w1.set_params(xsize=5.0, mode="scan") app.exec_()
def test1(): streamhandler = StreamHandler() # Configure and start dev = MeasurementComputingMultiSignals(streamhandler=streamhandler) dev.configure(board_num=0, sampling_rate=10000.0, buffer_length=60.0) dev.initialize() dev.start() app = QtGui.QApplication([]) w1 = Oscilloscope(stream=dev.streams[0]) w1.auto_gain_and_offset(mode=2) w1.set_params(xsize=5.0, refresh_interval=100, mode="scan", ylims=[-8.0, 8.0]) w1.show() app.exec_() # Stope and release the device dev.stop() dev.close()
def run_test(): streamhandler = StreamHandler() ## Configure and start acquisition stream 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() ## 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 = 21, nb_pts = 128, sampling_rate =10., buffer_length = 10., packet_size = 1, ) fout.initialize(stream_in = dev.streams[0]) fout.start() app = QtGui.QApplication([]) w_in=Oscilloscope(stream = dev.streams[0]) w_in.show() w_out=Oscilloscope(stream = fout.streams[0]) w_out.show() app.exec_() ## Stop and release devices fout.stop() fout.close() dev.stop() dev.close() print 'fout and dev devises closed'
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 test1(): streamhandler = StreamHandler() # Configure and start dev = FakeMultiSignals(streamhandler = streamhandler) dev.configure( nb_channel = 16, sampling_rate =1000., buffer_length = 64, packet_size = 10, ) dev.initialize() print dev.streams[0] print dev.streams[0]['port'] dev.start() app = QtGui.QApplication([]) w1=Oscilloscope(stream = dev.streams[0]) w1.show() #~ w1.auto_gain_and_offset(mode = 2) #~ visibles = np.ones(16, dtype = bool) #~ visibles[4:] = False #~ w1.set_params(xsize = 1., #~ mode = 'scan', #~ visibles = visibles) #~ print w1.get_params() w1.set_params(**w1.get_params()) #~ w2=Oscilloscope(stream = dev.streams[0]) #~ w2.show() #~ w2.auto_gain_and_offset(mode = 0) #~ w2.set_params(xsize = 5, mode = 'scroll') app.exec_() # Stope and release the device dev.stop() dev.close()
def __init__(self, precomputed, precomputedXY): self.streamhandler = StreamHandler() # Configure and start self.dev = FakeMultiSignals(streamhandler = self.streamhandler) self.dev.configure( #name = 'Test dev', nb_channel = 14, sampling_rate =128., buffer_length = 30., packet_size = 1, precomputed = precomputed, ) self.dev.initialize() self.dev.start() # Configure and start self.devXY = FakeMultiSignals(streamhandler = self.streamhandler) self.devXY.configure( #name = 'Test dev', nb_channel = 2, sampling_rate =128., buffer_length = 30., packet_size = 1, precomputed = precomputedXY, ) self.devXY.initialize() self.devXY.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 = 12, nb_pts = 128, sampling_rate =10., buffer_length = 10., packet_size = 1, ) self.fout.initialize(stream_in = self.dev.streams[0], stream_xy = self.devXY.streams[0]) 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
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'
def filter_analog1(): streamhandler = StreamHandler() # Configure and start dev = FakeMultiSignals(streamhandler = streamhandler) dev.configure( nb_channel = 2, sampling_rate =10000., buffer_length = 30., packet_size = 100, last_channel_is_trig = True, ) dev.initialize() dev.start() dev2 = FakeDigital(streamhandler = streamhandler) dev2.configure( nb_channel = 30, sampling_rate =10000., buffer_length = 30., packet_size = 100, ) dev2.initialize() dev2.start() filter = BandPassFilter(stream = dev.streams[0], streamhandler= streamhandler, autostart = False, f_start =0., f_stop = dev.streams[0].sampling_rate/10./2., ) decimator = SimpleDecimator( filter.out_stream, streamhandler= streamhandler, downsampling_factor = 10, autostart = False, ) decimator2 = SimpleDecimator( dev2.streams[0], streamhandler= streamhandler, downsampling_factor = 10, autostart = False, ) print decimator2.out_stream._params app = QtGui.QApplication([]) filter.start() decimator.start() decimator2.start() visibles = np.ones(dev.nb_channel, dtype = bool) visibles[1:] = False w1=Oscilloscope(stream = dev.streams[0]) w2=Oscilloscope(stream = filter.out_stream) w3=Oscilloscope(stream = decimator.out_stream) w4 = OscilloscopeDigital(stream = dev2.streams[0]) w5 = OscilloscopeDigital(stream = decimator2.out_stream) time.sleep(.5) for w in [w1, w2, w3]: w.auto_gain_and_offset(mode = 0) w.set_params(xsize = 1., mode = 'scan', visibles = visibles, ylims = [-5,5] ) w.show() for w in [w4, w5]: w.set_params(xsize = 1., mode = 'scan', ) w.show() app.exec_() w1.stop() w2.stop() 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/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()
def filter_analog1(): streamhandler = StreamHandler() # Configure and start dev = FakeMultiSignals(streamhandler = streamhandler) dev.configure( nb_channel = 64, sampling_rate =10000., buffer_length = 30., packet_size = 100, last_channel_is_trig = True, ) dev.initialize() dev.start() filter = BandPassFilter(stream = dev.streams[0], streamhandler= streamhandler, autostart = False) app = QtGui.QApplication([]) filter.start() time.sleep(.2) filter.set_params(f_start = 300., f_stop =np.inf) time.sleep(.2) filter.set_params(f_start = 0., f_stop =40.3) time.sleep(.2) filter.set_params(f_start = 30., f_stop =70.) visibles = np.ones(dev.nb_channel, dtype = bool) visibles[1:] = False w1=Oscilloscope(stream = dev.streams[0]) w2=Oscilloscope(stream = filter.out_stream) time.sleep(.5) for w in [w1, w2]: w.auto_gain_and_offset(mode = 0) w.set_params(xsize = 1., mode = 'scan', visibles = visibles, ylims = [-5,5] ) w.show() #~ w3=TimeFreq(stream = dev.streams[0]) #~ w4=TimeFreq(stream = filter.out_stream) #~ for w in [w3, w4]: #~ w.set_params(colormap = 'hot', visibles = visibles, #~ xsize=30, #~ nb_column = 1) #~ w.show() app.exec_() w1.stop() w2.stop() dev.stop() dev.close()
def test2(): import neo bl = neo.BrainVisionIO(filename = 'KLAJU_0002.vhdr').read()[0] seg = bl.segments[0] precomputed_sigs = np.concatenate( [[sig.magnitude] for sig in seg.analogsignals] ) sr = bl.segments[0].analogsignals[0].sampling_rate.rescale('Hz').magnitude nb_channel = precomputed_sigs.shape[0] #~ print [ e.times.size for e in seg.eventarrays ] # IL y a deux eventarray dans le fichie ron prend le 2eme trig_times = seg.eventarrays[1].times.rescale('s').magnitude trig_pos = (trig_times*sr).astype('int64') trig_labels = seg.eventarrays[1].labels # on rabotte pour eviter d'attendre pos0 = trig_pos[0]-1 trig_pos -= pos0 precomputed_sigs = precomputed_sigs[:, pos0:] #~ print trig_times[:20] #~ print trig_labels[:20] precomputed_trigs = np.array( zip(trig_pos,trig_labels) , dtype = [('pos', 'int64'), ('label', 'S4'), ]) print precomputed_trigs[:20] print 'sampling rate', sr print 'nb_channel rate', nb_channel print 'nb triggers', precomputed_trigs.size streamhandler = StreamHandler() # Configure and start dev = FakeMultiSignalsAndTriggers(streamhandler = streamhandler) dev.configure( #name = 'Test dev', nb_channel = nb_channel, sampling_rate =sr, buffer_length = 30., packet_size = 20, precomputed_sigs = precomputed_sigs, precomputed_trigs = precomputed_trigs, ) dev.initialize() dev.start() def on_new_trigger(pos, label): print pos, label app = QtGui.QApplication([]) w1=Oscilloscope(stream = dev.streams[0]) w1.show() w1.auto_gain_and_offset(mode = 1) w1.set_params(xsize = 10.) listen_trigger = ThreadListenTriggers(stream = dev.streams[1]) listen_trigger.new_trig.connect(on_new_trigger) listen_trigger.start() app.exec_() # Stope and release the device dev.stop() dev.close() listen_trigger.stop()
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()
class TeleMir_Vol: 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 close(self): #close windows self.w_imp.close() self.w_oscilo.close() self.w_feat1.close() self.w_topo.close() #~ self.w_xy.close() self.w_Tf.close() self.w_Tf2.close() #~ self.w_sp_bd.close() # Stope and release the device self.fout.stop() self.fout.close() self.dev.stop() self.dev.close()