Repository: mne-tools/mne-python

Issue:
BUG: Channels mis-classified due to FIF constants
cc @jaeilepp this code:

```
import mne
raw = mne.io.Raw(mne.datasets.testing.data_path() + '/SSS/test_move_anon_movecomp_raw_sss.fif')
events = mne.make_fixed_length_events(raw, 1)
epochs = mne.Epochs(raw, events, 1, -0.2, 0.8)
evoked = epochs.average()
evoked.plot()
```

Produces this plot, which is incorrect because there are no sEEG channels (but there are cHPI channels):

![figure_1](https://cloud.githubusercontent.com/assets/2365790/12827517/2417fa78-cb4e-11e5-928c-a5a0030987a4.png)

I think we might need to make our channel-selection functions a bit smarter about sEEG vs cHPI. We could probably do it by using units -- sEEG should be V and cHPI should be unknown (I think).



Discussion:

Resolving patch:
diff --git a/mne/io/pick.py b/mne/io/pick.py
--- a/mne/io/pick.py
+++ b/mne/io/pick.py
@@ -59,7 +59,7 @@ def channel_type(info, idx):
         return 'ias'
     elif kind == FIFF.FIFFV_SYST_CH:
         return 'syst'
-    elif kind in [FIFF.FIFFV_SEEG_CH, 702]:  # 702 was used before v0.11
+    elif kind == FIFF.FIFFV_SEEG_CH:
         return 'seeg'
     elif kind in [FIFF.FIFFV_QUAT_0, FIFF.FIFFV_QUAT_1, FIFF.FIFFV_QUAT_2,
                   FIFF.FIFFV_QUAT_3, FIFF.FIFFV_QUAT_4, FIFF.FIFFV_QUAT_5,
diff --git a/mne/viz/raw.py b/mne/viz/raw.py
--- a/mne/viz/raw.py
+++ b/mne/viz/raw.py
@@ -239,17 +239,6 @@ def plot_raw(raw, events=None, duration=10.0, start=0.0, n_channels=20,
               'misc', 'chpi', 'syst', 'ias', 'exci']:
         pick_kwargs[t] = True
         inds += [pick_types(raw.info, **pick_kwargs)]
-        if t == 'seeg' and len(inds[-1]) > 0:
-            # XXX hack to work around fiff mess
-            new_picks = [ind for ind in inds[-1] if
-                         not raw.ch_names[ind].startswith('CHPI')]
-            if len(new_picks) != len(inds[-1]):
-                inds[-1] = new_picks
-            else:
-                logger.warning('Conflicting FIFF constants detected. SEEG '
-                               'FIFF data saved before mne version 0.11 will '
-                               'not work with mne version 0.12! Save the raw '
-                               'files again to fix the FIFF tags!')
         types += [t] * len(inds[-1])
         pick_kwargs[t] = False
     inds = np.concatenate(inds).astype(int)


Test patch:
diff --git a/mne/io/tests/test_pick.py b/mne/io/tests/test_pick.py
--- a/mne/io/tests/test_pick.py
+++ b/mne/io/tests/test_pick.py
@@ -1,14 +1,14 @@
 import os.path as op
 import inspect
 
-from nose.tools import assert_equal, assert_raises
+from nose.tools import assert_equal, assert_raises, assert_true
 from numpy.testing import assert_array_equal
 import numpy as np
 
 from mne import (pick_channels_regexp, pick_types, Epochs,
                  read_forward_solution, rename_channels,
                  pick_info, pick_channels, __file__, create_info)
-from mne.io import Raw, RawArray, read_raw_bti, read_raw_kit
+from mne.io import Raw, RawArray, read_raw_bti, read_raw_kit, read_info
 from mne.io.pick import (channel_indices_by_type, channel_type,
                          pick_types_forward, _picks_by_type)
 from mne.io.constants import FIFF
@@ -110,6 +110,17 @@ def test_pick_seeg():
         assert_equal(l, r)
 
 
+def test_pick_chpi():
+    """Test picking cHPI
+    """
+    # Make sure we don't mis-classify cHPI channels
+    info = read_info(op.join(io_dir, 'tests', 'data', 'test_chpi_raw_sss.fif'))
+    channel_types = set([channel_type(info, idx)
+                         for idx in range(info['nchan'])])
+    assert_true('chpi' in channel_types)
+    assert_true('seeg' not in channel_types)
+
+
 def _check_fwd_n_chan_consistent(fwd, n_expected):
     n_ok = len(fwd['info']['ch_names'])
     n_sol = fwd['sol']['data'].shape[0]