WelchFactory

(Source code, png, hires.png, pdf)

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

Welch estimator of the spectral model of a stationary process.

Parameters:

window : FilteringWindows

The filtering window model.

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

blockNumber : int

Number of blocks.

By default, blockNumber=1.

overlap : float, 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.ExponentialCauchy([5.0], [3.0])
>>> myNormalProcess = ot.SpectralGaussianProcess(model, myTimeGrid)
>>> myTimeSeries = myNormalProcess.getRealization()

Estimate the spectral model with WelchFactory:

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

Change the filtering window:

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

Methods

build(*args) Estimate the spetral model.
buildAsUserDefinedSpectralModel(*args)
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.
__init__(*args)
build(*args)

Estimate the spetral model.

Available usages:

build(myTimeSeries)

build(myProcessSample)

Parameters:

myTimeSeries : TimeSeries

One realization of the process.

myProcessSample : ProcessSample

Several realizations of the process.

Returns:

mySpectralModel : UserDefinedSpectralModel

The spectral model estimated with the Welch estimator.

getBlockNumber()

Accessor to the block number.

Returns:

blockNumber : int

The number of blocks used in the Welch estimator.

By default, blockNumber = 1.

getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getFFTAlgorithm()

Accessor to the FFT algorithm used for the Fourier transform.

Returns:

fftAlgo : FFT

The FFT algorithm used for the Fourier transform.

getFilteringWindows()

Accessor to the filtering window.

Returns:

filteringWindow : FilteringWindows

The filtering window used.

By default, the Hanning one.

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getOverlap()

Accessor to the overlap rate.

Returns:

overlap : float, 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:

id : int

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:

visible : bool

Visibility flag.

hasName()

Test if the object is named.

Returns:

hasName : bool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

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

setBlockNumber(blockNumber)

Accessor to the block number.

Parameters:

blockNumber : positive int

The number of blocks used in the Welch estimator.

setFFTAlgorithm(fft)

Accessor to the FFT algorithm used for the Fourier transform.

Parameters:

fftAlgo : FFT

The FFT algorithm used for the Fourier transform.

setFilteringWindows(window)

Accessor to the filtering window.

Parameters:

filteringWindow : FilteringWindows

The filtering window used.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setOverlap(overlap)

Accessor to the block number.

Parameters:

blockNumber : int, 0 \leq overlap \leq 0.5.

The overlap rate of the times series.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.