Skip to content

Commit

Permalink
Update README (xdf-modules#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrnr committed Jul 18, 2024
1 parent ca9e580 commit 0d74a58
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,33 @@ pyXDF is a Python importer for [XDF](https://github.com/sccn/xdf) files.
## Sample usage

``` python
import pyxdf
import matplotlib.pyplot as plt
import numpy as np

data, header = pyxdf.load_xdf('test.xdf')
import pyxdf

data, header = pyxdf.load_xdf("test.xdf")

for stream in data:
y = stream['time_series']
y = stream["time_series"]

if isinstance(y, list):
# list of strings, draw one vertical line for each marker
for timestamp, marker in zip(stream['time_stamps'], y):
for timestamp, marker in zip(stream["time_stamps"], y):
plt.axvline(x=timestamp)
print(f'Marker "{marker[0]}" @ {timestamp:.2f}s')
elif isinstance(y, np.ndarray):
# numeric data, draw as lines
plt.plot(stream['time_stamps'], y)
plt.plot(stream["time_stamps"], y)
else:
raise RuntimeError('Unknown stream format')
raise RuntimeError("Unknown stream format")

plt.show()
```

## CLI examples

`pyxdf` has an `examples` module. These can be run from the command line for basic functionality.
`pyxdf` has an `examples` module, which can be run from the command line for basic functionality.

* `print_metadata` will enable a DEBUG logger to log read messages, then it will print basic metadata about each found stream.
* `python -m pyxdf.examples.print_metadata -f=/path/to/my.xdf`
Expand Down

0 comments on commit 0d74a58

Please sign in to comment.