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_blobs_1d_shape(self):
im = ps.generators.blobs(shape=[101])
assert len(list(im.shape)) == 3
def setup_class(self):
plt.close('all')
self.im = sp.random.randint(0, 10, 20)
sp.random.seed(0)
self.blobs = ps.generators.blobs(shape=[101, 101])
self.im2D = ps.generators.blobs(shape=[51, 51])
self.im3D = ps.generators.blobs(shape=[51, 51, 51])
self.labels, N = spim.label(input=self.blobs)
def test_to_vtk(self):
im = ps.generators.blobs(shape=[20, 20, 20])
ps.io.to_vtk(im, path='vtk_func_test')
assert os.stat('vtk_func_test.vti').st_size == 8433
os.remove('vtk_func_test.vti')
def test_planar_2d_image(self):
np.random.seed(1)
im1 = ps.generators.blobs([100, 100, 1])
np.random.seed(1)
im2 = ps.generators.blobs([100, 1, 100])
np.random.seed(1)
im3 = ps.generators.blobs([1, 100, 100])
np.random.seed(1)
snow_out1 = ps.filters.snow_partitioning(im1, return_all=True)
pore_map1 = snow_out1.im * snow_out1.regions
net1 = ps.networks.regions_to_network(im=pore_map1,
dt=snow_out1.dt,
voxel_size=1)
np.random.seed(1)
snow_out2 = ps.filters.snow_partitioning(im2, return_all=True)
pore_map2 = snow_out2.im * snow_out2.regions
net2 = ps.networks.regions_to_network(im=pore_map2,
dt=snow_out2.dt,
voxel_size=1)
np.random.seed(1)
snow_out3 = ps.filters.snow_partitioning(im3, return_all=True)
def setup_class(self):
plt.close('all')
self.im = sp.random.randint(0, 10, 20)
sp.random.seed(0)
self.blobs = ps.generators.blobs(shape=[101, 101])
self.im2D = ps.generators.blobs(shape=[51, 51])
self.im3D = ps.generators.blobs(shape=[51, 51, 51])
self.labels, N = spim.label(input=self.blobs)
def setup_class(self):
self.im = ps.generators.blobs(shape=[51, 51, 51])
def setup_class(self):
self.im = ps.generators.blobs(shape=[300, 300])
self.snow = ps.filters.snow_partitioning(self.im, return_all=True)
self.im3d = ps.generators.blobs(shape=[50, 50, 50])
self.snow3d = ps.filters.snow_partitioning(self.im3d, return_all=True)
def setup_class(self):
self.l = 100
self.im = ps.generators.overlapping_spheres(shape=[self.l, self.l],
radius=5,
porosity=0.5)
self.mip = ps.simulations.Porosimetry(self.im)
self.blobs = ps.generators.blobs([self.l, self.l, self.l])
def test_planar_2d_image(self):
np.random.seed(1)
im1 = ps.generators.blobs([100, 100, 1])
np.random.seed(1)
im2 = ps.generators.blobs([100, 1, 100])
np.random.seed(1)
im3 = ps.generators.blobs([1, 100, 100])
np.random.seed(1)
snow_out1 = ps.filters.snow_partitioning(im1, return_all=True)
pore_map1 = snow_out1.im * snow_out1.regions
net1 = ps.networks.regions_to_network(im=pore_map1,
dt=snow_out1.dt,
voxel_size=1)
np.random.seed(1)
snow_out2 = ps.filters.snow_partitioning(im2, return_all=True)
pore_map2 = snow_out2.im * snow_out2.regions
net2 = ps.networks.regions_to_network(im=pore_map2,
dt=snow_out2.dt,
voxel_size=1)
def test_voronoi_edges(self):
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