Create an event based on a processΒΆ

This example gives elements to create an event based on a multivariate stochastic process. Let X: \Omega \times \mathcal{D} \rightarrow \mathbb{R}^d be a stochastic process of dimension d, where \mathcal{D} \in \mathbb{R}^n is discretized on the mesh \mathcal{M}. We suppose that \mathcal{M} contains N vertices.

We define the event \mathcal{E} as:

\begin{aligned}
  \displaystyle \mathcal{E}(X) = \bigcup_{\underline{t}\in \mathcal{M}}\left\{X_{\underline{t}} \in \mathcal{A} \right\}
\end{aligned}

where \mathcal{A} is a domain of \mathbb{R}^d.

A particular domain \mathcal{A} is the cartesian product of type:

\begin{aligned}
  \mathcal{A} = \prod_{i=1}^d [a_i,b_i]
\end{aligned}

In that case, the library defines \mathcal{A} by its both extreme points : \underline{a} and \underline{b}.

In the general case, \mathcal{A} is a Domain object that is able to check if it contains a given point in \mathbb{R}^d.

The library creates an Event object from the process X and the domain \mathcal{A}. Then, it is possible to get a realization of the event \mathcal{E}, which is scalar 1_{\mathcal{E}(X)}(\underline{x}_0, \dots, \underline{x}_{N-1}) if (\underline{x}_0, \dots,\underline{x}_{N-1}) is a realization of X on \mathcal{M}.

import openturns as ot

ot.Log.Show(ot.Log.NONE)

Define a 2-d mesh

indices = [40, 20]
mesher = ot.IntervalMesher(indices)
lowerBound = [0.0, 0.0]
upperBound = [2.0, 1.0]
interval = ot.Interval(lowerBound, upperBound)
mesh = mesher.build(interval)

Create the covariance model

amplitude = [1.0, 2.0, 3.0]
scale = [4.0, 5.0]
spatialCorrelation = ot.CorrelationMatrix(3)
spatialCorrelation[0, 1] = 0.8
spatialCorrelation[0, 2] = 0.6
spatialCorrelation[1, 2] = 0.1
covmodel = ot.ExponentialModel(scale, amplitude, spatialCorrelation)

# Create a normal process
process = ot.GaussianProcess(covmodel, mesh)

Create a domain A in R^3: [0.8; 1.2]*[1.5; 1.6]*[0.5; 0.7]

lowerBound = [0.8, 1.5, 0.5]
upperBound = [1.2, 1.6, 0.7]
domain = ot.Interval(lowerBound, upperBound)

# Create the event
event = ot.ProcessEvent(process, domain)

Total running time of the script: ( 0 minutes 0.002 seconds)