File: t_KarhunenLoeveResult_std.py

package info (click to toggle)
openturns 1.24-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,204 kB
  • sloc: cpp: 256,662; python: 63,381; ansic: 4,414; javascript: 406; sh: 180; xml: 164; yacc: 123; makefile: 98; lex: 55
file content (30 lines) | stat: -rwxr-xr-x 959 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
import openturns as ot

ot.TESTPREAMBLE()

# Create the KL result
numberOfVertices = 20
interval = ot.Interval(-1.0, 1.0)
mesh = ot.IntervalMesher([numberOfVertices - 1]).build(interval)
covariance = ot.SquaredExponential()
process = ot.GaussianProcess(covariance, mesh)
sampleSize = 100
processSample = process.getSample(sampleSize)
threshold = 1.0e-7
algo = ot.KarhunenLoeveSVDAlgorithm(processSample, threshold)
algo.run()
klresult = algo.getResult()
print("ev=", klresult.getEigenvalues())
graph1 = klresult.drawEigenvalues()
graph2 = klresult.drawEigenvalues()
graph2.setLogScale(ot.GraphImplementation.LOGY)
graph3 = klresult.drawCumulatedEigenvaluesRemainder()
graph4 = klresult.drawCumulatedEigenvaluesRemainder()
graph4.setLogScale(ot.GraphImplementation.LOGY)
if 0:
    from openturns.viewer import View

    View(graph1).save("eigen1.png")
    View(graph2).save("eigen2.png")
    View(graph3).save("eigen3.png")
    View(graph4).save("eigen4.png")