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

class
WelchFactory
(*args)¶ Welch estimator of the spectral model of a stationary process.
Refer to Estimation of a spectral density function.
 Parameters
 window
FilteringWindows
The filtering window model.
By default, the filtering window model is the Hanning model.
 blockNumberint
Number of blocks.
By default, blockNumber=1.
 overlapfloat, .
Overlap rate parameter of the segments of the time series.
By default, overlap=0.5.
 window
Notes
Let be a multivariate second order stationary process, with zero mean, where . We only treat here the case where the domain is of dimension 1: (n=1).
If we note its covariance function, then for all is (ie ), with as this quantity does not depend on .
The bilateral spectral density function exists and is defined as the Fourier transform of the covariance function :
where is the set of ddimensional 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.Hanning(), mySegmentNumber , myOverlapSize) >>> myEstimatedModel_TS = myFactory.build(myTimeSeries)
Change the filtering window:
>>> myFactory.setFilteringWindows(ot.Hamming())
Methods
build
(self, \*args)Estimate the spetral model.
getBlockNumber
(self)Accessor to the block number.
getClassName
(self)Accessor to the object’s name.
getFFTAlgorithm
(self)Accessor to the FFT algorithm used for the Fourier transform.
getFilteringWindows
(self)Accessor to the filtering window.
getId
(self)Accessor to the object’s id.
getName
(self)Accessor to the object’s name.
getOverlap
(self)Accessor to the overlap rate.
getShadowedId
(self)Accessor to the object’s shadowed id.
getVisibility
(self)Accessor to the object’s visibility state.
hasName
(self)Test if the object is named.
hasVisibleName
(self)Test if the object has a distinguishable name.
setBlockNumber
(self, blockNumber)Accessor to the block number.
setFFTAlgorithm
(self, fft)Accessor to the FFT algorithm used for the Fourier transform.
setFilteringWindows
(self, window)Accessor to the filtering window.
setName
(self, name)Accessor to the object’s name.
setOverlap
(self, overlap)Accessor to the block number.
setShadowedId
(self, id)Accessor to the object’s shadowed id.
setVisibility
(self, visible)Accessor to the object’s visibility state.
buildAsUserDefinedSpectralModel

__init__
(self, *args)¶ Initialize self. See help(type(self)) for accurate signature.

build
(self, *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.
 myTimeSeries
 Returns
 mySpectralModel
UserDefinedSpectralModel
The spectral model estimated with the Welch estimator.
 mySpectralModel

getBlockNumber
(self)¶ Accessor to the block number.
 Returns
 blockNumberint
The number of blocks used in the Welch estimator.
By default, blockNumber = 1.

getClassName
(self)¶ Accessor to the object’s name.
 Returns
 class_namestr
The object class name (object.__class__.__name__).

getFFTAlgorithm
(self)¶ Accessor to the FFT algorithm used for the Fourier transform.
 Returns
 fftAlgo
FFT
The FFT algorithm used for the Fourier transform.
 fftAlgo

getFilteringWindows
(self)¶ Accessor to the filtering window.
 Returns
 filteringWindow
FilteringWindows
The filtering window used.
By default, the
Hanning
one.
 filteringWindow

getId
(self)¶ Accessor to the object’s id.
 Returns
 idint
Internal unique identifier.

getName
(self)¶ Accessor to the object’s name.
 Returns
 namestr
The name of the object.

getOverlap
(self)¶ Accessor to the overlap rate.
 Returns
 overlapfloat, .
The overlap rate of the time series.
By default, overlap = 0.5.

getShadowedId
(self)¶ Accessor to the object’s shadowed id.
 Returns
 idint
Internal unique identifier.

getVisibility
(self)¶ Accessor to the object’s visibility state.
 Returns
 visiblebool
Visibility flag.

hasName
(self)¶ Test if the object is named.
 Returns
 hasNamebool
True if the name is not empty.

hasVisibleName
(self)¶ Test if the object has a distinguishable name.
 Returns
 hasVisibleNamebool
True if the name is not empty and not the default one.

setBlockNumber
(self, blockNumber)¶ Accessor to the block number.
 Parameters
 blockNumberpositive int
The number of blocks used in the Welch estimator.

setFFTAlgorithm
(self, fft)¶ Accessor to the FFT algorithm used for the Fourier transform.
 Parameters
 fftAlgo
FFT
The FFT algorithm used for the Fourier transform.
 fftAlgo

setFilteringWindows
(self, window)¶ Accessor to the filtering window.
 Parameters
 filteringWindow
FilteringWindows
The filtering window used.
 filteringWindow

setName
(self, name)¶ Accessor to the object’s name.
 Parameters
 namestr
The name of the object.

setOverlap
(self, overlap)¶ Accessor to the block number.
 Parameters
 blockNumberint, .
The overlap rate of the times series.

setShadowedId
(self, id)¶ Accessor to the object’s shadowed id.
 Parameters
 idint
Internal unique identifier.

setVisibility
(self, visible)¶ Accessor to the object’s visibility state.
 Parameters
 visiblebool
Visibility flag.