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

Function test_triangle_neighbors

mne/source_space/tests/test_source_space.py:443–457  ·  view source on GitHub ↗

Test efficient vertex neighboring triangles for surfaces.

()

Source from the content-addressed store, hash-verified

441@pytest.mark.slowtest
442@testing.requires_testing_data
443def test_triangle_neighbors():
444 """Test efficient vertex neighboring triangles for surfaces."""
445 this = read_source_spaces(fname)[0]
446 this["neighbor_tri"] = [list() for _ in range(this["np"])]
447 for p in range(this["ntri"]):
448 verts = this["tris"][p]
449 this["neighbor_tri"][verts[0]].append(p)
450 this["neighbor_tri"][verts[1]].append(p)
451 this["neighbor_tri"][verts[2]].append(p)
452 this["neighbor_tri"] = [np.array(nb, int) for nb in this["neighbor_tri"]]
453
454 neighbor_tri = _triangle_neighbors(this["tris"], this["np"])
455 assert all(
456 np.array_equal(nt1, nt2) for nt1, nt2 in zip(neighbor_tri, this["neighbor_tri"])
457 )
458
459
460def test_accumulate_normals():

Callers

nothing calls this directly

Calls 3

read_source_spacesFunction · 0.90
_triangle_neighborsFunction · 0.90
appendMethod · 0.45

Tested by

no test coverage detected