# UserDefinedSpectralModel¶

class UserDefinedSpectralModel(*args)

Spectral model defined by the User.

Parameters
frequencyRegularGrid

The frequency grid with step on which the model is built.

densityCollectionFunctionHermitianMatrixCollection

Collection of hermitian matrices which are the images of each point of the frequency grid through the density spectral function.

Notes

We consider a multivariate process of dimension where . We only treat here the case where the domain is of dimension 1: ().

We denote the time stamps of the time grid.

is supposed to be a stationary second order process and we suppose that its spectral density function defined by:

(1)

exists, where is the set of d-dimensional positive definite hermitian matrices.

We get a piecewise constant function on , where the intervals on which the density spectral function is constant are centered on the points of the frequency grid, of length .

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 , OpenTURNS returns an exception. Otherwise, it returns the hermitian matrix of the subinterval of 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)


Create the spectral model:

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


Methods

 __call__(self, frequency) Evaluate the spectral density function for a specific frequency. computeStandardRepresentative(self, frequency) Compute the standard representant of the spectral density function. draw(self, \*args) Draw a specific component of the spectral density function. getAmplitude(self) Get the amplitude parameter of the spectral density function. getClassName(self) Accessor to the object’s name. Return the frequency grid associated to the model. getId(self) Accessor to the object’s id. Get the input dimension of the spectral density function. getName(self) Accessor to the object’s name. Get the spatial correlation matrix of the spectral density function. Get the dimension of the SpectralModel. getScale(self) Get the scale parameter of the spectral density function. 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. setAmplitude(self, amplitude) Set the amplitude parameter of the spectral density function. setFrequencyGrid(self, frequencyGrid) Set the frequency grid associated to the model. setName(self, name) Accessor to the object’s name. setScale(self, scale) Set the scale parameter of the spectral density function. setShadowedId(self, id) Accessor to the object’s shadowed id. setVisibility(self, visible) Accessor to the object’s visibility state.
__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

computeStandardRepresentative(self, frequency)

Compute the standard representant of the spectral density function.

Parameters
taufloat

Frequency value.

Returns
rhoComplex

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,

where is a covariance matrix that explains the covariance structure and

draw(self, \*args)

Draw a specific component of the spectral density function.

Parameters
rowIndexint,

The row index of the component to draw. Default value is 0.

columnIndex: int, :math:0 leq columnIndex < dimension

The column index of the component to draw. Default value is 0.

minimumFrequencyfloat

The lower bound of the frequency range over which the model is plotted. Default value is SpectralModel-DefaultMinimumFrequency in ResourceMap.

maximumFrequencyfloat

The upper bound of the frequency range over which the model is plotted. Default value is SpectralModel-DefaultMaximumFrequency in ResourceMap.

frequencyNumberint,

The discretization of the frequency range over which the model is plotted. Default value is SpectralModel-DefaultFrequencyNumber in class:~openturns.ResourceMap.

modulebool

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

Returns
graphGraph

Graphic of the specified component

getAmplitude(self)

Get the amplitude parameter of the spectral density function.

Returns
amplitudePoint

The used amplitude parameter.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

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

getFrequencyGrid(self)

Return the frequency grid associated to the model.

Returns
gridRegularGrid

The frequency grid of the model.

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getInputDimension(self)

Get the input dimension of the spectral density function.

Returns
inputDimensionint

SpatialDimension of the SpectralModel.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOutputCorrelation(self)

Get the spatial correlation matrix of the spectral density function.

Returns
spatialCorrelationCorrelationMatrix

Correlation matrix .

getOutputDimension(self)

Get the dimension of the SpectralModel.

Returns
dimensionint

Dimension of the SpectralModel.

getScale(self)

Get the scale parameter of the spectral density function.

Returns
scalePoint

The used scale parameter.

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.

setAmplitude(self, amplitude)

Set the amplitude parameter of the spectral density function.

Parameters
amplitudePoint

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

setFrequencyGrid(self, frequencyGrid)

Set the frequency grid associated to the model.

Parameters
gridRegularGrid

The frequency grid of the model.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setScale(self, scale)

Set the scale parameter of the spectral density function.

Parameters
scalePoint

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

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.