.. 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 :ref:`Go to the end ` 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:: Python 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 31-40 .. code-block:: Python 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 41-43 Axial design ------------ .. GENERATED FROM PYTHON SOURCE LINES 45-51 .. code-block:: Python 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 52-54 Use \*= to rescale and += to move a design. Pay attention to the grid in the next graph. .. GENERATED FROM PYTHON SOURCE LINES 56-61 .. code-block:: Python 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 62-65 Factorial design ---------------- .. GENERATED FROM PYTHON SOURCE LINES 67-74 .. code-block:: Python 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 75-81 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 83-90 .. code-block:: Python 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 91-94 Grid design ----------- .. GENERATED FROM PYTHON SOURCE LINES 96-104 .. code-block:: Python 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 .. _sphx_glr_download_auto_reliability_sensitivity_design_of_experiments_plot_create_deterministic_doe.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_create_deterministic_doe.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_create_deterministic_doe.py `