File: t_ExponentiallyDampedCosineModel_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 (52 lines) | stat: -rwxr-xr-x 1,253 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
49
50
51
52
#! /usr/bin/env python

import openturns as ot

ot.TESTPREAMBLE()

# Default dimension parameter to evaluate the model
defaultDimension = 1
inputDimension = 1

# Amplitude values
amplitude = [1.0]

# Scale values
scale = [1.0]

# Frequency values
for frequency in [0.1, 0.2]:
    # Default constructor
    myDefaultModel = ot.ExponentiallyDampedCosineModel()
    print("myDefaultModel = ", myDefaultModel)

    # Second order model with parameters
    myModel = ot.ExponentiallyDampedCosineModel(scale, amplitude, frequency)
    print("myModel = ", myModel)

    timeValueOne = 1.0
    print("covariance matrix at t = ", timeValueOne, " : ", myModel(timeValueOne))
    print(
        "covariance matrix at t = ",
        -1.0 * timeValueOne,
        " : ",
        myModel(-1.0 * timeValueOne),
    )

    # Evaluation at time higher to check the decrease of the
    # exponentiallyDampedCosine values
    timeValueHigh = 15.0
    print(
        "covariance matrix at t = ",
        timeValueHigh,
        " : ",
        myModel(timeValueHigh).__str__(),
    )

    timeGrid = ot.RegularGrid(0.0, 1.0 / 3.0, 4)
    print(
        "discretized covariance over the time grid=",
        timeGrid,
        "is=",
        myModel.discretize(timeGrid),
    )