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 device_path = '',) self.dev.initialize() self.dev.start() # Impedances self.w_imp=Topoplot_imp(stream = self.dev.streams[1], type_Topo = 'imp') self.w_imp.show() def close(self): #close window self.w_imp.close() # Stope and release the device self.dev.stop() self.dev.close()
def test1(): devices = EmotivMultiSignals.get_available_devices() if len(devices) > 0: for name, info_device in devices.items(): print name print info_device else: print 'No Devices Found'
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 __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 device_path = '',) self.dev.initialize() self.dev.start() # Impedances self.w_imp=Topoplot_imp(stream = self.dev.streams[1], type_Topo = 'imp') self.w_imp.show()
def initUI(self): self.setGeometry(300, 300, 250, 250) self.setWindowTitle('TeleMir') #~ self.setWindowIcon(QtGui.QIcon('web.png')) self.btn_1 = QtGui.QPushButton('Calibration', self) self.btn_1.clicked.connect(self.calibration) self.btn_1.resize(self.btn_1.sizeHint()) self.btn_1.move(90, 50) self.btn_1.setEnabled(True) self.btn_2 = QtGui.QPushButton('Start', self) self.btn_2.clicked.connect(self.start) self.btn_2.resize(self.btn_2.sizeHint()) self.btn_2.move(90, 100) self.btn_2.setEnabled(False) self.btn_3 = QtGui.QPushButton('Stop', self) self.btn_3.clicked.connect(self.stop) self.btn_3.resize(self.btn_3.sizeHint()) self.btn_3.move(90, 150) self.btn_3.setEnabled(False) self.oscIP = '127.0.0.1' self.oscPort = 9009 self.oscClient = OSC.OSCClient() self.oscMsg = OSC.OSCMessage() self.receive_address = self.oscIP, 9010 self.mainScreen = 1920 self.subScreen = 640 self.screensize = np.array((1920)) self.show() self.state = 0 self.oscServer = OSC.ThreadingOSCServer(self.receive_address) self.oscServer.addMsgHandler("/stop", self.stop_handler) self.serverThread = threading.Thread(target=self.oscServer.serve_forever) self.serverThread.start() 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()
def main(): streamhandler = StreamHandler() dev = EmotivMultiSignals(streamhandler = streamhandler) dev.configure(buffer_length = 1800,device_path = '',) # doit être un multiple du packet size # 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() app = QtGui.QApplication([]) # w1=ScanningOscilloscope(dev.streams[2],2.,channels=[0,1]) w1=spaceShipLauncher(dev.streams[2]) # w1=SpectrumGraphics(dev.streams[0],3.,channels=[11,12]) # w2=KurtosisGraphics(dev.streams[0],3.,channels=range(2,8)) # w2=Topoplot(stream = dev.streams[1], type_Topo ='imp') w1.run() # w2.show() #w1.showFullScreen() app.exec_() w1.connect(w1,QtCore.SIGNAL("fermeturefenetre()"),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 run_Emotiv(): streamhandler = StreamHandler() # Configure and start dev = EmotivMultiSignals(streamhandler=streamhandler) dev.configure(buffer_length=1800, device_path="/dev/hidraw1") dev.initialize() dev.start() # Create and starts receiver with multuprocessing stream_chan = dev.streams[0] stream_imp = dev.streams[1] stream_gyro = dev.streams[2] stop_recv = mp.Value("i", 0) process_chan = mp.Process(target=test_recv_loop, args=(stream_chan["port"], stop_recv)) process_imp = mp.Process(target=test_recv_loop, args=(stream_imp["port"], stop_recv)) process_gyro = mp.Process(target=test_recv_loop, args=(stream_gyro["port"], stop_recv)) process_chan.start() process_imp.start() process_gyro.start() time.sleep(10.0) stop_recv.value = 1 process_chan.join() process_imp.join() process_gyro.join() # Stope and release the device dev.stop() dev.close()
class TeleMirMainWindow(QtGui.QWidget): def __init__(self): super(TeleMirMainWindow, self).__init__() self.initUI() def initUI(self): self.setGeometry(300, 300, 250, 250) self.setWindowTitle('TeleMir') #~ self.setWindowIcon(QtGui.QIcon('web.png')) self.btn_1 = QtGui.QPushButton('Calibration', self) self.btn_1.clicked.connect(self.calibration) self.btn_1.resize(self.btn_1.sizeHint()) self.btn_1.move(90, 50) self.btn_1.setEnabled(True) self.btn_2 = QtGui.QPushButton('Start', self) self.btn_2.clicked.connect(self.start) self.btn_2.resize(self.btn_2.sizeHint()) self.btn_2.move(90, 100) self.btn_2.setEnabled(False) self.btn_3 = QtGui.QPushButton('Stop', self) self.btn_3.clicked.connect(self.stop) self.btn_3.resize(self.btn_3.sizeHint()) self.btn_3.move(90, 150) self.btn_3.setEnabled(False) self.oscIP = '127.0.0.1' self.oscPort = 9009 self.oscClient = OSC.OSCClient() self.oscMsg = OSC.OSCMessage() self.receive_address = self.oscIP, 9010 self.mainScreen = 1920 self.subScreen = 640 self.screensize = np.array((1920)) self.show() self.state = 0 self.oscServer = OSC.ThreadingOSCServer(self.receive_address) self.oscServer.addMsgHandler("/stop", self.stop_handler) self.serverThread = threading.Thread(target=self.oscServer.serve_forever) self.serverThread.start() 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() def stop_handler(self, arg1, arg2, arg3, arg4): print "OSC stop received" if self.state == 1: self.stop() def calibration(self): print 'TeleMir :: Calibration' self.sendOSC('/calib', self.oscPort) self.TC = TeleMir_Calibration() self.btn_1.setEnabled(False) self.btn_2.setEnabled(True) print 'TeleMir :: fin Calibration' def start(self): print 'TeleMir :: entree start' self.state = 1 # self.oscServer = OSC.ThreadingOSCServer(self.receive_address) # self.oscServer.addMsgHandler("/stop", self.stop) # self.serverThread = threading.Thread(target=self.oscServer.serve_forever) ## Boutons self.btn_2.setEnabled(False) self.btn_3.setEnabled(True) self.TV = TeleMir_Vol() self.sendOSC('/start', self.oscPort) # self.serverThread.start() ## Close Calibration phase self.TC.close() # self.vp1.close() # self.vp2.close() print "sortie start" def stop(self): print 'TeleMir :: entree stop' self.state = 0 self.sendOSC('/stop', self.oscPort) # self.serverThread. # self.oscServer.close() ## Boutons self.btn_1.setEnabled(True) self.btn_2.setEnabled(False) self.btn_3.setEnabled(False) ## Close Vol phase self.TV.close() print 'TeleMir :: sortie stop' def addNext(media, media_file): media.enqueue(Phonon.MediaSource(media_file)) #def setScreen(self, Qwidget, screenNumber): def sendOSC(self,features, port): self.oscMsg.append(features) self.oscClient.sendto(self.oscMsg, (self.oscIP, port)) self.oscMsg.clearData()
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 __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()
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()