WelchFactory

(Source code, png)

../../_images/WelchFactory.png
class WelchFactory(*args)

Welch estimator of the spectral model of a stationary process.

Refer to Estimation of a spectral density function.

Parameters:
windowFilteringWindows

The filtering window model.

By default, the filtering window model is the Hann model.

blockNumberint

Number of blocks.

By default, blockNumber=1.

overlapfloat, 0 \leq overlap \leq 0.5.

Overlap rate parameter of the segments of the time series.

By default, overlap=0.5.

Notes

Let X: \Omega \times \cD \rightarrow \Rset^d be a multivariate second order stationary process, with zero mean, where \cD \in \Rset^n. We only treat here the case where the domain is of dimension 1: \cD \in \Rset (n=1).

If we note C(\vect{s}, \vect{t})=\Expect{(X_{\vect{s}}-m(\vect{s}))\Tr{(X_{\vect{t}}-m(\vect{t}))}} its covariance function, then for all (i,j), C^{stat}_{i,j} : \Rset^n \rightarrow \Rset^n is \cL^1(\Rset^n) (ie \int_{\Rset^n} |C^{stat}_{i,j}(\vect{\tau})|\di{\vect{\tau}}\, < +\infty), with C^{stat}(\vect{\tau}) = C(\vect{s}, \vect{s}+\vect{\tau}) as this quantity does not depend on \vect{s}.

The bilateral spectral density function S : \Rset^n \rightarrow \mathcal{H}^+(d) exists and is defined as the Fourier transform of the covariance function C^{stat} :

\forall \vect{f} \in \Rset^n, \,S(\vect{f}) = \int_{\Rset^n}\exp\left\{  -2i\pi <\vect{f},\vect{\tau}> \right\} C^{stat}(\vect{\tau})\di{\vect{\tau}}

where \mathcal{H}^+(d) \in \mathcal{M}_d(\Cset) is the set of d-dimensional positive definite hermitian matrices.

The Welch estimator is a non parametric estimator based on the segmentation of the time series into blockNumber segments possibly overlapping (size of overlap overlap). The length of each segment is deduced.

Examples

Create a time series from a stationary second order process:

>>> import openturns as ot
>>> myTimeGrid = ot.RegularGrid(0.0, 0.1, 2**8)
>>> model = ot.CauchyModel([5.0], [3.0])
>>> gp = ot.SpectralGaussianProcess(model, myTimeGrid)
>>> myTimeSeries = gp.getRealization()

Estimate the spectral model with WelchFactory:

>>> mySegmentNumber = 10
>>> myOverlapSize = 0.3
>>> myFactory = ot.WelchFactory(ot.Hann(), mySegmentNumber, myOverlapSize)
>>> myEstimatedModel_TS = myFactory.build(myTimeSeries)

Change the filtering window:

>>> myFactory.setFilteringWindows(ot.Hamming())

Methods

build(*args)

Estimate the spetral model.

getBlockNumber()

Accessor to the block number.

getClassName()

Accessor to the object's name.

getFFTAlgorithm()

Accessor to the FFT algorithm used for the Fourier transform.

getFilteringWindows()

Accessor to the filtering window.

getId()

Accessor to the object's id.

getName()

Accessor to the object's name.

getOverlap()

Accessor to the overlap rate.

getShadowedId()

Accessor to the object's shadowed id.

getVisibility()

Accessor to the object's visibility state.

hasName()

Test if the object is named.

hasVisibleName()

Test if the object has a distinguishable name.

setBlockNumber(blockNumber)

Accessor to the block number.

setFFTAlgorithm(fft)

Accessor to the FFT algorithm used for the Fourier transform.

setFilteringWindows(window)

Accessor to the filtering window.

setName(name)

Accessor to the object's name.

setOverlap(overlap)

Accessor to the block number.

setShadowedId(id)

Accessor to the object's shadowed id.

setVisibility(visible)

Accessor to the object's visibility state.

buildAsUserDefinedSpectralModel

__init__(*args)
build(*args)

Estimate the spetral model.

Available usages:

build(myTimeSeries)

build(myProcessSample)

Parameters:
myTimeSeriesTimeSeries

One realization of the process.

myProcessSampleProcessSample

Several realizations of the process.

Returns:
mySpectralModelUserDefinedSpectralModel

The spectral model estimated with the Welch estimator.

getBlockNumber()

Accessor to the block number.

Returns:
blockNumberint

The number of blocks used in the Welch estimator.

By default, blockNumber = 1.

getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getFFTAlgorithm()

Accessor to the FFT algorithm used for the Fourier transform.

Returns:
fftAlgoFFT

The FFT algorithm used for the Fourier transform.

getFilteringWindows()

Accessor to the filtering window.

Returns:
filteringWindowFilteringWindows

The filtering window used.

By default, the Hann one.

getId()

Accessor to the object’s id.

Returns:
idint

Internal unique identifier.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getOverlap()

Accessor to the overlap rate.

Returns:
overlapfloat, 0 \leq overlap \leq 0.5.

The overlap rate of the time series.

By default, overlap = 0.5.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:
idint

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:
visiblebool

Visibility flag.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:
hasVisibleNamebool

True if the name is not empty and not the default one.

setBlockNumber(blockNumber)

Accessor to the block number.

Parameters:
blockNumberpositive int

The number of blocks used in the Welch estimator.

setFFTAlgorithm(fft)

Accessor to the FFT algorithm used for the Fourier transform.

Parameters:
fftAlgoFFT

The FFT algorithm used for the Fourier transform.

setFilteringWindows(window)

Accessor to the filtering window.

Parameters:
filteringWindowFilteringWindows

The filtering window used.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setOverlap(overlap)

Accessor to the block number.

Parameters:
blockNumberint, 0 \leq overlap \leq 0.5.

The overlap rate of the times series.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:
idint

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:
visiblebool

Visibility flag.

Examples using the class

Estimate a scalar ARMA process

Estimate a scalar ARMA process

Estimate a spectral density function

Estimate a spectral density function

Estimate a stationary covariance function

Estimate a stationary covariance function