File: t_SpectralGaussianProcess_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 (51 lines) | stat: -rwxr-xr-x 1,594 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
#! /usr/bin/env python

import openturns as ot

ot.TESTPREAMBLE()

# Default dimension parameter to evaluate the model
defaultDimension = 1

# Amplitude values
amplitude = ot.Point(defaultDimension, 1.0)
# Scale values
scale = ot.Point(defaultDimension, 1.0)

# Spectral density
myModel = ot.CauchyModel(scale, amplitude)

points = 8
tMin = 0.0
tStep = 1.0 / (points - 1)

# RegularGrid --> Build list of frequencies using the RegularGrid
myTimeGrid = ot.RegularGrid(tMin, tStep, points)

mySpectralProcess0 = ot.SpectralGaussianProcess(myModel, myTimeGrid)

print("mySpectralProcess0 = ", mySpectralProcess0)
print("Realization = ", mySpectralProcess0.getRealization())

# Constructor using maximalFrequency value and size of discretization
maximalFrequency = 10.0
mySpectralProcess1 = ot.SpectralGaussianProcess(myModel, maximalFrequency, points)
tg = ot.RegularGrid(mySpectralProcess1.getTimeGrid())

print("mySpectralProcess1 = ", mySpectralProcess1)
print("Realization = ", mySpectralProcess1.getRealization())

# 3D model
highDimension = 3
amplitude = ot.Point(highDimension, 1.0)

# Second order model with parameters
mySpecModel = ot.CauchyModel(scale, amplitude)
print("mySpecModel = ", mySpecModel)

mySpectralProcess2 = ot.SpectralGaussianProcess(mySpecModel, myTimeGrid)
print("mySpectralProcess2 = ", mySpectralProcess2)
print("Realization = ", mySpectralProcess2.getRealization())
mySpectralProcess3 = ot.SpectralGaussianProcess(mySpecModel, maximalFrequency, points)
print("mySpectralProcess3 = ", mySpectralProcess3)
print("Realization = ", mySpectralProcess3.getRealization())