Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit107ead6

Browse files
committed
TEST: More fully test mesh and family APIs
1 parentcbb91d1 commit107ead6

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

‎nibabel/tests/test_pointset.py‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def test_to_mask(self):
186186

187187

188188
classTestTriangularMeshes:
189-
deftest_init(self):
189+
deftest_api(self):
190190
# Tetrahedron
191191
coords=np.array(
192192
[
@@ -227,6 +227,36 @@ def test_init(self):
227227
asserttm2.n_triangles==4
228228
asserttm3.n_triangles==4
229229

230+
out_coords,out_tris=tm1.get_mesh()
231+
# Currently these are the exact arrays, but I don't think we should
232+
# bake that assumption into the tests
233+
assertnp.allclose(out_coords,coords)
234+
assertnp.allclose(out_tris,triangles)
235+
236+
237+
classTestCoordinateFamilyMixin(TestPointsets):
238+
deftest_names(self):
239+
coords=np.array(
240+
[
241+
[0.0,0.0,0.0],
242+
[0.0,0.0,1.0],
243+
[0.0,1.0,0.0],
244+
[1.0,0.0,0.0],
245+
]
246+
)
247+
cfm=ps.CoordinateFamilyMixin(coords)
248+
249+
assertcfm.get_names()== ['original']
250+
assertnp.allclose(cfm.with_name('original').coordinates,coords)
251+
252+
cfm.add_coordinates('shifted',coords+1)
253+
assertcfm.get_names()== ['original','shifted']
254+
shifted=cfm.with_name('shifted')
255+
assertnp.allclose(shifted.coordinates,coords+1)
256+
assertshifted.get_names()== ['original','shifted']
257+
original=shifted.with_name('original')
258+
assertnp.allclose(original.coordinates,coords)
259+
230260

231261
classH5ArrayProxy:
232262
def__init__(self,file_like,dataset_name):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp