Example #1
0
    def noise_colored():
        """ return array of colored noise """
        # random field
        arr = np.random.randn(*shape)

        # forward transform
        arr = np_rfftn(arr)

        # scale according to frequency
        arr *= scaling

        # backwards transform
        arr = np_irfftn(arr, shape)
        return arr
Example #2
0
    def noise_colored() -> np.ndarray:
        """return array of colored noise"""
        # random field
        arr: np.ndarray = rng.normal(size=shape)  # type: ignore

        # forward transform
        arr = np_rfftn(arr)

        # scale according to frequency
        arr *= scaling

        # backwards transform
        arr = np_irfftn(arr, shape)
        return arr