How to use the porespy.generators.lattice_spheres function in porespy

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_filters.py View on Github external
def test_reduce_peaks(self):
        im = ~ps.generators.lattice_spheres(shape=[50, 50], radius=5, offset=3)
        peaks = ps.filters.reduce_peaks(im)
        assert spim.label(im)[1] == spim.label(peaks)[1]
        im = ~ps.generators.lattice_spheres(shape=[50, 50, 50], radius=5,
                                            offset=3)
        peaks = ps.filters.reduce_peaks(im)
        assert spim.label(im)[1] == spim.label(peaks)[1]
github PMEAL / porespy / test / unit / test_metrics.py View on Github external
def test_representative_elementary_volume(self):
        im = ps.generators.lattice_spheres(shape=[999, 999],
                                           radius=15, offset=4)
        rev = ps.metrics.representative_elementary_volume(im)
        assert_allclose(sp.average(rev.porosity), im.sum()/im.size, rtol=1e-1)

        im = ps.generators.lattice_spheres(shape=[151, 151, 151],
                                           radius=9, offset=4)
        rev = ps.metrics.representative_elementary_volume(im)
        assert_allclose(sp.average(rev.porosity), im.sum()/im.size, rtol=1e-1)
github PMEAL / porespy / test / unit / test_generators.py View on Github external
def test_lattice_spheres_bcc(self):
        im = ps.generators.lattice_spheres(shape=[101, 101, 101],
                                           radius=4, offset=2,
                                           lattice='bcc')
        labels, N = spim.label(input=~im)
        assert N == 1024
github PMEAL / porespy / test / unit / test_filters.py View on Github external
def test_flood(self):
        im = ~ps.generators.lattice_spheres(shape=[100, 100], offset=3,
                                            radius=10)
        sz = ps.filters.flood(im*2.0, mode='max')
        assert sp.all(sp.unique(sz) == [0, 2])
        sz = ps.filters.flood(im, mode='min')
        assert sp.all(sp.unique(sz) == [0, 1])
        sz = ps.filters.flood(im, mode='size')
        assert sp.all(sp.unique(sz) == [0, 305])
github PMEAL / porespy / test / unit / test_metrics.py View on Github external
def setup_class(self):
        sp.random.seed(0)
        self.im2D = ps.generators.lattice_spheres(shape=[100, 100],
                                                  radius=5, offset=2,
                                                  lattice='square')
        self.im2D_big = ps.generators.lattice_spheres(shape=[500, 500],
                                                      radius=10, offset=10,
                                                      lattice='square')
        self.im3D = ps.generators.lattice_spheres(shape=[51, 51, 51],
                                                  radius=4, offset=2,
                                                  lattice='cubic')
        self.blobs = ps.generators.blobs(shape=[101, 101, 101], porosity=0.5,
                                         blobiness=[1, 2, 3])
        path = Path(os.path.realpath(__file__),
                    '../../../test/fixtures/partitioned_regions.tif')
        self.regions = sp.array(io.imread(path))
github PMEAL / porespy / test / unit / test_metrics.py View on Github external
def test_representative_elementary_volume(self):
        im = ps.generators.lattice_spheres(shape=[999, 999],
                                           radius=15, offset=4)
        rev = ps.metrics.representative_elementary_volume(im)
        assert_allclose(sp.average(rev.porosity), im.sum()/im.size, rtol=1e-1)

        im = ps.generators.lattice_spheres(shape=[151, 151, 151],
                                           radius=9, offset=4)
        rev = ps.metrics.representative_elementary_volume(im)
        assert_allclose(sp.average(rev.porosity), im.sum()/im.size, rtol=1e-1)
github PMEAL / porespy / test / unit / test_generators.py View on Github external
def test_lattice_spheres_triangular(self):
        im = ps.generators.lattice_spheres(shape=[101, 101], radius=5,
                                           lattice='triangular')
        labels, N = spim.label(input=~im)
        assert N == 85
github PMEAL / porespy / test / unit / test_generators.py View on Github external
def test_lattice_spheres_square(self):
        im = ps.generators.lattice_spheres(shape=[101, 101], radius=5,
                                           offset=0, lattice='sc')
        labels, N = spim.label(input=~im)
        assert N == 100
github PMEAL / porespy / test / unit / test_generators.py View on Github external
def test_lattice_spheres_sc(self):
        im = ps.generators.lattice_spheres(shape=[101, 101, 101],
                                           radius=4, offset=1,
                                           lattice='sc')
        labels, N = spim.label(input=~im)
        assert N == 1000
github PMEAL / porespy / test / unit / test_generators.py View on Github external
def test_lattice_spheres_fcc(self):
        im = ps.generators.lattice_spheres(shape=[101, 101, 101],
                                           radius=4, offset=2,
                                           lattice='fcc')
        labels, N = spim.label(input=~im)
        assert N == 392