Test BEM model creation from Python with I/O.
(tmp_path, kwargs, fname)
| 195 | ], |
| 196 | ) |
| 197 | def test_make_bem_model(tmp_path, kwargs, fname): |
| 198 | """Test BEM model creation from Python with I/O.""" |
| 199 | pytest.importorskip("nibabel") |
| 200 | fname_temp = tmp_path / "temp-bem.fif" |
| 201 | with catch_logging() as log: |
| 202 | model = make_bem_model( |
| 203 | "sample", ico=2, subjects_dir=subjects_dir, verbose=True, **kwargs |
| 204 | ) |
| 205 | log = log.getvalue() |
| 206 | if len(kwargs.get("conductivity", (0, 0, 0))) == 1: |
| 207 | assert "distance" not in log |
| 208 | else: |
| 209 | assert re.search(r"surfaces is approximately *3\.4 mm", log) is not None |
| 210 | assert re.search(r"inner skull CM is *0\.65 *-9\.62 *43\.85 mm", log) is not None |
| 211 | model_c = read_bem_surfaces(fname) |
| 212 | _compare_bem_surfaces(model, model_c) |
| 213 | write_bem_surfaces(fname_temp, model) |
| 214 | model_read = read_bem_surfaces(fname_temp) |
| 215 | _compare_bem_surfaces(model, model_c) |
| 216 | _compare_bem_surfaces(model_read, model_c) |
| 217 | # bad conductivity |
| 218 | with pytest.raises(ValueError, match="conductivity must be"): |
| 219 | make_bem_model("sample", 4, [0.3, 0.006], subjects_dir=subjects_dir) |
| 220 | |
| 221 | |
| 222 | @testing.requires_testing_data |
nothing calls this directly
no test coverage detected