1%feature("docstring") OT::ConditionedGaussianProcess
2"Conditioned Gaussian process.
3
4    ConditionedGaussianProcess(*krigingResult, mesh*)
5
6
7Parameters
8----------
9krigingResult : :class:`~openturns.KrigingResult`
10    Structure that contains all elements of kriging computations.
11mesh : :class:`~openturns.Mesh`
12    Mesh :math:`\cM` over which the domain :math:`\cD` is discretized.
13
14Notes
15-----
16ConditionedGaussianProcess helps to create Gaussian random fields,
17:math:`X: \Omega \times\cD \mapsto \Rset^d` where :math:`\cD \in \Rset^n`, with covariance function :math:`\cC: \cD \times \cD \mapsto \cM_{d \times d}(\Rset)` ( :math:`\cC^{stat}: \cD \mapsto \cM_{d \times d}(\Rset)` in the stationary case), conditionaly to some observations.
18
19      Let :math:`X(\omega,x=x_1)=y_1,\cdots,X(\omega,x=x_n)=y_n` be the observations of the Gaussian process. We assume the same Gaussian prior as in the :class:`~openturns.KrigingAlgorithm`:
20
21.. math::
22
23    Y(\vect{x}) = \Tr{\vect{f}(\vect{x})} \vect{\beta} + Z(\vect{x})
24
25with :math:`\Tr{\vect{f}(\vect{x})} \vect{\beta}` a general linear model, :math:`Z(\vect{x})` a zero-mean Gaussian process with a stationary autocorrelation function :math:`\cC^{stat}`:
26
27.. math::
28
29    \mathbb{E}[Z(\vect{x}), Z(\vect{\tilde{x}})] = \sigma^2 \cC^{stat}_{\theta}(\vect{x} - \vect{\tilde{x}})
30
31The ConditionedGaussianProcess generates realizations of the conditioned process. It focuses first on the :class:`~openturns.KrigingAlgorithm` to build such prior. Results are stored in a :class:`~openturns.KrigingResult` structure, which is given as input argument of the class. This last one, combined with the mesh argument, define both the prior  :math:`Y(\cM)` and the covariance evaluation on the mesh vertices :math:`\cC^{stat}_{\theta}(\cM)` conditionnaly to the previous observations. It follows that the realizations are randomly generated from the Gaussian distribution :math:`\cN ( Y(\cM), \cC^{stat}_{\theta}(\cM) )`.
32
33In practice, we do not store the Gaussian distribution as we need only the random realization method. For that purpose, we use the Cholesky method : we compute the Cholesky factor :math:`\cL_{\theta}(\cM)` of the covariance matrix :math:`\cC^{stat}_{\theta}(\cM)` such as :math:`\cC^{stat}_{\theta}(\cM) = \cL_{\theta}(\cM) \Tr{\cL_{\theta}(\cM)}`.
34It follows that the random realizations are obtained as following : :math:`realization = Y(\cM) + \cL_{\theta}(\cM) W` with :math:`W` a centered & reduced random Gaussian realization.
35
36Examples
37--------
38>>> import openturns as ot
39>>> ot.RandomGenerator.SetSeed(0)
40>>> # Kriging use case
41>>> # Learning data
42>>> levels = [8.0, 5.0]
43>>> box = ot.Box(levels)
44>>> inputSample = box.generate()
45>>> # Scale each direction
46>>> inputSample *= 10
47>>> # Define model
48>>> model = ot.SymbolicFunction(['x', 'y'], ['cos(0.5*x) + sin(y)'])
49>>> outputSample = model(inputSample)
50>>> # Definition of exponential model
51>>> inputDimension = 2
52>>> covarianceModel = ot.SquaredExponential([1.988, 0.924], [3.153])
53>>> # Basis definition
54>>> basis = ot.ConstantBasisFactory(inputDimension).build()
55>>> # Kriring algorithm
56>>> algo = ot.KrigingAlgorithm(inputSample, outputSample, covarianceModel, basis)
57>>> algo.run()
58>>> result = algo.getResult()
59>>> vertices = [[1.0, 0.0], [2.0, 0.0], [2.0, 1.0], [1.0, 1.0], [1.5, 0.5]]
60>>> simplices = [[0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4]]
61>>> mesh2D = ot.Mesh(vertices, simplices)
62>>> process = ot.ConditionedGaussianProcess(result, mesh2D)"
63// ---------------------------------------------------------------------
64
65%feature("docstring") OT::ConditionedGaussianProcess::getRealization
66"Return a realization of the process.
67
68Returns
69-------
70realization : :class:`~openturns.Field`
71    A realization of the process.
72
73Examples
74--------
75>>> import openturns as ot
76>>> ot.RandomGenerator.SetSeed(0)
77>>> # Kriging use case
78>>> # Learning data
79>>> levels = [8.0, 5.0]
80>>> box = ot.Box(levels)
81>>> inputSample = box.generate()
82>>> # Scale each direction
83>>> inputSample *= 10
84>>> # Define model
85>>> model = ot.SymbolicFunction(['x', 'y'], ['cos(0.5*x) + sin(y)'])
86>>> outputSample = model(inputSample)
87>>> # Definition of exponential model
88>>> inputDimension = 2
89>>> covarianceModel = ot.SquaredExponential(inputDimension *[0.95])
90>>> # Basis definition
91>>> basis = ot.ConstantBasisFactory(inputDimension).build()
92>>> # Kriring algorithm
93>>> algo = ot.KrigingAlgorithm(inputSample, outputSample, covarianceModel, basis)
94>>> algo.run()
95>>> result = algo.getResult()
96>>> vertices = [[1.0, 0.0], [2.0, 0.0], [2.0, 1.0],[1.0, 1.0], [1.5, 0.5]]
97>>> simplices = [[0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4]]
98>>> mesh2D = ot.Mesh(vertices, simplices)
99>>> process = ot.ConditionedGaussianProcess(result, mesh2D)
100>>> # Get a realization of the process
101>>> realization = process.getRealization()
102"
103
104
105