Create a white noise processΒΆ

This example details how to create and manipulate a white noise. A second order white noise \varepsilon: \Omega \times \mathbb{D} \rightarrow \mathbb{R}^d is a stochastic process of dimension d such that the covariance function C(\underline{s},\underline{t})=\delta(\underline{t}-\underline{s})C(\underline{s},\underline{s}) where C(\underline{s},\underline{s}) is the covariance matrix of the process at vertex \underline{s} and \delta the Kroenecker function.

A process \varepsilon is a white noise if all finite family of locations (\underline{t}_i)_{i=1, \dots, n} \in \mathbb{D}, (\varepsilon_{\underline{t}_i})_{i=1, \dots, n} is independent and identically distributed.

The library proposes to model it through the object WhiteNoise defined on a mesh and a distribution with zero mean and finite standard deviation.

If the distribution has a mean different from zero, The library writes message to prevent the User and does not allow the creation of such a white noise.

[6]:
from __future__ import print_function
import openturns as ot
import math as m
[7]:
# Define the distribution
sigma = 1.0
dist = ot.Normal(0.0, sigma)
[8]:
# Define the mesh
tgrid = ot.RegularGrid(0.0, 1.0, 100)
[11]:
# Create the process
process = ot.WhiteNoise(dist, tgrid)
process
[11]:

WhiteNoise(Normal(mu = 0, sigma = 1))

[10]:
# Draw a realization
realization = process.getRealization()
graph = realization.drawMarginal(0)
graph.setTitle('Realization of a white noise with distribution N(0,1)')
graph
[10]:
../../_images/examples_probabilistic_modeling_white_noise_process_6_0.png
[26]:
# Draw a sample
sample = process.getSample(5)
graph = sample.drawMarginal(0)
graph.setTitle(str(sample.getSize()) + ' realizations of a white noise with distribution N(0,1)')
for k in range(sample.getSize()):
  drawable = graph.getDrawable(k)
  drawable.setLegend('realization ' + str(k+1))
  graph.setDrawable(drawable, k)
graph
[26]:
../../_images/examples_probabilistic_modeling_white_noise_process_7_0.png