1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| from pylsl import StreamInlet, resolve_stream
from matplotlib import pyplot as plt
print("attente d'un stream EEG")
streams = resolve_stream('type', 'EEG')
inlet = StreamInlet(streams[0])
amp = []
temps_init = []
while True:
sample, timestamp = inlet.pull_sample()
print(timestamp, sample)
C1 = sample[0:1] # Affichage du canal 1 (1:2, 2:3, 3:4, 4:5, 5:6, 6:7, 7:8)
temps = timestamp
temps_init.append(temps)
amp.append(C1)
plt.plot(temps_init, amp)
plt.draw()
plt.pause(0.05) # figure updated and displayed, and the GUI event loop will run during the pause
plt.clf() # clear the current figure |
Partager