Skip to content

Commit

Permalink
MRG+1: GDF support (#4205)
Browse files Browse the repository at this point in the history
* WIP: add basic GDF1 and GDF2 support

only tested on a few GDF test files
doesn't break existing EDF tests

* Remove \x00 from channel names

* Fix data calibration

- Unified offset and calibration values for EDF/BDF/GDF modules
- few PEP8 fixes
- TODO: GDF 2.x triggers are detected as multiples of 256
- TODO: overflow and saturation detection

* Proper imports imports in test_gdf.py

* Fix to test_edf.py

An additional warning has been added in edf.py when Lowpass information
is not available in file header.

As a result test_stim_channel() would fail. The test should now expect
2 warnings.

* Separated EDF and GDF code

- EDF and GDF file headers are now read in their own private subfunction
- some PEP8 and cosmetic changes
- GDF events are still multiples of 256

* Add biosig GDF test file

make Travis happy

* python3 fixes

- python3 requires decoding the bytes objects to produce strings
- np.unique() fails for dtype=object in python3 (see
numpy/numpy#641)
- flake, pydocstyle

* Read biosemi GDF stim_channel properly

* Speed up reading from file

- fromstring -> fromfile

* Test routines and added safechecks

Also remove test datafiles (see
mne-tools/mne-testing-data#23)

* Update utils, and missing lowpass info no longer issues warning

* Added stim_channel argument check

* Address comments

* Address comments and update doc

* Address comments

* Docstyle
  • Loading branch information
nbara authored and larsoner committed Apr 28, 2017
1 parent db38c67 commit d130b74
Show file tree
Hide file tree
Showing 4 changed files with 728 additions and 151 deletions.
36 changes: 24 additions & 12 deletions doc/manual/io.rst
Expand Up @@ -23,6 +23,7 @@ EEG Brainvision .vhdr :func:`mne.io.read_r
EEG Neuroscan CNT .cnt :func:`mne.io.read_raw_cnt`
EEG European data format .edf :func:`mne.io.read_raw_edf`
EEG Biosemi data format .bdf :func:`mne.io.read_raw_edf`
EEG General data format .gdf :func:`mne.io.read_raw_edf`
EEG EGI simple binary .egi :func:`mne.io.read_raw_egi`
EEG EEGLAB .set :func:`mne.io.read_raw_eeglab` and :func:`mne.read_epochs_eeglab`
Electrode locations elc, txt, csd, sfp, htps Misc :func:`mne.channels.read_montage`
Expand Down Expand Up @@ -262,26 +263,37 @@ European data format (.edf)

EDF and EDF+ files can be read in using :func:`mne.io.read_raw_edf`.

http://www.edfplus.info/specs/edf.html
`EDF (European Data Format) <http://www.edfplus.info/specs/edf.html>`_ and
`EDF+ <http://www.edfplus.info/specs/edfplus.html>`_ are 16-bit formats.

EDF (European Data Format) and EDF+ are 16-bit formats
http://www.edfplus.info/specs/edfplus.html

The EDF+ files may contain an annotation channel which can
be used to store trigger information. The Time-stamped Annotation
Lists (TALs) on the annotation data can be converted to a trigger
channel (STI 014) using an annotation map file which associates
an annotation label with a number on the trigger channel.
The EDF+ files may contain an annotation channel which can be used to store
trigger information. The Time-stamped Annotation Lists (TALs) on the
annotation data can be converted to a trigger channel (STI 014) using an
annotation map file which associates an annotation label with a number on
the trigger channel.

Biosemi data format (.bdf)
==========================

The BDF format (http://www.biosemi.com/faq/file_format.htm) is a 24-bit variant
of the EDF format used by the EEG systems manufactured by a company called
BioSemi. It can also be read in using :func:`mne.io.read_raw_edf`.
The `BDF format <http://www.biosemi.com/faq/file_format.htm>`_ is a 24-bit
variant of the EDF format used by the EEG systems manufactured by a company
called BioSemi. It can also be read in using :func:`mne.io.read_raw_edf`.

.. warning:: The data samples in a BDF file are represented in a 3-byte (24-bit) format. Since 3-byte raw data buffers are not presently supported in the fif format these data will be changed to 4-byte integers in the conversion.

General data format (.gdf)
==========================

GDF files can be read in using :func:`mne.io.read_raw_edf`.

`GDF (General Data Format) <https://arxiv.org/abs/cs/0608052>`_ is a flexible
format for biomedical signals, that overcomes some of the limitations of the
EDF format. The original specification (GDF v1) includes a binary header,
and uses an event table. An updated specification (GDF v2) was released in
2011 and adds fields for additional subject-specific information (gender,
age, etc.) and allows storing several physical units and other properties.
Both specifications are supported in MNE.

Neuroscan CNT data format (.cnt)
================================

Expand Down
4 changes: 2 additions & 2 deletions mne/datasets/utils.py
Expand Up @@ -228,7 +228,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.32', misc='0.3')
releases = dict(testing='0.33', misc='0.3')
# And also update the "hashes['testing']" variable below.

# To update any other dataset, update the data archive itself (upload
Expand Down Expand Up @@ -285,7 +285,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
sample='1d5da3a809fded1ef5734444ab5bf857',
somato='f3e3a8441477bb5bacae1d0c6e0964fb',
spm='f61041e3f3f2ba0def8a2ca71592cc41',
testing='bcda2bb49dfa8a9400aaeeb3c4b0a072',
testing='37e965395f04ed357605e796fde104f3',
multimodal='26ec847ae9ab80f58f204d09e2c08367',
visual_92_categories='46c7e590f4a48596441ce001595d5e58',
mtrf='273a390ebbc48da2c3184b01a82e4636',
Expand Down

0 comments on commit d130b74

Please sign in to comment.