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

Function test_csd_fif

mne/preprocessing/tests/test_csd.py:164–187  ·  view source on GitHub ↗

Test applying CSD to FIF data.

()

Source from the content-addressed store, hash-verified

162
163
164def test_csd_fif():
165 """Test applying CSD to FIF data."""
166 raw = read_raw_fif(raw_fname).load_data()
167 raw.info["bads"] = []
168 picks = pick_types(raw.info, meg=False, eeg=True)
169 assert "csd" not in raw
170 orig_eeg = raw.get_data("eeg")
171 assert len(orig_eeg) == 60
172 raw_csd = compute_current_source_density(raw)
173 assert "eeg" not in raw_csd
174 new_eeg = raw_csd.get_data("csd")
175 assert not (orig_eeg == new_eeg).any()
176
177 # reset the only things that should change, and assert objects are the same
178 assert raw_csd.info["custom_ref_applied"] == FIFF.FIFFV_MNE_CUSTOM_REF_CSD
179 with raw_csd.info._unlock():
180 raw_csd.info["custom_ref_applied"] = 0
181 for pick in picks:
182 ch = raw_csd.info["chs"][pick]
183 assert ch["coil_type"] == FIFF.FIFFV_COIL_EEG_CSD
184 assert ch["unit"] == FIFF.FIFF_UNIT_V_M2
185 ch.update(coil_type=FIFF.FIFFV_COIL_EEG, unit=FIFF.FIFF_UNIT_V)
186 raw_csd._data[pick] = raw._data[pick]
187 assert object_diff(raw.info, raw_csd.info) == ""
188
189
190def test_csd_epochs(tmp_path):

Callers

nothing calls this directly

Calls 8

read_raw_fifFunction · 0.90
pick_typesFunction · 0.90
object_diffFunction · 0.90
_unlockMethod · 0.80
load_dataMethod · 0.45
get_dataMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected