Repository: mne-tools/mne-python

Issue:
Problem reading EEG channels of an old yokogawa KIT MEG system with the newest MNE version.
#### Describe the bug
I'm working with data obtained by a 160 channel yokogawa/KIT MEG system, which has 125 axial gradiometers, the others are EEG and trigger channels. This system is located at the PTB institute in Berlin. To import the ".con" file I use the  function: mne.io.read_raw_kit("filename.con"). Until recently, everything worked well, values of both EEG and MEG channels were imported as they should (I was using the MNE-Python version 0.20.0). Then I updated the MNE-Python to the latest 0.21.2, the MEG channels were correct, but all the EEG channels have at each time values of 0.. Then I tried again with the version 0.20.0 and everything worked fine. 

#### Steps to reproduce
This issue can be reproduced by running the "example.py" with different versions of MNE, which imports "data.con" and plots raw data. Both files can be downloaded on the following link: https://imfm2815001.fmf.uni-lj.si/nextcloud/index.php/s/bHK4weHmKBTrS4P 

#### Actual results
I attach two images of the function raw.plot(), each with its own version of MNE-Python on the same dataset. When i used the  MNE-Python version 0.20.0 the matplotlib version 3.1.1 (latest version gives errors) and when using MNE-Python version 0.21.2 the matplotlib version 3.3.2.

