How to use porespy - 10 common examples

To help you get started, we’ve selected a few porespy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PMEAL / porespy / test / unit / test_generators.py View on Github external
def test_blobs_1d_shape(self):
        im = ps.generators.blobs(shape=[101])
        assert len(list(im.shape)) == 3
github PMEAL / porespy / test / unit / test_tools.py View on Github external
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)
github PMEAL / porespy / test / unit / test_io.py View on Github external
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')
github PMEAL / porespy / test / unit / test_network_extraction.py View on Github external
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)
github PMEAL / porespy / test / unit / test_tools.py View on Github external
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)
github PMEAL / porespy / test / unit / test_visualization.py View on Github external
def setup_class(self):
        self.im = ps.generators.blobs(shape=[51, 51, 51])
github PMEAL / porespy / test / unit / test_network_extraction.py View on Github external
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)
github PMEAL / porespy / test / unit / test_simulations.py View on Github external
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])
github PMEAL / porespy / test / unit / test_network_extraction.py View on Github external
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)
github PMEAL / porespy / test / unit / test_generators.py View on Github external
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