fractal_noise

Import packages

[1]:
import matplotlib.pyplot as plt
import numpy as np
import porespy as ps
import scipy

ps.visualization.set_mpl_style()
np.random.seed(10)

Apply generator function

While adding inputs to the function, the frequency must be a factor of shape, that when put to the power of octave is less than or equal to shape. If not, exceptions will be raised:

[ ]:
x = ps.generators.fractal_noise(shape=[200, 200],
                                frequency=0.05,
                                octaves=4,
                                gain=0.5,
                                mode='simplex',
                                seed=None,
                                cores=None,
                                uniform=True)
plt.figure(figsize=[4, 4])
plt.axis(False)
plt.imshow(x);

Octaves

[ ]:
xx = ps.generators.fractal_noise(shape=[200, 200],
                                 frequency=0.05,
                                 octaves=10,
                                 gain=0.5,
                                 mode='simplex',
                                 seed=None,
                                 cores=None,
                                 uniform=True)

fig, ax = plt.subplots(1, 2, figsize=[8, 4])
ax[0].imshow(x)
ax[1].imshow(xx)
ax[0].axis(False)
ax[1].axis(False)
ax[0].set_title('Octaves = 4')
ax[1].set_title('Octaves = 10');

Gain

[ ]:
xx = ps.generators.fractal_noise(shape=[200, 200],
                                 frequency=0.05,
                                 octaves=10,
                                 gain=0.9,
                                 mode='simplex',
                                 seed=None,
                                 cores=None,
                                 uniform=True)

fig, ax = plt.subplots(1, 2, figsize=[8, 4])
ax[0].imshow(x)
ax[1].imshow(xx)
ax[0].axis(False)
ax[1].axis(False)
ax[0].set_title('Gain = 0.5')
ax[1].set_title('Gain = 0.9');