.. 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_random_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_random_doe.py: Create a random design of experiments ===================================== .. GENERATED FROM PYTHON SOURCE LINES 7-11 Abstract -------- Random designs of experiments can be generated from probability distributions. .. GENERATED FROM PYTHON SOURCE LINES 13-20 .. 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 21-22 We create the underlying distribution: a standard 2-dimensional normal distribution. .. GENERATED FROM PYTHON SOURCE LINES 22-25 .. code-block:: Python distribution = ot.Normal(2) size = 50 .. GENERATED FROM PYTHON SOURCE LINES 26-30 The Monte Carlo design of experiments ------------------------------------- We build the experiment with the :class:`~openturns.MonteCarloExperiment` class : .. GENERATED FROM PYTHON SOURCE LINES 30-33 .. code-block:: Python experiment = ot.MonteCarloExperiment(distribution, size) sample = experiment.generate() .. GENERATED FROM PYTHON SOURCE LINES 34-35 We draw the design of experiments as a :class:`~openturns.Cloud` .. GENERATED FROM PYTHON SOURCE LINES 35-40 .. code-block:: Python graph = ot.Graph("Monte Carlo design", r"$x_1$", r"$x_2$", True, "") cloud = ot.Cloud(sample, "blue", "fsquare", "") graph.add(cloud) view = viewer.View(graph) .. image-sg:: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_random_doe_001.png :alt: Monte Carlo design :srcset: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_random_doe_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 41-45 Latin Hypercube Sampling ------------------------ We build the LHS design of experiments with the :class:`~openturns.LHSExperiment` class : .. GENERATED FROM PYTHON SOURCE LINES 45-48 .. code-block:: Python experiment = ot.LHSExperiment(distribution, size) sample = experiment.generate() .. GENERATED FROM PYTHON SOURCE LINES 49-50 We draw the LHS design of experiments as a cloud : .. GENERATED FROM PYTHON SOURCE LINES 50-55 .. code-block:: Python graph = ot.Graph("LHS design", r"$x_1$", r"$x_2$", True, "") cloud = ot.Cloud(sample, "blue", "fsquare", "") graph.add(cloud) view = viewer.View(graph) .. image-sg:: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_random_doe_002.png :alt: LHS design :srcset: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_random_doe_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 56-57 Display figures .. GENERATED FROM PYTHON SOURCE LINES 57-58 .. code-block:: Python plt.show() .. _sphx_glr_download_auto_reliability_sensitivity_design_of_experiments_plot_create_random_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_random_doe.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_create_random_doe.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_create_random_doe.zip `