pynrc.simul.ngNRC.fft_noise

pynrc.simul.ngNRC.fft_noise(pow_spec, nstep_out=None, fmin=None, f=None, pad_mode='edge', rand_seed=None, **kwargs)[source]

Random Noise from Power Spectrum

Returns a noised array where the instrinsic distribution follows that of the input power spectrum. The output has an instrinsic standard deviation scaled to 1.0.

Parameters
  • pow_spec (ndarray) – Input power spectrum from which to generate noise distribution.

  • nstep_out (int) – Desired size of the output noise array. If smaller than pow_spec then it just truncates the results to the appropriate size. If larger, then pow_spec gets padded by the specified pad_mode.

  • fmin (float or None) – Low-frequency cutoff. Power spectrum values below this cut-off point get set equal to the power spectrum value at fmin.

  • f (ndarray or None) – An array the same size as pow_spec and is only used when fmin is set. If set to None, then f = np.fft.rfftfreq(n_ifft) where n_ifft is the size of the result of rifft(pow_spec) assuming a delta time of unity.

  • pad_mode (str or function) – One of the following string values or a user supplied function. Default is ‘edge’.

    ‘constant’ (default)

    Pads with a constant value.

    ‘edge’

    Pads with the edge values of array.

    ‘linear_ramp’

    Pads with the linear ramp between end_value and the array edge value.

    ‘maximum’

    Pads with the maximum value of all or part of the vector along each axis.

    ‘mean’

    Pads with the mean value of all or part of the vector along each axis.

    ‘median’

    Pads with the median value of all or part of the vector along each axis.

    ‘minimum’

    Pads with the minimum value of all or part of the vector along each axis.

    ‘reflect’

    Pads with the reflection of the vector mirrored on the first and last values of the vector along each axis.

    ‘symmetric’

    Pads with the reflection of the vector mirrored along the edge of the array.

    ‘wrap’

    Pads with the wrap of the vector along the axis. The first values are used to pad the end and the end values are used to pad the beginning.