# 4.6.14. pde.tools.spectral module

Functions making use of spectral decompositions

 make_colored_noise Return a function creating an array of random values that obey
make_colored_noise(shape, dx=1.0, exponent=0, scale=1, rng=None)[source]

Return a function creating an array of random values that obey

$\langle c(\boldsymbol k) c(\boldsymbol k’) \rangle = \Gamma^2 |\boldsymbol k|^\nu \delta(\boldsymbol k-\boldsymbol k’)$

in spectral space on a Cartesian grid. The special case $$\nu = 0$$ corresponds to white noise. For simplicity, the correlations respect periodic boundary conditions.

Parameters:
• shape (tuple of ints) – Number of supports points in each spatial dimension. The number of the list defines the spatial dimension.

• dx (float or list of floats) – Discretization along each dimension. A uniform discretization in each direction can be indicated by a single number.

• exponent (float) – Exponent $$\nu$$ of the power spectrum

• scale (float) – Scaling factor $$\Gamma$$ determining noise strength

• rng (Generator) – Random number generator (default: default_rng())

Returns:

a function returning a random realization

Return type:

callable