UserDefinedSpectralModel

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

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

Spectral model defined by the User.

Parameters:

frequency : RegularGrid

The frequency grid (-f_c, \dots, f_c) with step \delta f on which the model is built.

densityCollectionFunction : HermitianMatrixCollection

Collection of hermitian matrices \in \mathbb{M}_d(\mathbb{C}) which are the images of each point of the frequency grid through the density spectral function.

Notes

We consider a multivariate process X: \Omega \times \cD \rightarrow \Rset^d of dimension d where \cD \in \Rset^n. We only treat here the case where the domain is of dimension 1: \cD \in \Rset (n=1).

We denote (\vect{t}_0, \dots, \vect{t}_{N-1}) the time stamps of the time grid.

X is supposed to be a stationary second order process and we suppose that its spectral density function S : \Rset \rightarrow \mathcal{H}^+(d) defined by:

(1)\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}}

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

We get a piecewise constant function on [-f_c,f_c], where the intervals on which the density spectral function is constant are centered on the points of the frequency grid, of length \delta f.

Then, it is possible to evaluate the spectral density function for a given frequency thanks to the method computeSpectralDensity: if the frequency is not inside the interval [-f_c,f_c], OpenTURNS returns an exception. Otherwise, it returns the hermitian matrix of the subinterval of [-f_c,f_c] that contains the given frequency.

Examples

Create the frequency grid:

>>> import openturns as ot
>>> from math import exp
>>> fmin = 0.1
>>> df = 0.5
>>> N = int((10.0 - fmin)/ df)
>>> myFrequencyGrid =  ot.RegularGrid(fmin, df, N)

Define the spectral function:

>>> def s(f):
...     if(f <= 5.0):
...         return 1.0
...     else:
...         x = f - 5.0
...         return exp(-2.0 * x * x)

Create the collection of HermitianMatrix:

>>> myCollection = ot.HermitianMatrixCollection()
>>> for k in range(N):
...     frequency = myFrequencyGrid.getValue(k)
...     matrix = ot.HermitianMatrix(1)
...     matrix[0, 0] = s(frequency)
...     myCollection.add(matrix)

Create the spectral model:

>>> mySpectralModel = ot.UserDefinedSpectralModel(myFrequencyGrid, myCollection)

Methods

__call__(frequency) Evaluate the spectral density function for a specific frequency.
computeStandardRepresentative(frequency) Compute the standard representant of the spectral density function.
draw([rowIndex, columnIndex, module]) Draw a specific component of the spectral density function.
getAmplitude() Get the amplitude parameter of the spectral density function.
getClassName() Accessor to the object’s name.
getDimension() Get the dimension of the SpectralModel.
getFrequencyGrid() Return the RegularGrid associated to the SpectralModel.
getId() Accessor to the object’s id.
getName() Accessor to the object’s name.
getScale() Get the scale parameter of the spectral density function.
getShadowedId() Accessor to the object’s shadowed id.
getSpatialCorrelation() Get the spatial correlation matrix of the spectral density function.
getSpatialDimension() Get the spatial dimension of the spectral density function.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
setAmplitude(amplitude) Set the amplitude parameter of the spectral density function.
setFrequencyGrid(frequencyGrid) Set the RegularGrid associated to the SpectralModel.
setName(name) Accessor to the object’s name.
setScale(scale) Set the scale parameter of the spectral density function.
setShadowedId(id) Accessor to the object’s shadowed id.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)
computeStandardRepresentative(frequency)

Compute the standard representant of the spectral density function.

Parameters:

tau : float

Frequency value.

Returns:

rho : Complex

Standard representant factor of the spectral density function.

Notes

According to definitions in CovarianceModel, as the spectral density function is the Fourier transform of the stationary covariance function and using the expression of the last one, the spectral density function writes as a matrix-complex product where the matrix is the constant spatial covariance structure and the complex represents the standard representative:

Thus,

\forall \vect{f} \in \Rset^n, \cS(\vect{f}) = \prod_{k=1}^{n} \vect{\theta}_k \mat{\Sigma} \rho(\vect{f} \odot \vect{\theta})

where \mat{\Sigma} is a covariance matrix that explains the covariance structure and (\vect{f} \odot \vect{\theta})_k = \vect{f}_k \vect{\theta}_k

draw(rowIndex=0, columnIndex=0, module=True)

Draw a specific component of the spectral density function.

Parameters:

rowIndex : int

i-th row component to draw. Default value is 0

columnIndex : int

j-th column component to draw . Default value is 0

module : bool

Tells if module has to be drawn(True) or if it is the argument to be drawn (False). Default value is True.

Returns:

graph : Graph

Graphic of the specified component

Notes

The method plots a specific component of the spectral density function over a frequency grid. Thus, this last one should be specified thanks to the setFrequencyGrid method.

getAmplitude()

Get the amplitude parameter of the spectral density function.

Returns:

amplitude : NumericalPoint

The used amplitude parameter.

getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getDimension()

Get the dimension of the SpectralModel.

Returns:

dimension : int

Dimension of the SpectralModel.

getFrequencyGrid()

Return the RegularGrid associated to the SpectralModel.

Returns:

grid : RegularGrid

Associated frequency grid of the SpectralModel.

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.

getScale()

Get the scale parameter of the spectral density function.

Returns:

scale : NumericalPoint

The used scale parameter.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getSpatialCorrelation()

Get the spatial correlation matrix of the spectral density function.

Returns:

spatialCorrelation : CorrelationMatrix

Correlation matrix \mat{R} \in \mathcal{M}_{dimension \times dimension}([-1, 1]).

getSpatialDimension()

Get the spatial dimension of the spectral density function.

Returns:

spatialDimension : int

SpatialDimension of the SpectralModel.

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.

setAmplitude(amplitude)

Set the amplitude parameter of the spectral density function.

Parameters:

amplitude : NumericalPoint

The amplitude parameter to be used in the spectral density function.

setFrequencyGrid(frequencyGrid)

Set the RegularGrid associated to the SpectralModel.

Parameters:

grid : RegularGrid

Associated frequency grid of the SpectralModel.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setScale(scale)

Set the scale parameter of the spectral density function.

Parameters:

scale : NumericalPoint

The scale parameter to be used in the spectral density function. It should be of size dimension.

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.