Test n_components=None.
(method, tmp_path)
| 1375 | |
| 1376 | @pytest.mark.parametrize("method", ["fastica", "picard"]) |
| 1377 | def test_n_components_none(method, tmp_path): |
| 1378 | """Test n_components=None.""" |
| 1379 | _skip_check_picard(method) |
| 1380 | raw = read_raw_fif(raw_fname).crop(1.5, stop).load_data() |
| 1381 | events = read_events(event_name) |
| 1382 | picks = pick_types(raw.info, eeg=True, meg=False)[::5] |
| 1383 | epochs = Epochs( |
| 1384 | raw, events, event_id, tmin, tmax, picks=picks, baseline=(None, 0), preload=True |
| 1385 | ) |
| 1386 | |
| 1387 | n_components = None |
| 1388 | random_state = 12345 |
| 1389 | |
| 1390 | output_fname = tmp_path / "test_ica-ica.fif" |
| 1391 | ica = ICA(method=method, n_components=n_components, random_state=random_state) |
| 1392 | with _record_warnings(): |
| 1393 | ica.fit(epochs) |
| 1394 | _assert_ica_attributes(ica) |
| 1395 | ica.save(output_fname) |
| 1396 | |
| 1397 | ica = read_ica(output_fname) |
| 1398 | _assert_ica_attributes(ica) |
| 1399 | assert ica.n_pca_components is None |
| 1400 | assert ica.n_components is None |
| 1401 | assert ica.n_components_ == len(picks) |
| 1402 | |
| 1403 | |
| 1404 | @pytest.mark.slowtest |
nothing calls this directly
no test coverage detected