Repository: mne-tools/mne-python

Issue:
Importing Yokogawa/KIT data
I try to import data from Brainstorm tutorial: http://neuroimage.usc.edu/brainstorm/Tutorials/Yokogawa and get an error. However, I can import it in Brainstorm. My MNE version 0.15.2
I run this code:
```
import mne
mne.io.read_raw_kit('SEF_000-export.con')
```
output:
```
Extracting SQD Parameters from SEF_000-export.con...
Creating Raw.info structure...
```

error:
`IOError: Unknown FLL type: 300`



Discussion:
@christianbrodbeck any idea how we add support for this site?
Implementation of the SQD reader is dependent on information on the file format, which is unfortunately not complete. It looks like the relevant component of brainstorm is compiled without source code (https://github.com/brainstorm-tools/brainstorm3/tree/master/external/yokogawa).

Resolving patch:
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
@@ -93,9 +93,9 @@
     # KIT.CHANNEL_PLANAR_GRADIOMETER_REFERENCE: FIFF.???,
     # KIT.CHANNEL_2ND_ORDER_AXIAL_GRADIOMETER: FIFF.???,
     # KIT.CHANNEL_2ND_ORDER_AXIAL_GRADIOMETER_REFERENCE: FIFF.???,
-    KIT.CHANNEL_TRIGGER: FIFF.FIFFV_COIL_NONE, 
+    KIT.CHANNEL_TRIGGER: FIFF.FIFFV_COIL_NONE,
     KIT.CHANNEL_EEG: FIFF.FIFFV_COIL_EEG,
-    KIT.CHANNEL_ECG: FIFF.FIFFV_COIL_NONE, 
+    KIT.CHANNEL_ECG: FIFF.FIFFV_COIL_NONE,
     KIT.CHANNEL_ETC: FIFF.FIFFV_COIL_NONE,
     KIT.CHANNEL_NULL: FIFF.FIFFV_COIL_NONE,
 }
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
@@ -596,11 +596,15 @@ def get_kit_info(rawfile, allow_unknown_format):
             adc_range = unpack('d', fid.read(KIT.DOUBLE))[0]
         adc_polarity, adc_allocated, adc_stored = unpack('3i',
                                                          fid.read(3 * KIT.INT))
+        system_name = system_name.replace('\x00', '')
+        system_name = system_name.strip().replace('\n', '/')
+        model_name = model_name.replace('\x00', '')
+        model_name = model_name.strip().replace('\n', '/')
 
         logger.debug("SQD file basic information:")
         logger.debug("Meg160 version = V%iR%03i", version, revision)
         logger.debug("System ID      = %i", sysid)
-        logger.debug("System name    = %s", system_name.replace('\n', '/'))
+        logger.debug("System name    = %s", system_name)
         logger.debug("Model name     = %s", model_name)
         logger.debug("Channel count  = %i", channel_count)
         logger.debug("Comment        = %s", comment)
@@ -614,7 +618,15 @@ def get_kit_info(rawfile, allow_unknown_format):
 
         # check that we can read this file
         if fll_type not in KIT.FLL_SETTINGS:
-            raise IOError("Unknown FLL type: %i" % fll_type)
+            fll_types = sorted(KIT.FLL_SETTINGS.keys())
+            use_fll_type = fll_types[
+                np.searchsorted(fll_types, fll_type) - 1]
+            warn('Unknown site filter settings (FLL) for system '
+                 '"%s" model "%s" (ID %s), will assume FLL %d->%d, check '
+                 'your data for correctness, including channel scales and '
+                 'filter settings!'
+                 % (system_name, model_name, sysid, fll_type, use_fll_type))
+            fll_type = use_fll_type
 
         # channel information
         fid.seek(64)


Test patch: