Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mne-tools/mne-bids into a…
Browse files Browse the repository at this point in the history
…dd_ieeg_tests
  • Loading branch information
sappelhoff committed Nov 10, 2018
2 parents 8351f56 + de54d7b commit 940c3d3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 2 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Changelog
Bug
~~~

- Fix logic with inferring unknown channel types for CTF data, by `Mainak Jas`_ (`#129 <https://github.com/mne-tools/mne-bids/pull/16/files>`_)

API
~~~

Expand Down
5 changes: 2 additions & 3 deletions examples/convert_eeg_to_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import mne
from mne.datasets import eegbci
from mne.io.edf.edf import read_annotations_edf

from mne_bids import write_raw_bids, make_bids_basename
from mne_bids.utils import print_dir_tree
Expand Down Expand Up @@ -94,7 +93,7 @@
###############################################################################
# The annotations stored in the file must be read in separately and converted
# into a 2D numpy array of events that is compatible with MNE.
annot = read_annotations_edf(edf_path)
annot = mne.read_annotations(edf_path)
raw.set_annotations(annot)
events, event_id = mne.events_from_annotations(raw)

Expand Down Expand Up @@ -163,7 +162,7 @@
edf_path = eegbci.load_data(subject=subj_idx, runs=task_idx)[0]

raw = mne.io.read_raw_edf(edf_path, preload=False, stim_channel=None)
annot = read_annotations_edf(edf_path)
annot = mne.read_annotations(edf_path)
raw.set_annotations(annot)
events, event_id = mne.events_from_annotations(raw)

Expand Down
2 changes: 1 addition & 1 deletion mne_bids/mne_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _channels_tsv(raw, fname, overwrite=False, verbose=True):
status.append('bad' if ch in raw.info['bads'] else 'good')
_channel_type = channel_type(raw.info, idx)
if _channel_type in get_specific:
_channel_type = coil_type(raw.info, idx)
_channel_type = coil_type(raw.info, idx, _channel_type)
ch_type.append(map_chs[_channel_type])
description.append(map_desc[_channel_type])
low_cutoff, high_cutoff = (raw.info['highpass'], raw.info['lowpass'])
Expand Down
8 changes: 5 additions & 3 deletions mne_bids/pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_coil_types():
misc=(FIFF.FIFFV_COIL_NONE,))


def coil_type(info, idx):
def coil_type(info, idx, ch_type='n/a'):
"""Get coil type.
Parameters
Expand All @@ -53,6 +53,9 @@ def coil_type(info, idx):
Measurement info
idx : int
Index of channel
ch_type : str
Channel type to fall back upon if a more specific
type is not found
Returns
-------
Expand All @@ -64,5 +67,4 @@ def coil_type(info, idx):
for key, values in get_coil_types().items():
if ch['coil_type'] in values:
return key
raise ValueError('Unknown coil of type {0} '
'for channel {1}'.format(ch['coil_type'], ch["ch_name"]))
return ch_type
4 changes: 1 addition & 3 deletions mne_bids/tests/test_pick.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Test for the coil type picking function"""

import os.path as op
import pytest

from mne.datasets import testing
from mne.io import read_raw_fif
Expand All @@ -19,5 +18,4 @@ def test_coil_type():
assert coil_type(raw.info, 306) == 'misc'
assert coil_type(raw.info, 315) == 'eeg'
raw.info['chs'][0]['coil_type'] = 1234
with pytest.raises(ValueError):
coil_type(raw.info, 0)
assert coil_type(raw.info, 0) == 'n/a'

0 comments on commit 940c3d3

Please sign in to comment.