File: t_NonStationaryCovarianceModelFactory_std.py

package info (click to toggle)
openturns 1.26-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 67,708 kB
  • sloc: cpp: 261,605; python: 67,030; ansic: 4,378; javascript: 406; sh: 185; xml: 164; makefile: 101
file content (48 lines) | stat: -rwxr-xr-x 1,191 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /usr/bin/env python

import openturns as ot

ot.TESTPREAMBLE()

# Dimension of the input model
# Size of the TimeGrid
# dimension parameter
dimension = 1

# Amplitude values
amplitude = ot.Point(dimension, 1.00)

# Scale values
scale = ot.Point(dimension, 1.0)

size = 10
timeGrid = ot.RegularGrid(0.0, 0.1, size)

# Absolute model
model = ot.AbsoluteExponential(scale, amplitude)
myProcess = ot.GaussianProcess(model, timeGrid)

# Create a Process sample of size N
N = 10000
sample = myProcess.getSample(N)

# NonStationaryCovarianceModelFactory using default parameter - Factory
# initiate
myFactory = ot.NonStationaryCovarianceModelFactory()

# Build a UserDefinedCovarianceModel using the Welch method
myCovarianceModel = myFactory.buildAsUserDefinedCovarianceModel(sample)

for i in range(size):
    t = timeGrid.getValue(i)
    for j in range(size):
        s = timeGrid.getValue(j)
        estimatedValue = myCovarianceModel(t, s)[0, 0]
        modelValue = model(t, s)[0, 0]
        print(
            "Covariance C( %.6g" % t,
            ",  %.6g" % s,
            ") : ",
            " evaluation =  %.6g" % estimatedValue,
            " model =  %.6g" % modelValue,
        )