foo = Expression(update_qml, reward, inhibit1, inhibit2, total) return layout context = Context() context.register_channel('Channel 1') context.register_channel('Channel 2') layout = setup_flow(context) analysisWindow = QWidget() analysisWindow.setLayout(layout) analysisWindow.show() sourceThread = UDPThread() quickWindow.show() #quickWindow.showFullScreen() def handlePacket(packet): context.append_channel_data('Channel 1', [packet[0]]) context.append_channel_data('Channel 2', [packet[1]]) context.process() sourceThread.newPacket.connect(handlePacket) sourceThread.start() def updateGUI(): for child in analysisWindow.children(): try:
from acquisition import UDPThread import sys import signal import wave import struct from pyqtgraph import QtCore app = QtCore.QCoreApplication(sys.argv) signal.signal(signal.SIGINT, signal.SIG_DFL) source = UDPThread(port=9999) f = wave.open(sys.argv[1], 'w') f.setnchannels(8) f.setsampwidth(3) f.setframerate(250) def handle_packet(packet): for ch in packet: data = struct.pack('<i', ch) f.writeframes(data[1:]) #print (len(data[:1])) #print (data) source.newPacket.connect(handle_packet) source.start()
foo = Expression(update_qml, reward, inhibit1, inhibit2, total) return layout context = Context() print context.register_channel context.register_channel(idx='Channel 1', channel_name="Channel 1") context.register_channel(idx='Channel 2', channel_name="Channel 2") layout = setup_flow(context) analysisWindow = QWidget() analysisWindow.setLayout(layout) analysisWindow.show() sourceThread = UDPThread() quickWindow.show() #quickWindow.showFullScreen() def handlePacket(packet): context.append_channel_data('Channel 1', [packet[0]]) context.append_channel_data('Channel 2', [packet[1]]) context.process() sourceThread.newPacket.connect(handlePacket) sourceThread.start()
from acquisition import UDPThread import sys import signal import wave import struct from pyqtgraph import QtCore app = QtCore.QCoreApplication(sys.argv) signal.signal(signal.SIGINT, signal.SIG_DFL) source = UDPThread(port=9999) f = wave.open(sys.argv[1], 'w') f.setnchannels(8) f.setsampwidth(3) f.setframerate(250) def handle_packet(packet): for ch in packet: data = struct.pack('<i', ch) f.writeframes(data[1:]) #print (len(data[:1])) #print (data) source.newPacket.connect(handle_packet)