Skip to content

Commit

Permalink
[MRG+1]: skip updating meas info on unknown channel type (mne-tools#3646
Browse files Browse the repository at this point in the history
)

* bail on unknown channel type

* warn also

* mark unknown channels as FIFF.FIFFV_MISC_CH

* add comment

* flakefix

* form msg in nicer way
  • Loading branch information
jjnurminen authored and agramfort committed Oct 13, 2016
1 parent 65adad7 commit f621a69
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mne/realtime/fieldtrip_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ def _guess_measurement_info(self):
# channel dictionary list
info['chs'] = []

# unrecognized channels
chs_unknown = []

for idx, ch in enumerate(self.ft_header.labels):
this_info = dict()

Expand All @@ -173,6 +176,10 @@ def _guess_measurement_info(self):
this_info['kind'] = FIFF.FIFFV_MISC_CH
elif ch.startswith('SYS'):
this_info['kind'] = FIFF.FIFFV_SYST_CH
else:
# cannot guess channel type, mark as MISC and warn later
this_info['kind'] = FIFF.FIFFV_MISC_CH
chs_unknown.append(ch)

# Fieldtrip already does calibration
this_info['range'] = 1.0
Expand Down Expand Up @@ -202,6 +209,11 @@ def _guess_measurement_info(self):
info._update_redundant()
info._check_consistency()

if chs_unknown:
msg = ('Following channels in the FieldTrip header were '
'unrecognized and marked as MISC: ')
warn(msg + ', '.join(chs_unknown))

else:

# XXX: the data in real-time mode and offline mode
Expand Down

0 comments on commit f621a69

Please sign in to comment.