-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxdf-reader.py
More file actions
24 lines (21 loc) · 847 Bytes
/
xdf-reader.py
File metadata and controls
24 lines (21 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pyxdf
import matplotlib.pyplot as plt
import numpy as np
streams, header = pyxdf.load_xdf('./data/P1.xdf')
#this print basic info on all stream in the xdf file
print("Found {} streams:".format(len(streams)))
for ix, stream in enumerate(streams):
msg = "Stream {}: {} - type {} - uid {} - shape {} at {} (effective {}) Hz"
print(msg.format(
ix + 1, stream['info']['name'][0],
stream['info']['type'][0],
stream['info']['uid'][0],
(int(stream['info']['channel_count'][0]), len(stream['time_stamps'])),
stream['info']['nominal_srate'][0],
stream['info']['effective_srate'])
)
if any(stream['time_stamps']):
duration = stream['time_stamps'][-1] - stream['time_stamps'][0]
print("\tDuration: {} s".format(duration))
print("Done.")
print(streams[0]['time_series'])