Test applying CSD to FIF data.
()
| 162 | |
| 163 | |
| 164 | def 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 | |
| 190 | def test_csd_epochs(tmp_path): |
nothing calls this directly
no test coverage detected