[7f9fb8]: / mne / io / eximia / tests / test_eximia.py

Download this file

51 lines (44 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Authors: The MNE-Python contributors.
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.
from numpy.testing import assert_array_equal
from scipy import io as sio
from mne.datasets.testing import data_path, requires_testing_data
from mne.io import read_raw_eximia
from mne.io.tests.test_raw import _test_raw_reader
testing_path = data_path(download=False)
@requires_testing_data
def test_eximia_nxe():
"""Test reading Eximia NXE files."""
fname = testing_path / "eximia" / "test_eximia.nxe"
raw = read_raw_eximia(fname, preload=True)
assert "RawEximia" in repr(raw)
_test_raw_reader(
read_raw_eximia,
fname=fname,
test_scaling=False, # XXX probably a scaling problem
)
fname_mat = testing_path / "eximia" / "test_eximia.mat"
mc = sio.loadmat(fname_mat)
m_data = mc["data"]
m_header = mc["header"]
assert raw._data.shape == m_data.shape
assert m_header["Fs"][0, 0][0, 0] == raw.info["sfreq"]
m_names = [x[0][0] for x in m_header["label"][0, 0]]
m_names = list(
map(lambda x: x.replace("GATE", "GateIn").replace("TRIG", "Trig"), m_names)
)
assert raw.ch_names == m_names
m_ch_types = [x[0][0] for x in m_header["chantype"][0, 0]]
m_ch_types = list(
map(
lambda x: x.replace("unknown", "stim").replace("trigger", "stim"),
m_ch_types,
)
)
types_dict = {2: "eeg", 3: "stim", 202: "eog"}
ch_types = [
types_dict[raw.info["chs"][x]["kind"]] for x in range(len(raw.ch_names))
]
assert ch_types == m_ch_types
assert_array_equal(m_data, raw._data)