![MNE=0 20 0](https://user-images.githubusercontent.com/22200427/99424908-83a16d00-2902-11eb-9201-e95d3ee2823c.png)
![MNE=0 21 2](https://user-images.githubusercontent.com/22200427/99424913-84d29a00-2902-11eb-9042-4fa3de90f7ff.png)

#### Additional information
Platform:      Linux-5.8.18-100.fc31.x86_64-x86_64-with-glibc2.10
Python:        3.8.5 (default, Sep  4 2020, 07:30:14)  [GCC 7.3.0]
Executable:    /home/marhl/Applications/anaconda3/envs/mne/bin/python
CPU:           x86_64: 4 cores
Memory:        15.5 GB

mne:           0.21.2
numpy:         1.19.2 {blas=mkl_rt, lapack=mkl_rt}
scipy:         1.5.2
matplotlib:    3.3.2 {backend=Qt5Agg}

sklearn:       0.23.2
numba:         0.51.2
nibabel:       3.2.0
cupy:          Not found
pandas:        1.1.3
dipy:          1.3.0
mayavi:        4.7.2
pyvista:       0.27.2 {pyvistaqt=0.2.0, OpenGL 4.5 (Core Profile) Mesa 19.2.8 via Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)}
vtk:           9.0.1
PyQt5:         5.15.1

I hope it is OK that I reported this issue here. Since this is my first Bug report, I hope I have written everything correct. Can I help you somehow with any additional informations, please let me know.


Discussion:

Resolving patch:
diff --git a/mne/datasets/utils.py b/mne/datasets/utils.py
--- a/mne/datasets/utils.py
+++ b/mne/datasets/utils.py
@@ -245,7 +245,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.108', misc='0.7')
+    releases = dict(testing='0.110', misc='0.7')
     # 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.
@@ -331,7 +331,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
         sample='12b75d1cb7df9dfb4ad73ed82f61094f',
         somato='32fd2f6c8c7eb0784a1de6435273c48b',
         spm='9f43f67150e3b694b523a21eb929ea75',
-        testing='57a21229ebb11e3c470b5d0fdb80642f',
+        testing='c4cd3385f321cd1151ed9de34fc4ce5a',
         multimodal='26ec847ae9ab80f58f204d09e2c08367',
         fnirs_motor='c4935d19ddab35422a69f3326a01fef8',
         opm='370ad1dcfd5c47e029e692c85358a374',
diff --git a/mne/io/kit/constants.py b/mne/io/kit/constants.py
--- a/mne/io/kit/constants.py
+++ b/mne/io/kit/constants.py
@@ -48,6 +48,7 @@
     50: (2, 1, 1),  # Hanger Type #3
     60: (2, 1, 1),  # Hanger Type #3
     100: (3, 3, 3),  # Low Band Kapper Type
+    101: (1, 3, 2),  # Berlin (DC, 200 Hz, Through)
     120: (3, 3, 3),  # Low Band Kapper Type
     200: (4, 4, 3),  # High Band Kapper Type
     300: (2, 2, 2),  # Kapper Type
@@ -164,6 +165,8 @@
 KIT.SYSTEM_YOKOGAWA_2017_01 = 1001  # Kanazawa (until 2017)
 KIT.SYSTEM_YOKOGAWA_2018_01 = 10020  # Kanazawa (since 2018)
 KIT.SYSTEM_YOKOGAWA_2020_08 = 10021  # Kanazawa (since August 2020)
+KIT.SYSTEM_EAGLE_TECHNOLOGY_PTB_2008 = 124
+
 # Sensor layouts for plotting
 KIT_LAYOUT = {
     KIT.SYSTEM_AS: None,
@@ -184,6 +187,7 @@
     KIT.SYSTEM_YOKOGAWA_2017_01: None,
     KIT.SYSTEM_YOKOGAWA_2018_01: None,
     KIT.SYSTEM_YOKOGAWA_2020_08: None,
+    KIT.SYSTEM_EAGLE_TECHNOLOGY_PTB_2008: None,
 }
 # Sensor neighbor definitions
 KIT_NEIGHBORS = {
@@ -205,6 +209,7 @@
     KIT.SYSTEM_YOKOGAWA_2017_01: None,
     KIT.SYSTEM_YOKOGAWA_2018_01: None,
     KIT.SYSTEM_YOKOGAWA_2020_08: None,
+    KIT.SYSTEM_EAGLE_TECHNOLOGY_PTB_2008: None,
 }
 # Names displayed in the info dict description
 KIT_SYSNAMES = {
@@ -225,6 +230,7 @@
     KIT.SYSTEM_YOKOGAWA_2017_01: 'Yokogawa of Kanazawa (until 2017)',
     KIT.SYSTEM_YOKOGAWA_2018_01: 'Yokogawa of Kanazawa (since 2018)',
     KIT.SYSTEM_YOKOGAWA_2020_08: 'Yokogawa of Kanazawa (since August 2020)',
+    KIT.SYSTEM_EAGLE_TECHNOLOGY_PTB_2008: 'Eagle Technology MEG (KIT/Yokogawa style) at PTB (since 2008, software upgrade in 2018)',  # noqa: E501
 }
 
 LEGACY_AMP_PARAMS = {
diff --git a/mne/io/kit/kit.py b/mne/io/kit/kit.py
--- a/mne/io/kit/kit.py
+++ b/mne/io/kit/kit.py
@@ -760,6 +760,7 @@ def get_kit_info(rawfile, allow_unknown_format, standardize_names=None,
     is_exg = [ch['type'] in (KIT.CHANNEL_EEG, KIT.CHANNEL_ECG)
               for ch in channels]
     exg_gains /= 2 ** (adc_stored - 14)
+    exg_gains[exg_gains == 0] = ad_to_volt
     conv_factor[is_exg] = exg_gains
     sqd['conv_factor'] = conv_factor[:, np.newaxis]
 


Test patch:
diff --git a/mne/io/kit/tests/test_kit.py b/mne/io/kit/tests/test_kit.py
--- a/mne/io/kit/tests/test_kit.py
+++ b/mne/io/kit/tests/test_kit.py
@@ -15,7 +15,7 @@
 from mne import pick_types, Epochs, find_events, read_events
 from mne.datasets.testing import requires_testing_data
 from mne.transforms import apply_trans
-from mne.utils import run_tests_if_main, assert_dig_allclose
+from mne.utils import assert_dig_allclose
 from mne.io import read_raw_fif, read_raw_kit, read_epochs_kit
 from mne.io.constants import FIFF
 from mne.io.kit.coreg import read_sns
@@ -49,6 +49,7 @@
     data_path, 'KIT', 'Example_RICOH160-1_10020-export_anonymyze.con')]
 ricoh_systems_paths += [op.join(
     data_path, 'KIT', 'Example_RICOH160-1_10021-export_anonymyze.con')]
+berlin_path = op.join(data_path, 'KIT', 'data_berlin.con')
 
 
 @requires_testing_data
@@ -337,4 +338,18 @@ def test_ricoh_systems(tmpdir, fname, desc, system_id):
     assert raw.info['kit_system_id'] == system_id
 
 
-run_tests_if_main()
+@requires_testing_data
+def test_berlin():
+    """Test data from Berlin."""
+    # gh-8535
+    raw = read_raw_kit(berlin_path)
+    assert raw.info['description'] == 'Physikalisch Technische Bundesanstalt, Berlin/128-channel MEG System (124) V2R004 PQ1128R-N2'  # noqa: E501
+    assert raw.info['kit_system_id'] == 124
+    assert raw.info['highpass'] == 0.
+    assert raw.info['lowpass'] == 200.
+    assert raw.info['sfreq'] == 500.
+    n = int(round(28.77 * raw.info['sfreq']))
+    meg = raw.get_data('MEG 003', n, n + 1)[0, 0]
+    assert_allclose(meg, -8.89e-12, rtol=1e-3)
+    eeg = raw.get_data('E14', n, n + 1)[0, 0]
+    assert_allclose(eeg, -2.55, rtol=1e-3)