-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add XDF to "Reading EEG data" tutorial (#9289)
* Add XDF to "Reading EEG data" tutorial * Fix flake8 warning * [circle full] add comment * Use examples of formats, not exhaustive list Co-authored-by: Stefan Appelhoff <[email protected]> * Better motivation for not having an XDF loader Co-authored-by: Stefan Appelhoff <[email protected]> * Include .fdt in EEGLAB section * Provide EDF links earlier * Forgot > in hyperlink * Rewording Co-authored-by: Daniel McCloy <[email protected]> * ENH: Add separate example * FIX: Double link * Apply suggestions from code review Co-authored-by: Daniel McCloy <[email protected]> Co-authored-by: Stefan Appelhoff <[email protected]> Co-authored-by: Daniel McCloy <[email protected]> Co-authored-by: Eric Larson <[email protected]>
- Loading branch information
1 parent
0afbf07
commit c5b1297
Showing
5 changed files
with
170 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
.. _ex-read-xdf: | ||
==================== | ||
Reading XDF EEG data | ||
==================== | ||
Here we read some sample XDF data. Although we do not analyze it here, this | ||
recording is of a short parallel auditory response (pABR) experiment | ||
:footcite:`PolonenkoMaddox2019` and was provided by the `Maddox Lab | ||
<https://www.urmc.rochester.edu/labs/maddox.aspx>`__. | ||
""" | ||
# Authors: Clemens Brunner <[email protected]> | ||
# Eric Larson <[email protected]> | ||
# | ||
# License: BSD (3-clause) | ||
|
||
import os.path as op | ||
|
||
import pyxdf | ||
|
||
import mne | ||
from mne.datasets import misc | ||
|
||
fname = op.join( | ||
misc.data_path(), 'xdf', | ||
'sub-P001_ses-S004_task-Default_run-001_eeg_a2.xdf') | ||
streams, header = pyxdf.load_xdf(fname) | ||
data = streams[0]["time_series"].T | ||
assert data.shape[0] == 5 # four raw EEG plus one stim channel | ||
data[:4:2] -= data[1:4:2] # subtract (rereference) to get two bipolar EEG | ||
data = data[::2] # subselect | ||
data[:2] *= (1e-6 / 50 / 2) # uV -> V and preamp gain | ||
sfreq = float(streams[0]["info"]["nominal_srate"][0]) | ||
info = mne.create_info(3, sfreq, ["eeg", "eeg", "stim"]) | ||
raw = mne.io.RawArray(data, info) | ||
raw.plot(scalings=dict(eeg=100e-6), duration=1, start=12) | ||
|
||
############################################################################### | ||
# References | ||
# ---------- | ||
# .. footbibliography:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ neo | |
seaborn | ||
sphinx_copybutton | ||
https://github.com/mne-tools/mne-bids/archive/main.zip | ||
pyxdf |
Oops, something went wrong.