more generator tests
@@ -62,19 +62,47 @@ class GeneratorTest():
assert (poro-target)**2 < 0.15
def test_voronoi_edges(self):
- pass
+ sp.random.seed(0)
+ im = ps.generators.voronoi_edges(shape=[50, 50, 50],
+ radius=2,
+ ncells=25,
+ flat_faces=True)
+ top_slice = im[:, :, 0]
+ assert sp.sum(top_slice) == 1409
+
+ def test_circle_pack_square(self):
+ im = ps.generators.circle_pack(shape=[101, 101], radius=5)
+ labels, N = spim.label(input=~im)
+ assert N == 100
def test_circle_pack_triangular(self):
- pass
+ im = ps.generators.circle_pack(shape=[101, 101], radius=5,
+ packing='triangular')
+ labels, N = spim.label(input=~im)
+ assert N == 85
def test_sphere_pack_sc(self):
- pass
+ im = ps.generators.sphere_pack(shape=[101, 101, 101],
+ radius=4,
+ offset=1)
+ labels, N = spim.label(input=~im)
+ assert N == 1000
def test_sphere_pack_fcc(self):
- pass
+ im = ps.generators.sphere_pack(shape=[101, 101, 101],
+ radius=4,
+ offset=2,
+ packing='fcc')
+ labels, N = spim.label(input=~im)
+ assert N == 392
def test_sphere_pack_bcc(self):
- pass
+ im = ps.generators.sphere_pack(shape=[101, 101, 101],
+ radius=4,
+ offset=2,
+ packing='bcc')
+ labels, N = spim.label(input=~im)
+ assert N == 1024
def test_noise_simplex(self):
pass
@@ -89,3 +117,9 @@ if __name__ == '__main__':
t.test_bundle_of_tubes()
t.test_overlapping_spheres_3d()
t.test_polydisperse_spheres()
+ t.test_voronoi_edges()
+ t.test_circle_pack_square()
+ t.test_circle_pack_triangular()
+ t.test_sphere_pack_sc()
+ t.test_sphere_pack_fcc()
+ t.test_sphere_pack_bcc()
