File: t_Encoding_std.py

package info (click to toggle)
persalys 13.1.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 71,916 kB
  • sloc: xml: 496,859; cpp: 53,848; python: 3,435; sh: 332; makefile: 131; ansic: 14
file content (43 lines) | stat: -rw-r--r-- 957 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
#! /usr/bin/env python

import openturns as ot
import openturns.testing
import persalys
import os

myStudy = persalys.Study("myStudy")

# data
filename = "données.csv"
ot.RandomGenerator.SetSeed(0)
ot.Normal(3).getSample(10).exportToCSVFile(filename)
inColumns = [0, 2]

# Model 1
model = persalys.DataModel("myDataModel", filename, inColumns)
myStudy.add(model)
print(model)

# Model 2
model2 = persalys.SymbolicPhysicalModel(
    "SM", [persalys.Input("A"), persalys.Input("B")], [persalys.Output("S")], ["A+B+2"]
)
myStudy.add(model2)
importedDOE = persalys.ImportedDesignOfExperiment("doeI", model2, filename, inColumns)
myStudy.add(importedDOE)

# script
script = myStudy.getPythonScript()
print(script)

# save
xmlFileName = "file_with_données.xml"
myStudy.save(xmlFileName)

# open
s = persalys.Study.Open("file_with_données.xml")
print(s.getPythonScript())

os.remove(filename)
os.remove(xmlFileName)
os.remove(xmlFileName.split(".")[0] + ".h5")