How to use the acquisition.UDPThread function in Acquisition

To help you get started, we’ve selected a few Acquisition examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strfry / OpenNFB / qml.py View on Github external
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:
			if hasattr(child, 'block'):
github strfry / OpenNFB / live_flow.py View on Github external
# Enable antialiasing for prettier plots
pg.setConfigOptions(antialias=True)

protocol_name = sys.argv[1]

from protocols import ProtocolLauncher

context = Context()
context.register_channel('Channel 1')
context.register_channel('Channel 2')

launcher = ProtocolLauncher(context, protocol_name)

#sourceThread = BDFThread(sys.argv[2])
#sourceThread = OpenBCIThread(sys.argv[2])
sourceThread = UDPThread()


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 launcher.widget.children():
        if hasattr(child, 'block'):
            child.block.updateGUI()
github strfry / OpenNFB / acquisition.py View on Github external
def __init__(self, port=8888):
    super(UDPThread, self).__init__()

    self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
    self.socket.bind(('127.0.0.1', port))

    self.buffer = []
github strfry / OpenNFB / record_wav.py View on Github external
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('
github strfry / OpenNFB / lua_protocol.py View on Github external
import sys
import signal as _signal

from acquisition import UDPThread
from launcher import LuaLauncher

import flow

_signal.signal(_signal.SIGINT, _signal.SIG_DFL)
myApp = QtGui.QApplication(sys.argv)

context = flow.Context()
context.register_channel(0, 'Channel 1')
context.register_channel(1, 'Channel 2')

sourceThread = UDPThread()

def handlePacket(packet):
	context.append_channel_data(0, [packet[0]])
	context.append_channel_data(1, [packet[1]])
	context.process()

sourceThread.newPacket.connect(handlePacket)
sourceThread.start()

class LauncherWindow(QtGui.QMainWindow):
	def __init__(self, context):
		super(LauncherWindow, self).__init__()
		self.context = context
		self.launcher = None

		self.dockarea = DockArea()