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

Function test_make_bem_model

mne/tests/test_bem.py:197–219  ·  view source on GitHub ↗

Test BEM model creation from Python with I/O.

(tmp_path, kwargs, fname)

Source from the content-addressed store, hash-verified

195 ],
196)
197def 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

Callers

nothing calls this directly

Calls 6

catch_loggingClass · 0.90
make_bem_modelFunction · 0.90
read_bem_surfacesFunction · 0.90
write_bem_surfacesFunction · 0.90
_compare_bem_surfacesFunction · 0.85
getvalueMethod · 0.80

Tested by

no test coverage detected