MCPcopy Index your code
hub / github.com/mne-tools/mne-python / test_warnings

Function test_warnings

mne/preprocessing/tests/test_ica.py:187–215  ·  view source on GitHub ↗

Test that ICA warns on certain input data conditions.

()

Source from the content-addressed store, hash-verified

185
186
187def test_warnings():
188 """Test that ICA warns on certain input data conditions."""
189 raw = read_raw_fif(raw_fname).crop(0, 5).load_data()
190 events = read_events(event_name)
191 epochs = Epochs(raw, events=events, baseline=None, preload=True)
192 ica = ICA(n_components=2, max_iter=1, method="infomax", random_state=0)
193
194 # not high-passed
195 with epochs.info._unlock():
196 epochs.info["highpass"] = 0.0
197 with pytest.warns(RuntimeWarning, match="should be high-pass filtered"):
198 ica.fit(epochs)
199
200 # baselined
201 with epochs.info._unlock():
202 epochs.info["highpass"] = 1.0
203 epochs.baseline = (epochs.tmin, 0)
204 with pytest.warns(RuntimeWarning, match="epochs.*were baseline-corrected"):
205 ica.fit(epochs)
206
207 # cleaning baseline-corrected data
208 with epochs.info._unlock():
209 epochs.info["highpass"] = 1.0
210 epochs.baseline = None
211 ica.fit(epochs)
212
213 epochs.baseline = (epochs.tmin, 0)
214 with pytest.warns(RuntimeWarning, match="consider baseline-correcting.*again"):
215 ica.apply(epochs)
216
217
218@pytest.mark.parametrize("n_components", (None, 0.9999, 8, 9, 10))

Callers

nothing calls this directly

Calls 9

fitMethod · 0.95
applyMethod · 0.95
read_raw_fifFunction · 0.90
read_eventsFunction · 0.90
EpochsClass · 0.90
_unlockMethod · 0.80
ICAFunction · 0.70
load_dataMethod · 0.45
cropMethod · 0.45

Tested by

no test coverage detected