Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Nov 4, 2024
1 parent d709a57 commit 514eb39
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions python/doc/examples/plot_morris_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
import openturns.viewer as otv
import otmorris

# %%
# use the reference 20-d function from the Morris paper
f = ot.Function(otmorris.MorrisFunction())
dim = f.getInputDimension()

# %%
# Number of trajectories
r = 10

# %%
# Define experiments in [0,1]^20
# p-levels
p = 5
Expand All @@ -27,13 +30,16 @@
X = morris_experiment.generate()
Y = f(X)

# %%
# Evaluate Elementary effects (ee)
morris = otmorris.Morris(X, Y, bounds)

# %%
# Compute mu/sigma
mean = morris.getMeanAbsoluteElementaryEffects()
sigma = morris.getStandardDeviationElementaryEffects()
graph = morris.drawElementaryEffects(0)
view = otv.View(graph)

# %%
otv.View.ShowAll()
8 changes: 7 additions & 1 deletion python/doc/examples/plot_morris_lhs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@
"""

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

# %%
import openturns as ot
import otmorris
import openturns.viewer as otv

# %%
# use the reference 20-d function from the Morris paper
f = ot.Function(otmorris.MorrisFunction())
dim = f.getInputDimension()

# %%
# Number of trajectories
r = 10

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

# %%
# Evaluate Elementary effects (ee)
morris = otmorris.Morris(X, Y, bounds)

# %%
# Compute mu/sigma
mean = morris.getMeanAbsoluteElementaryEffects()
sigma = morris.getStandardDeviationElementaryEffects()
graph = morris.drawElementaryEffects(0)
graph.setTitle("Elementary Effects using LHS")
view = otv.View(graph)

# %%
otv.View.ShowAll()

0 comments on commit 514eb39

Please sign in to comment.