def _get_test_info(): """Helper to make test info""" test_info = _empty_info(1000) loc = np.array([0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0], dtype=np.float32) test_info["chs"] = [ { "cal": 1, "ch_name": "ICA 001", "coil_type": 0, "coord_Frame": 0, "kind": 502, "loc": loc.copy(), "logno": 1, "range": 1.0, "scanno": 1, "unit": -1, "unit_mul": 0, }, { "cal": 1, "ch_name": "ICA 002", "coil_type": 0, "coord_Frame": 0, "kind": 502, "loc": loc.copy(), "logno": 2, "range": 1.0, "scanno": 2, "unit": -1, "unit_mul": 0, }, { "cal": 0.002142000012099743, "ch_name": "EOG 061", "coil_type": 1, "coord_frame": 0, "kind": 202, "loc": loc.copy(), "logno": 61, "range": 1.0, "scanno": 376, "unit": 107, "unit_mul": 0, }, ] test_info._update_redundant() test_info._check_consistency() return test_info
def _get_test_info(): """Make test info.""" test_info = _empty_info(1000) loc = np.array([0., 0., 0., 1., 0., 0., 0., 1., 0., 0., 0., 1.], dtype=np.float32) test_info['chs'] = [{ 'cal': 1, 'ch_name': 'ICA 001', 'coil_type': 0, 'coord_Frame': 0, 'kind': 502, 'loc': loc.copy(), 'logno': 1, 'range': 1.0, 'scanno': 1, 'unit': -1, 'unit_mul': 0 }, { 'cal': 1, 'ch_name': 'ICA 002', 'coil_type': 0, 'coord_Frame': 0, 'kind': 502, 'loc': loc.copy(), 'logno': 2, 'range': 1.0, 'scanno': 2, 'unit': -1, 'unit_mul': 0 }, { 'cal': 0.002142000012099743, 'ch_name': 'EOG 061', 'coil_type': 1, 'coord_frame': 0, 'kind': 202, 'loc': loc.copy(), 'logno': 61, 'range': 1.0, 'scanno': 376, 'unit': 107, 'unit_mul': 0 }] test_info._update_redundant() test_info._check_consistency() return test_info
def _get_test_info(): """Helper to make test info""" test_info = _empty_info(1000) loc = np.array([0., 0., 0., 1., 0., 0., 0., 1., 0., 0., 0., 1.], dtype=np.float32) test_info['chs'] = [ {'cal': 1, 'ch_name': 'ICA 001', 'coil_type': 0, 'coord_Frame': 0, 'kind': 502, 'loc': loc.copy(), 'logno': 1, 'range': 1.0, 'scanno': 1, 'unit': -1, 'unit_mul': 0}, {'cal': 1, 'ch_name': 'ICA 002', 'coil_type': 0, 'coord_Frame': 0, 'kind': 502, 'loc': loc.copy(), 'logno': 2, 'range': 1.0, 'scanno': 2, 'unit': -1, 'unit_mul': 0}, {'cal': 0.002142000012099743, 'ch_name': 'EOG 061', 'coil_type': 1, 'coord_frame': 0, 'kind': 202, 'loc': loc.copy(), 'logno': 61, 'range': 1.0, 'scanno': 376, 'unit': 107, 'unit_mul': 0}] test_info._update_redundant() test_info._check_consistency() return test_info
fif_fname = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data', 'test_raw.fif') lout_path = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data') bti_dir = op.join(op.dirname(__file__), '..', '..', 'io', 'bti', 'tests', 'data') fname_ctf_raw = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data', 'test_ctf_comp_raw.fif') fname_kit_157 = op.join(op.dirname(__file__), '..', '..', 'io', 'kit', 'tests', 'data', 'test.sqd') test_info = _empty_info(1000) test_info.update({ 'chs': [{ 'cal': 1, 'ch_name': 'ICA 001', 'coil_type': 0, 'coord_Frame': 0, 'kind': 502, 'loc': np.array([0., 0., 0., 1., 0., 0., 0., 1., 0., 0., 0., 1.], dtype=np.float32),
fif_fname = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data', 'test_raw.fif') lout_path = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data') bti_dir = op.join(op.dirname(__file__), '..', '..', 'io', 'bti', 'tests', 'data') fname_ctf_raw = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data', 'test_ctf_comp_raw.fif') fname_kit_157 = op.join(op.dirname(__file__), '..', '..', 'io', 'kit', 'tests', 'data', 'test.sqd') test_info = _empty_info(1000) test_info.update({ 'chs': [{'cal': 1, 'ch_name': 'ICA 001', 'coil_type': 0, 'coord_Frame': 0, 'kind': 502, 'loc': np.array([0., 0., 0., 1., 0., 0., 0., 1., 0., 0., 0., 1.], dtype=np.float32), 'logno': 1, 'range': 1.0, 'scanno': 1, 'unit': -1, 'unit_mul': 0}, {'cal': 1, 'ch_name': 'ICA 002',
def _create_info(self): """Create a minimal Info dictionary for epoching, averaging, etc.""" if self.info is None: warn('Info dictionary not provided. Trying to guess it from ' 'FieldTrip Header object') info = _empty_info(self.ft_header.fSample) # create info # modify info attributes according to the FieldTrip Header object info['comps'] = list() info['projs'] = list() info['bads'] = list() # channel dictionary list info['chs'] = [] # unrecognized channels chs_unknown = [] for idx, ch in enumerate(self.ft_header.labels): this_info = dict() this_info['scanno'] = idx # extract numerical part of channel name this_info['logno'] = \ int(re.findall(r'[^\W\d_]+|\d+', ch)[-1]) if ch.startswith('EEG'): this_info['kind'] = FIFF.FIFFV_EEG_CH elif ch.startswith('MEG'): this_info['kind'] = FIFF.FIFFV_MEG_CH elif ch.startswith('MCG'): this_info['kind'] = FIFF.FIFFV_MCG_CH elif ch.startswith('EOG'): this_info['kind'] = FIFF.FIFFV_EOG_CH elif ch.startswith('EMG'): this_info['kind'] = FIFF.FIFFV_EMG_CH elif ch.startswith('STI'): this_info['kind'] = FIFF.FIFFV_STIM_CH elif ch.startswith('ECG'): this_info['kind'] = FIFF.FIFFV_ECG_CH elif ch.startswith('MISC'): 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) # Set coil_type (does FT supply this information somehow?) this_info['coil_type'] = FIFF.FIFFV_COIL_NONE # Fieldtrip already does calibration this_info['range'] = 1.0 this_info['cal'] = 1.0 this_info['ch_name'] = ch this_info['loc'] = np.zeros(12) if ch.startswith('EEG'): this_info['coord_frame'] = FIFF.FIFFV_COORD_HEAD elif ch.startswith('MEG'): this_info['coord_frame'] = FIFF.FIFFV_COORD_DEVICE else: this_info['coord_frame'] = FIFF.FIFFV_COORD_UNKNOWN if ch.startswith('MEG') and ch.endswith('1'): this_info['unit'] = FIFF.FIFF_UNIT_T elif ch.startswith('MEG') and (ch.endswith('2') or ch.endswith('3')): this_info['unit'] = FIFF.FIFF_UNIT_T_M else: this_info['unit'] = FIFF.FIFF_UNIT_V this_info['unit_mul'] = 0 info['chs'].append(this_info) 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 # does not match unless this is done self.info['projs'] = list() # FieldTrip buffer already does the calibration for this_info in self.info['chs']: this_info['range'] = 1.0 this_info['cal'] = 1.0 this_info['unit_mul'] = 0 info = copy.deepcopy(self.info) return info
fif_fname = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data', 'test_raw.fif') lout_path = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data') bti_dir = op.join(op.dirname(__file__), '..', '..', 'io', 'bti', 'tests', 'data') fname_ctf_raw = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data', 'test_ctf_comp_raw.fif') fname_kit_157 = op.join(op.dirname(__file__), '..', '..', 'io', 'kit', 'tests', 'data', 'test.sqd') test_info = _empty_info() test_info.update({ 'ch_names': ['ICA 001', 'ICA 002', 'EOG 061'], 'chs': [{'cal': 1, 'ch_name': 'ICA 001', 'coil_type': 0, 'coord_Frame': 0, 'kind': 502, 'loc': np.array([0., 0., 0., 1., 0., 0., 0., 1., 0., 0., 0., 1.], dtype=np.float32), 'logno': 1, 'range': 1.0, 'scanno': 1, 'unit': -1, 'unit_mul': 0}, {'cal': 1,