MCPcopy
hub / github.com/mne-tools/mne-python / _check_raw_compatibility

Function _check_raw_compatibility

mne/io/base.py:3167–3200  ·  view source on GitHub ↗

Ensure all instances of Raw have compatible parameters.

(raw)

Source from the content-addressed store, hash-verified

3165
3166
3167def _check_raw_compatibility(raw):
3168 """Ensure all instances of Raw have compatible parameters."""
3169 for ri in range(1, len(raw)):
3170 if not isinstance(raw[ri], type(raw[0])):
3171 raise ValueError(f"raw[{ri}] type must match")
3172 for key in ("nchan", "sfreq"):
3173 a, b = raw[ri].info[key], raw[0].info[key]
3174 if a != b:
3175 raise ValueError(
3176 f"raw[{ri}].info[{key}] must match:\n{repr(a)} != {repr(b)}"
3177 )
3178 for kind in ("bads", "ch_names"):
3179 set1 = set(raw[0].info[kind])
3180 set2 = set(raw[ri].info[kind])
3181 mismatch = set1.symmetric_difference(set2)
3182 if mismatch:
3183 raise ValueError(
3184 f"raw[{ri}]['info'][{kind}] do not match: {sorted(mismatch)}"
3185 )
3186 if any(raw[ri]._cals != raw[0]._cals):
3187 raise ValueError(f"raw[{ri}]._cals must match")
3188 if len(raw[0].info["projs"]) != len(raw[ri].info["projs"]):
3189 raise ValueError("SSP projectors in raw files must be the same")
3190 if not all(
3191 _proj_equal(p1, p2)
3192 for p1, p2 in zip(raw[0].info["projs"], raw[ri].info["projs"])
3193 ):
3194 raise ValueError("SSP projectors in raw files must be the same")
3195 if any(r.orig_format != raw[0].orig_format for r in raw):
3196 warn(
3197 "raw files do not all have the same data format, could result in "
3198 'precision mismatch. Setting raw.orig_format="unknown"'
3199 )
3200 raw[0].orig_format = "unknown"
3201
3202
3203@verbose

Callers 2

appendMethod · 0.85
__init__Method · 0.85

Calls 3

setFunction · 0.85
_proj_equalFunction · 0.85
warnFunction · 0.85

Tested by

no test coverage detected