Skip to content

Commit

Permalink
changed mode to edges in random_spheres tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jgostick committed Mar 13, 2024
1 parent a8c61b0 commit d3417c0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/unit/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@ def test_blobs_w_divs(self):
def test_random_spheres_2d_contained(self):
im = np.zeros([100, 100], dtype=int)
im = ps.generators.random_spheres(
im, r=10, volume_fraction=0.5, mode='contained')
im, r=10, volume_fraction=0.5, edges='contained')
im = np.pad(im, pad_width=1, mode='constant', constant_values=False)
lt = ps.filters.local_thickness(im)
assert len(np.unique(lt)) == 2

def test_random_spheres_2d_extended(self):
im = np.zeros([100, 100], dtype=int)
im = ps.generators.random_spheres(
im, r=10, volume_fraction=0.5, mode='extended')
im, r=10, volume_fraction=0.5, edges='extended')
im = np.pad(im, pad_width=1, mode='constant', constant_values=False)
lt = ps.filters.local_thickness(im)
assert len(np.unique(lt)) > 2
Expand All @@ -285,22 +285,22 @@ def test_random_spheres_2d_extended_with_clearance(self):
im = ps.generators.random_spheres(im, r=10,
volume_fraction=0.5,
clearance=2,
mode='extended')
edges='extended')
im = np.pad(im, pad_width=1, mode='constant', constant_values=False)
lt = ps.filters.local_thickness(im)
assert len(np.unique(lt)) > 2

def test_random_spheres_3d_contained(self):
im = np.zeros([100, 100, 100], dtype=int)
im = ps.generators.random_spheres(
im, r=10, volume_fraction=0.5, mode='contained')
im, r=10, volume_fraction=0.5, edges='contained')
lt = ps.filters.local_thickness(im, sizes=[10, 9, 8, 7, 6, 5])
assert len(np.unique(lt)) == 2

def test_random_spheres_3d_extended(self):
im = np.zeros([100, 100, 100], dtype=int)
im = ps.generators.random_spheres(
im, r=10, volume_fraction=0.5, mode='extended')
im, r=10, volume_fraction=0.5, edges='extended')
im = np.pad(im, pad_width=1, mode='constant', constant_values=False)
lt = ps.filters.local_thickness(im, sizes=[10, 9, 8, 7, 6, 5])
assert len(np.unique(lt)) > 2
Expand All @@ -316,15 +316,15 @@ def test_random_spheres_2d_seqential_additions(self):
def test_random_spheres_preexisting_structure(self):
im = ps.generators.blobs(shape=[200, 200, 200])
phi1 = im.sum()/im.size
im = ps.generators.random_spheres(im, r=8, n_max=200, mode='contained')
im = ps.generators.random_spheres(im, r=8, n_max=200, edges='contained')
phi2 = im.sum()/im.size
assert phi2 > phi1
# Ensure that 3 passes through random_spheres fills up image
im = ps.generators.random_spheres(im, r=8, n_max=200, mode='contained')
im = ps.generators.random_spheres(im, r=8, n_max=200, mode='contained')
im = ps.generators.random_spheres(im, r=8, n_max=200, mode='contained')
im = ps.generators.random_spheres(im, r=8, n_max=200, edges='contained')
im = ps.generators.random_spheres(im, r=8, n_max=200, edges='contained')
im = ps.generators.random_spheres(im, r=8, n_max=200, edges='contained')
phi1 = im.sum()/im.size
im = ps.generators.random_spheres(im, r=8, n_max=200, mode='contained')
im = ps.generators.random_spheres(im, r=8, n_max=200, edges='contained')
phi2 = im.sum()/im.size
assert phi2 == phi1

Expand Down

0 comments on commit d3417c0

Please sign in to comment.