“”"
#!/usr/bin/env python
coding: utf-8
from future import print_function
import os, sys
import numpy as np
import openturns as ot
import otmorris
import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)
csv_separator = ‘;’
print(sys.version)
inputs_tokens = [‘P1’, ‘P2’, ‘P3’, ‘P4’, ‘P5’, ‘P6’, ‘P7’, ‘P9’, ‘P10’, ‘P11’, ‘P13’, ‘P14’, ‘P15’, ‘P16’, ‘P17’, ‘P18’, ‘P20’, ‘P21’, ‘P22’, ‘P25’, ‘P26’, ‘P27’, ‘P28’, ‘P29’, ‘P30’, ‘P31’, ‘P32’, ‘P33’, ‘P34’, ‘P35’, ‘P36’, ‘P37’, ‘P38’, ‘P39’, ‘P41’, ‘P42’, ‘P44’, ‘P45’, ‘P47’, ‘P48’, ‘P49’, ‘P50’, ‘P61’, ‘P65’]
outputs = [‘P51’, ‘P52’, ‘P53’, ‘P54’, ‘P55’, ‘P56’, ‘P57’, ‘P58’, ‘P59’, ‘P69’, ‘P70’]
formulas = [‘P1+P2+P3’, ‘P4+P5+P6+P7+P9+P10’, ‘P11+P13+P14+P15+P16+P17’, ‘P18+P20+P21+P22’, ‘P25+P26+P27+P28+P29+P30+P31+P32+P33’, ‘P34+P35+P36+P37’, ‘P38+P39+P41’, ‘P42+P44+P45+P47’, ‘P47+P48+P49+P50’, ‘P61’, ‘P65’]
inputs_interval = ot.Interval([0.33, 7.3, 2.25, 2.1, 6.68, 0, -20.0, 0, 1.29, 2.775, 0.46, 57.5, 0.95, 0.92, 0, -18, 0, 2.8, 0.1346, 3.895, 4.575, 5.165, 0.495, 0.9, 0.49, 7.1, 2.325, 0.03, 0.03, 0.03, 0.03, 0.03, 0.765, 0.81, 0, 0, -10.0, 0.5695, 3.63, 10.45, 32.283, 1.5, 72, 8650],
[0.35, 7.32, 2.26, 2.11, 6.88, 0.02, 20.0, 1, 1.3, 2.8, 0.48, 62.5, 1.05, 1.01, 0.03, -18, 1, 2.85, 0.1646, 3.905, 4.625, 5.265, 0.505, 1.04, 0.53, 7.3, 2.35, 0.06, 0.06, 0.06, 0.06, 0.06, 0.78, 0.825, 0.03, 1, 10.0, 0.57, 3.65, 10.5, 34.283, 1.54, 92, 8800])
inputs_levels = [ 3,3,3,3,5,3,4,4,3,3,3,3,3,4,4,4,4,5,3,3,3,3,3,5,5,5,5,4,4,4,4,4,4,4,4,4,4,3,3,5,3,5,5,4 ]
Number of trajectories
r = 10
Define a k-grid level (so delta = 1/(k-1))
k = 4
dim = len(inputs_tokens)
premier plan experiences, avec le meme level pour chaque parametre d’entree
experiment1 = otmorris.MorrisExperimentGrid([k] * dim, inputs_interval, r)
morris_sample1 = experiment1.generate()
print(“experiment for morris = \n”, morris_sample1)
Save sample into files
dirname = r"D:\Users\Public\MES_OUTILS\TESTS_OpenTurns_Persalys"
input_csv_filename = os.path.join(dirname, “morris_sample1.csv”)
morris_sample1.setDescription(inputs_tokens)
morris_sample1.exportToCSVFile(input_csv_filename, csv_separator)
second plan experiences, avec le level adapte a chaque parametre d’entree
print("\n len = ", dim, len(inputs_levels))
experiment2 = otmorris.MorrisExperimentGrid(inputs_levels, inputs_interval, r)
morris_sample2 = experiment2.generate()
print(“experiment for morris = \n”, morris_sample2)
Save sample into files morris_sample2
dirname = r"D:\Users\Public\MES_OUTILS\TESTS_OpenTurns_Persalys"
input_csv_filename = os.path.join(dirname, “morris_sample2.csv”)
morris_sample2.setDescription(inputs_tokens)
morris_sample2.exportToCSVFile(input_csv_filename, csv_separator)
“”"