Spectral Representation Method

The Spectral Representation Method (SRM) expands the stochastic process in a Fourier-type expansion of cosines. The version of the SRM implemented in UQpy uses a summation of cosines with random phase angles as:

\[A(t) = \sqrt{2}\sum_{i=1}^N\sqrt{2S(\omega_i)\Delta\omega}\cos(\omega_i t+\phi_i)\]

where \(S(\omega_i)\) is the discretized power spectrum at frequency \(\omega_i\), \(\Delta\omega\) is the frequency discretization, and \(\phi_i\) are random phase angles uniformly distributed in \([0, 2\pi]\). For computational efficiency, the SRM is implemented using the Fast Fourier Transform (FFT).

SpectralRepresentation Class

The SpectralRepresentation class is imported using the following command:

>>> from UQpy.stochastic_process.SpectralRepresentation import SpectralRepresentation

Methods

class SpectralRepresentation(n_samples, power_spectrum, time_interval, frequency_interval, n_time_intervals, n_frequency_intervals, random_state=None)[source]

A class to simulate stochastic processes from a given power spectrum density using the Spectral Representation Method. This class can simulate uni-variate, multi-variate, and multi-dimensional stochastic processes. The class uses Singular Value Decomposition, as opposed to Cholesky Decomposition, to ensure robust, near-positive definite multi-dimensional power spectra.

Parameters:
  • n_samples (int) – Number of samples of the stochastic process to be simulated. The run() method is automatically called if n_samples is provided. If n_samples is not provided, then the SpectralRepresentation object is created but samples are not generated.

  • power_spectrum (Union[list, ndarray, float]) –

    The discretized power spectrum.

    • For uni-variate, one-dimensional processes power_spectrum will be list or numpy.ndarray of length n_frequency_intervals.

    • For multi-variate, one-dimensional processes, power_spectrum will be a list or numpy.ndarray of size (n_of_variables, n_variables, n_frequency_intervals).

    • For uni-variate, multi-dimensional processes, power_spectrum will be a list or numpy.ndarray of size (n_frequency_intervals[0], ..., n_frequency_intervals[n_dimensions-1])

    • For multi-variate, multi-dimensional processes, power_spectrum will be a list or numpy.ndarray of size (n_variables, n_variables, n_frequency_intervals[0],...,n_frequency_intervals[n_dimensions-1]).

  • time_interval (Union[list, ndarray, float]) – Length of time discretizations (\(\Delta t\)) for each dimension of size n_dimensions.

  • frequency_interval (Union[list, ndarray, float]) – Length of frequency discretizations (\(\Delta \omega\)) for each dimension of size n_dimensions.

  • n_time_intervals (Union[list, ndarray, float]) – Number of time discretizations for each dimensions of size n_dimensions.

  • n_frequency_intervals (Union[list, ndarray, float]) – Number of frequency discretizations for each dimension of size n_dimensions.

  • random_state (Union[None, int, RandomState]) – Random seed used to initialize the pseudo-random number generator. Default is None. If an int is provided, this sets the seed for an object of numpy.random.RandomState. Otherwise, the object itself can be passed directly.

run(n_samples)[source]

Execute the random sampling in the SpectralRepresentation class.

The run() method is the function that performs random sampling in the SpectralRepresentation class. If n_samples is provided when the SpectralRepresentation object is defined, the run() method is automatically called. The user may also call the run() method directly to generate samples. The run() method of the SpectralRepresentation class can be invoked many times and each time the generated samples are appended to the existing samples.

Parameters:

n_samples (int) – Number of samples of the stochastic process to be simulated. If the run() method is invoked multiple times, the newly generated samples will be appended to the existing samples.

The run() method has no returns, although it creates and/or appends the samples attribute of the SpectralRepresentation class.

Attributes

SpectralRepresentation.samples: ndarray

Generated samples. The shape of the samples is (n_samples, n_variables, n_time_intervals[0], ..., n_time_intervals[n_dimensions-1])

SpectralRepresentation.n_dimensions: int

The dimensionality of the stochastic process.

SpectralRepresentation.phi: ndarray

The random phase angles used in the simulation of the stochastic process. The shape of the phase angles (n_samples, n_variables, n_frequency_intervals[0], ..., n_frequency_intervals[n_dimensions-1])

SpectralRepresentation.n_variables: int

Number of variables in the stochastic process.

Examples