python模块通过lab流媒体层(lsl)传输bitalino数据
bitalino-lsl的Python项目详细描述
bitalino lsl
一个名为bitalino_lsl
的python模块,用于通过lab流媒体层(lsl)传输bitalino数据。此模块通过bitalino python api从BITalino设备获取数据,并使用Lab Stream Layer来传输数据。
该模块应与python版本一起工作>;=2.7,尽管它只测试过:
- Python2.7.15
- Python3.6.5
开始
安装
pip install bitalino_lsl
示例
importbitalino_lslfrompylslimportStreamInlet,resolve_streamimporttime# MAC address of the BITalino deviceMAC_ADDRESS_BITALINO_DEVICE="20:17:11:1A:2B:3C"# List with channels of the BITalino device to be streamed to the LSL# This channels can be specified as a list or as a dictionary with their# position in the 10-20 system. BITalino uses bipolar electrodes so the# position will be defined by two points# CHANNELS = {0: 'Fp1-Fp2', 1: 'P3-T5'}CHANNELS=[0,1]# Connect with the BITalino devicedevice=bitalino_lsl.BitalinoLSL(MAC_ADDRESS_BITALINO_DEVICE)# Create the Stream with the channels informationdevice.create_lsl_EEG(CHANNELS)# Start the stream getting data from the BITalino devicedevice.start()# Get the Stream to read the data frominlet=StreamInlet(resolve_stream('type','EEG')[0])# Read the BITalino data for 5 secondst_end=time.time()+5whiletime.time()<t_end:sample,timestamp=inlet.pull_sample()print(sample)# Stop the devicedevice.stop()# Close the connection with the BITalino devicedevice.close()
文档
文档可用here
许可证
这个项目是根据GNU GPL v3