How to use the porespy.generators 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_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_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
github PMEAL / porespy / test / unit / test_tools.py View on Github external
def setup_class(self):
        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_tools.py View on Github external
def setup_class(self):
        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_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 / porespy / simulations / __VRandomWalk__.py View on Github external
self.big_im = big_im.copy()
        plt.figure()
        if self.dim == 3:
            big_im = big_im[:, :, slice_ind]
        masked_array = np.ma.masked_where(big_im == self.solid_value-2, big_im)
        cmap = matplotlib.cm.brg
        cmap.set_bad(color='black')
        plt.imshow(masked_array, cmap=cmap)


if __name__ == "__main__":
    if 1 == 1:
        # Load tau test image
        im = 1 - ps.data.tau()
    else:
        im = ps.generators.blobs(100).astype(int)

    # Number of time steps and walkers
    num_t = 10000
    num_w = 1
    # Track time of simulation
    st = time.time()
    rw = VRandomWalk(im)
    rw.run(num_t, num_w, same_start=False)
    # Plot mean square displacement
    rw.plot_msd()
    # Plot the longest walk
    rw.plot_walk(w_id=np.argmax(rw.sq_disp[-1, :]))
    # Plot all the walks
#    rw.plot_walk()
    print('sim time', time.time()-st)
github PMEAL / porespy / examples.py View on Github external
import porespy as ps
import matplotlib.pyplot as plt

# Generate an image of spheres using the imgen class
im = ps.generators.blobs(shape=[500, 500], porosity=0.7, blobiness=1)
plt.figure(1)
plt.imshow(im)

# Chord length distributions
chords = ps.filters.apply_chords(im=im, trim_edges=False)
colored_chords = ps.filters.region_size(chords)
h = ps.metrics.chord_length_distribution(chords, bins=25)
ps.visualization.set_mpl_style()
plt.figure(2)
plt.subplot(2, 2, 1)
plt.imshow(im)
plt.subplot(2, 2, 3)
plt.imshow(chords)
plt.subplot(2, 2, 4)
plt.imshow(colored_chords, cmap=plt.cm.jet)
plt.subplot(2, 2, 2)