Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_local_thickness_known_sizes(self):
im = sp.zeros(shape=[300, 300])
im = ps.generators.RSA(im=im, radius=20)
im = ps.generators.RSA(im=im, radius=10)
im = im > 0
lt = ps.filters.local_thickness(im, sizes=[20, 10])
assert sp.all(sp.unique(lt) == [0, 10, 20])
def test_RSA_mask_edge_2d(self):
im = sp.zeros([100, 100], dtype=int)
im = ps.generators.RSA(im, radius=10, volume_fraction=0.5,
mode='contained')
coords = sp.argwhere(im == 2)
assert ~sp.any(coords < 10)
assert ~sp.any(coords > 90)
def test_RSA_3d_single(self):
sp.random.seed(0)
im = sp.zeros([50, 50, 50], dtype=int)
im = ps.generators.RSA(im, radius=5, volume_fraction=0.5)
assert sp.sum(im > 0) == 45602
assert sp.sum(im > 1) == 121
def test_RSA_2d_multi(self):
sp.random.seed(0)
im = sp.zeros([100, 100], dtype=int)
im = ps.generators.RSA(im, radius=10, volume_fraction=0.5)
im = ps.generators.RSA(im, radius=5, volume_fraction=0.75)
assert sp.sum(im > 0) == 6520
assert sp.sum(im > 1) == 44
def test_RSA_mask_edge_3d(self):
im = sp.zeros([50, 50, 50], dtype=int)
im = ps.generators.RSA(im, radius=5, volume_fraction=0.5,
mode='contained')
coords = sp.argwhere(im == 2)
assert ~sp.any(coords < 5)
assert ~sp.any(coords > 45)
def test_local_thickness_known_sizes(self):
im = sp.zeros(shape=[300, 300])
im = ps.generators.RSA(im=im, radius=20)
im = ps.generators.RSA(im=im, radius=10)
im = im > 0
lt = ps.filters.local_thickness(im, sizes=[20, 10])
assert sp.all(sp.unique(lt) == [0, 10, 20])
def test_RSA_2d_multi(self):
sp.random.seed(0)
im = sp.zeros([100, 100], dtype=int)
im = ps.generators.RSA(im, radius=10, volume_fraction=0.5)
im = ps.generators.RSA(im, radius=5, volume_fraction=0.75)
assert sp.sum(im > 0) == 6520
assert sp.sum(im > 1) == 44
def test_RSA_2d_single(self):
sp.random.seed(0)
im = sp.zeros([100, 100], dtype=int)
im = ps.generators.RSA(im, radius=10, volume_fraction=0.5)
assert sp.sum(im > 0) == 5095
assert sp.sum(im > 1) == 20