Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XDF to "Reading EEG data" tutorial #9289

Merged
merged 12 commits into from
Apr 20, 2021
38 changes: 24 additions & 14 deletions doc/references.bib
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
% Encoding: UTF-8
%
% If available, include a DOI (preferred) *or* a URL for a given reference, but
# not both, as the DOI turns into a link which is redundant with the URL.

% MNE-C reference
@article{GramfortEtAl2014,
Expand Down Expand Up @@ -518,7 +521,6 @@ @article{GramfortEtAl2010
title = {Graph-Based Variability Estimation in Single-Trial Event-Related Neural Responses},
journal = {{IEEE} Transactions on Biomedical Engineering},
doi = {10.1109/tbme.2009.2037139},
url = {https://doi.org/10.1109%2Ftbme.2009.2037139},
year = {2010},
publisher = {Institute of Electrical and Electronics Engineers ({IEEE})},
volume = {57},
Expand Down Expand Up @@ -1306,7 +1308,6 @@ @article{Pascual-Marqui2002
@article{Pascual-Marqui2011,
title = {Assessing interactions in the brain with exact low-resolution electromagnetic tomography},
volume = {369},
url = {https://royalsocietypublishing.org/doi/full/10.1098/rsta.2011.0081},
doi = {10.1098/rsta.2011.0081},
number = {1952},
journal = {Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences},
Expand Down Expand Up @@ -1980,7 +1981,6 @@ @article{OReillyEtAl2021
title = {Structural templates for imaging {EEG} cortical sources in infants},
volume = {227},
issn = {1053-8119},
url = {http://www.sciencedirect.com/science/article/pii/S1053811920311678},
doi = {10.1016/j.neuroimage.2020.117682},
urldate = {2021-01-12},
journal = {NeuroImage},
Expand All @@ -1994,7 +1994,6 @@ @article{RichardsEtAl2016
title = {A database of age-appropriate average {MRI} templates},
volume = {124},
issn = {1053-8119},
url = {http://www.sciencedirect.com/science/article/pii/S1053811915003559},
doi = {10.1016/j.neuroimage.2015.04.055},
journal = {NeuroImage},
author = {Richards, John E. and Sanchez, Carmen and Phillips-Meek, Michelle and Xie, Wanze},
Expand Down Expand Up @@ -2054,16 +2053,15 @@ @Article{Kappenman2021
}

@article{GenoveseEtAl2002,
title = {Thresholding of Statistical Maps in Functional Neuroimaging Using the False Discovery Rate},
journal = {NeuroImage},
volume = {15},
number = {4},
pages = {870-878},
year = {2002},
issn = {1053-8119},
doi = {https://doi.org/10.1006/nimg.2001.1037},
url = {https://www.sciencedirect.com/science/article/pii/S1053811901910377},
author = {Christopher R. Genovese and Nicole A. Lazar and Thomas Nichols},
title = {Thresholding of Statistical Maps in Functional Neuroimaging Using the False Discovery Rate},
journal = {NeuroImage},
volume = {15},
number = {4},
pages = {870-878},
year = {2002},
issn = {1053-8119},
doi = {https://doi.org/10.1006/nimg.2001.1037},
author = {Christopher R. Genovese and Nicole A. Lazar and Thomas Nichols},
}

@article{YaoEtAl2019,
Expand All @@ -2077,3 +2075,15 @@ @article{YaoEtAl2019
doi = {10.1007/s10548-019-00707-x},
publisher={Springer}
}

@article{PolonenkoMaddox2019,
title = {The {Parallel} {Auditory} {Brainstem} {Response}},
volume = {23},
issn = {2331-2165},
doi = {10.1177/2331216519871395},
language = {en},
journal = {Trends in Hearing},
author = {Polonenko, Melissa J. and Maddox, Ross K.},
year = {2019},
pages = {2331216519871395}
}
42 changes: 42 additions & 0 deletions examples/io/plot_read_xdf.py
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::
4 changes: 2 additions & 2 deletions mne/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
path = _get_path(path, key, name)
# To update the testing or misc dataset, push commits, then make a new
# release on GitHub. Then update the "releases" variable:
releases = dict(testing='0.117', misc='0.8')
releases = dict(testing='0.117', misc='0.9')
# And also update the "md5_hashes['testing']" variable below.
# To update any other dataset, update the data archive itself (upload
# an updated version) and update the md5 hash.
Expand Down Expand Up @@ -345,7 +345,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
bst_raw='fa2efaaec3f3d462b319bc24898f440c',
bst_resting='70fc7bf9c3b97c4f2eab6260ee4a0430'),
fake='3194e9f7b46039bb050a74f3e1ae9908',
misc='0f88194266121dd9409be94184231f25',
misc='f832ce9c4c27e83396cc977b293b0aa9',
sample='12b75d1cb7df9dfb4ad73ed82f61094f',
somato='32fd2f6c8c7eb0784a1de6435273c48b',
spm='9f43f67150e3b694b523a21eb929ea75',
Expand Down
1 change: 1 addition & 0 deletions requirements_doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ neo
seaborn
sphinx_copybutton
https://github.com/mne-tools/mne-bids/archive/main.zip
pyxdf
Loading