.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_reliability_sensitivity/design_of_experiments/plot_create_deterministic_doe.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:here  to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_reliability_sensitivity_design_of_experiments_plot_create_deterministic_doe.py: Create a deterministic design of experiments ============================================ .. GENERATED FROM PYTHON SOURCE LINES 6-13 .. code-block:: default from __future__ import print_function import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 14-24 Four types of deterministic designs of experiments are available: - :class:~openturns.Axial - :class:~openturns.Factorial - :class:~openturns.Composite - :class:~openturns.Box Each type of deterministic design is discretized differently according to a number of levels. Functionally speaking, a design is a :class:~openturns.Sample that lies within the unit cube :math:(0,1)^d and can be scaled and moved to cover the desired box. .. GENERATED FROM PYTHON SOURCE LINES 27-28 We will use the following function to plot bi-dimensional samples. .. GENERATED FROM PYTHON SOURCE LINES 30-39 .. code-block:: default def drawBidimensionalSample(sample, title): n = sample.getSize() graph = ot.Graph("%s, size=%d" % (title, n), r"$X_1$", r"$X_2$", True, '') #cloud = ot.Cloud(sample) cloud = ot.Cloud(sample, "blue", "fsquare", "") graph.add(cloud) return graph .. GENERATED FROM PYTHON SOURCE LINES 40-42 Axial design ------------ .. GENERATED FROM PYTHON SOURCE LINES 44-50 .. code-block:: default levels = [1.0, 1.5, 3.0] experiment = ot.Axial(2, levels) sample = experiment.generate() graph = drawBidimensionalSample(sample, "Axial") view = viewer.View(graph) .. image-sg:: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_001.png :alt: Axial, size=13 :srcset: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 51-53 Use \*= to rescale and += to move a design. Pay attention to the grid in the next graph. .. GENERATED FROM PYTHON SOURCE LINES 55-60 .. code-block:: default sample *= 2.0 sample += [5.0, 8.0] graph = drawBidimensionalSample(sample, "Axial") view = viewer.View(graph) .. image-sg:: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_002.png :alt: Axial, size=13 :srcset: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 61-64 Factorial design ---------------- .. GENERATED FROM PYTHON SOURCE LINES 66-73 .. code-block:: default experiment = ot.Factorial(2, levels) sample = experiment.generate() sample *= 2.0 sample += [5.0, 8.0] graph = drawBidimensionalSample(sample, "Factorial") view = viewer.View(graph) .. image-sg:: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_003.png :alt: Factorial, size=13 :srcset: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 74-79 Composite design ---------------- A composite design is a stratified design of experiments enabling to create a pattern as the union of an Axial pattern and a Factorial one. The number of points generated is :math:1 + n_{\mathrm{level}}(2n+2^n). .. GENERATED FROM PYTHON SOURCE LINES 81-88 .. code-block:: default experiment = ot.Composite(2, levels) sample = experiment.generate() sample *= 2.0 sample += [5.0, 8.0] graph = drawBidimensionalSample(sample, "Composite") view = viewer.View(graph) .. image-sg:: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_004.png :alt: Composite, size=25 :srcset: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 89-92 Grid design ----------- .. GENERATED FROM PYTHON SOURCE LINES 94-102 .. code-block:: default levels = [3, 4] experiment = ot.Box(levels) sample = experiment.generate() sample *= 2.0 sample += [5.0, 8.0] graph = drawBidimensionalSample(sample, "Box") view = viewer.View(graph) plt.show() .. image-sg:: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_005.png :alt: Box, size=30 :srcset: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_deterministic_doe_005.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.425 seconds) .. _sphx_glr_download_auto_reliability_sensitivity_design_of_experiments_plot_create_deterministic_doe.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:Download Python source code: plot_create_deterministic_doe.py  .. container:: sphx-glr-download sphx-glr-download-jupyter :download:Download Jupyter notebook: plot_create_deterministic_doe.ipynb  .. only:: html .. rst-class:: sphx-glr-signature Gallery generated by Sphinx-Gallery _