Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2
- # -*- coding: utf-8 -*-
- """
- Created on Wed Sep 20 11:08:36 2017
- @author: jscastanoc
- """
- from pylsl import StreamInlet, resolve_stream
- import matplotlib.pyplot as plt
- print("looking for a stream...")
- streams = resolve_stream()
- stream_dict = dict()
- fig_imu, ax_imu = plt.subplots()
- fig_ecog, ax_ecog = plt.subplots()
- plt.ion()
- for stream in streams:
- print('found stream with name %s' % (stream.name()))
- if stream.name() == u'ecog':
- inlet_ecog = StreamInlet(stream)
- elif stream.name() == u'imu':
- inlet_imu = StreamInlet(stream)
- else:
- print('Dont know what to do with stream with name %s ' % (stream.name()))
- while True:
- chunk_imu, timestamps_imu = inlet_imu.pull_chunk()
- chunk_ecog, timestamps_ecog = inlet_ecog.pull_chunk()
- if timestamps_imu:
- ax_imu.plot(timestamps_imu, chunk_imu)
- if timestamps_ecog:
- ax_ecog.plot(timestamps_ecog, chunk_ecog)
- plt.pause(0.05)
Add Comment
Please, Sign In to add comment