Skip to content

Commit 205760a

Browse files
committed
Fix examples
1 parent d709a57 commit 205760a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

python/doc/examples/plot_morris_grid.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
import openturns.viewer as otv
1313
import otmorris
1414

15+
# %%
1516
# use the reference 20-d function from the Morris paper
1617
f = ot.Function(otmorris.MorrisFunction())
1718
dim = f.getInputDimension()
1819

20+
# %%
1921
# Number of trajectories
2022
r = 10
2123

24+
# %%
2225
# Define experiments in [0,1]^20
2326
# p-levels
2427
p = 5
@@ -27,13 +30,16 @@
2730
X = morris_experiment.generate()
2831
Y = f(X)
2932

33+
# %%
3034
# Evaluate Elementary effects (ee)
3135
morris = otmorris.Morris(X, Y, bounds)
3236

37+
# %%
3338
# Compute mu/sigma
3439
mean = morris.getMeanAbsoluteElementaryEffects()
3540
sigma = morris.getStandardDeviationElementaryEffects()
3641
graph = morris.drawElementaryEffects(0)
3742
view = otv.View(graph)
3843

44+
# %%
3945
otv.View.ShowAll()

python/doc/examples/plot_morris_lhs.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@
44
"""
55

66
# %%
7-
# To define the trajectories, we first get an LHS design in the box :math:`[0,1]^{20}` of :math:`size=50`
7+
# To define the trajectories, we first get an LHS design in the box :math:`[0,1]^{20}` of size :math:`50`
88
# We set the number of trajectories input variables are randomly to 10.
99

1010
# %%
1111
import openturns as ot
1212
import otmorris
1313
import openturns.viewer as otv
1414

15+
# %%
1516
# use the reference 20-d function from the Morris paper
1617
f = ot.Function(otmorris.MorrisFunction())
1718
dim = f.getInputDimension()
1819

20+
# %%
1921
# Number of trajectories
2022
r = 10
2123

24+
# %%
2225
# Define an LHS experiment of size 50 in [0, 1]^20
2326
size = 50
2427
dist = ot.ComposedDistribution([ot.Uniform(0, 1)] * dim)
@@ -29,14 +32,17 @@
2932
X = morris_experiment.generate()
3033
Y = f(X)
3134

35+
# %%
3236
# Evaluate Elementary effects (ee)
3337
morris = otmorris.Morris(X, Y, bounds)
3438

39+
# %%
3540
# Compute mu/sigma
3641
mean = morris.getMeanAbsoluteElementaryEffects()
3742
sigma = morris.getStandardDeviationElementaryEffects()
3843
graph = morris.drawElementaryEffects(0)
3944
graph.setTitle("Elementary Effects using LHS")
4045
view = otv.View(graph)
4146

47+
# %%
4248
otv.View.ShowAll()

0 commit comments

Comments
 (0)