.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/sensitivity/morris/plot_12_dimensional_gfunction.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 or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_sensitivity_morris_plot_12_dimensional_gfunction.py: 12-dimensional g-function ============================================== To be compared with results from "An effective screening design for sensitivity analysis of large models", Campolongo et al, 2007 .. GENERATED FROM PYTHON SOURCE LINES 12-13 Initially we have to import the necessary modules. .. GENERATED FROM PYTHON SOURCE LINES 16-23 .. code-block:: default import shutil from UQpy.run_model.model_execution.PythonModel import PythonModel from UQpy.run_model.RunModel import RunModel from UQpy.distributions import Uniform from UQpy.sensitivity import MorrisSensitivity import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 24-25 Set-up problem with g-function. .. GENERATED FROM PYTHON SOURCE LINES 28-55 .. code-block:: default a_values = [0.001, 89.9, 5.54, 42.10, 0.78, 1.26, 0.04, 0.79, 74.51, 4.32, 82.51, 41.62] na = len(a_values) model = PythonModel(model_script='local_pfn.py', model_object_name='gfun_sensitivity', delete_files=True, a_values=a_values, var_names=['X{}'.format(i) for i in range(na)]) runmodel_object = RunModel(model=model) dist_object = [Uniform(), ] * na sens = MorrisSensitivity(runmodel_object=runmodel_object, distributions=dist_object, n_levels=20, maximize_dispersion=True) sens.run(n_trajectories=10) print(['a{}={}'.format(i + 1, ai) for i, ai in enumerate(a_values)]) fig, ax = plt.subplots() ax.scatter(sens.mustar_indices, sens.sigma_indices) for i, (mu, sig) in enumerate(zip(sens.mustar_indices, sens.sigma_indices)): ax.text(x=mu + 0.01, y=sig + 0.01, s='X{}'.format(i + 1)) ax.set_xlabel(r'$\mu^{\star}$', fontsize=14) ax.set_ylabel(r'$\sigma$', fontsize=14) ax.set_title('Morris sensitivity indices', fontsize=16) plt.show() .. image-sg:: /auto_examples/sensitivity/morris/images/sphx_glr_plot_12_dimensional_gfunction_001.png :alt: Morris sensitivity indices :srcset: /auto_examples/sensitivity/morris/images/sphx_glr_plot_12_dimensional_gfunction_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none ['a1=0.001', 'a2=89.9', 'a3=5.54', 'a4=42.1', 'a5=0.78', 'a6=1.26', 'a7=0.04', 'a8=0.79', 'a9=74.51', 'a10=4.32', 'a11=82.51', 'a12=41.62'] .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.875 seconds) .. _sphx_glr_download_auto_examples_sensitivity_morris_plot_12_dimensional_gfunction.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/SURGroup/UQpy/master?urlpath=lab/tree/notebooks/auto_examples/sensitivity/morris/plot_12_dimensional_gfunction.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_12_dimensional_gfunction.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_12_dimensional_gfunction.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_