示例#1
0
    ch.append_child_value("label", label)
    ch.append_child_value("unit", "microvolts")
    ch.append_child_value("type", "EEG")
info.desc().append_child_value("manufacturer", "SCCN")
cap = info.desc().append_child("cap")
cap.append_child_value("name", "EasyCap")
cap.append_child_value("size", "54")
cap.append_child_value("labelscheme", "10-20")

# create outlet for the stream
outlet = liblsl.stream_outlet(info)

# === the following could run on another computer ===

# resolve the stream and open an inlet
results = liblsl.resolve_stream("name", "MetaTester")
inlet = liblsl.stream_inlet(results[0])
# get the full stream info (including custom meta-data) and dissect it
inf = inlet.info()
print "The stream's XML meta-data is: "
print inf.as_xml()
print "The manufacturer is: " + inf.desc().child_value("manufacturer")
print "The cap circumference is: " + inf.desc().child("cap").child_value(
    "size")
print "The channel labels are as follows:"
ch = inf.desc().child("channels").child("channel")
for k in range(info.channel_count()):
    print "  " + ch.child_value("label")
    ch = ch.next_sibling()

time.sleep(3)
示例#2
0
import liblsl

# first resolve an EEG stream on the lab network
print("looking for an EEG stream...")
streams = liblsl.resolve_stream('type','EEG')

# create a new inlet to read from the stream
inlet = liblsl.stream_inlet(streams[0])

sample = liblsl.vectorf()
while True:
	# get a new sample (you can also omit the timestamp part if you're not interested in it)
	timestamp = inlet.pull_sample(sample)	
	print(timestamp, list(sample))
import liblsl

# first resolve a marker stream on the lab network
print("looking for a marker stream...")
streams = liblsl.resolve_stream('type','Markers')

# create a new inlet to read from the stream
inlet = liblsl.stream_inlet(streams[0])

sample = liblsl.vectorstr()
while True:
	# get a new sample (you can also omit the timestamp part if you're not interested in it)
	timestamp = inlet.pull_sample(sample)
	print("got ",sample[0]," at time ",timestamp)
    ch.append_child_value("label",label)
    ch.append_child_value("unit","microvolts")
    ch.append_child_value("type","EEG")
info.desc().append_child_value("manufacturer","SCCN")
cap = info.desc().append_child("cap")
cap.append_child_value("name","EasyCap")
cap.append_child_value("size","54")
cap.append_child_value("labelscheme","10-20")

# create outlet for the stream
outlet = liblsl.stream_outlet(info)


# === the following could run on another computer ===

# resolve the stream and open an inlet
results = liblsl.resolve_stream("name","MetaTester")
inlet = liblsl.stream_inlet(results[0])
# get the full stream info (including custom meta-data) and dissect it
inf = inlet.info()
print "The stream's XML meta-data is: "
print inf.as_xml()
print "The manufacturer is: " + inf.desc().child_value("manufacturer")
print "The cap circumference is: " + inf.desc().child("cap").child_value("size")
print "The channel labels are as follows:" 
ch = inf.desc().child("channels").child("channel")
for k in range(info.channel_count()):
    print "  " + ch.child_value("label")
    ch = ch.next_sibling()

time.sleep(3)
import liblsl

# first resolve a marker stream on the lab network
print("looking for a marker stream...")
streams = liblsl.resolve_stream('type', 'Markers')

# create a new inlet to read from the stream
inlet = liblsl.stream_inlet(streams[0])

sample = liblsl.vectorstr()
while True:
    # get a new sample (you can also omit the timestamp part if you're not interested in it)
    timestamp = inlet.pull_sample(sample)
    print("got ", sample[0], " at time ", timestamp)