4.6.13. pde.tools.spectral module¶
Functions making use of spectral decompositions
Return a function creating an array of random values that obey |
- make_colored_noise(shape: Tuple[int, ...], dx=1.0, exponent: float = 0, scale: float = 1, rng: Optional[numpy.random._generator.Generator] = None) Callable[[], numpy.ndarray] [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.
- 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 – Exponent \(\nu\) of the power spectrum
scale – Scaling factor \(\Gamma\) determining noise strength
rng (
Generator
) – Random number generator (default:default_rng()
)
- Returns
a function returning a random realization
- Return type
callable