.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/dataset/plot_burgers.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_examples_dataset_plot_burgers.py: Burgers dataset =============== Dataset consisting of solutions to Burgers' equation. .. GENERATED FROM PYTHON SOURCE LINES 27-34 .. code-block:: default from gemseo.api import configure_logger from gemseo.api import load_dataset from gemseo.post.dataset.curves import Curves from matplotlib import pyplot as plt configure_logger() .. rst-class:: sphx-glr-script-out Out: .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 35-39 Load Burgers' dataset ----------------------- We can easily load this dataset by means of the :meth:`~gemseo.api.load_dataset` function of the API: .. GENERATED FROM PYTHON SOURCE LINES 39-44 .. code-block:: default dataset = load_dataset("BurgersDataset") print(dataset) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Burgers Number of samples: 30 Number of variables: 2 Variables names and sizes by group: inputs: t (1) outputs: u_t (501) Number of dimensions (total = 502) by group: inputs: 1 outputs: 501 .. GENERATED FROM PYTHON SOURCE LINES 45-47 Show the input and output data ------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 47-50 .. code-block:: default print(dataset.get_data_by_group("inputs")) print(dataset.get_data_by_group("outputs")) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none [[0. ] [0.06896552] [0.13793103] [0.20689655] [0.27586207] [0.34482759] [0.4137931 ] [0.48275862] [0.55172414] [0.62068966] [0.68965517] [0.75862069] [0.82758621] [0.89655172] [0.96551724] [1.03448276] [1.10344828] [1.17241379] [1.24137931] [1.31034483] [1.37931034] [1.44827586] [1.51724138] [1.5862069 ] [1.65517241] [1.72413793] [1.79310345] [1.86206897] [1.93103448] [2. ]] [[-8.61058323e-43 1.25663706e-02 2.51327412e-02 ... -2.51327412e-02 -1.25663706e-02 8.61058323e-43] [-2.58064516e-01 -2.46308879e-01 -2.34553242e-01 ... -2.81575790e-01 -2.69820153e-01 -2.58064516e-01] [-4.84848485e-01 -4.73805311e-01 -4.62762136e-01 ... -5.06934833e-01 -4.95891659e-01 -4.84848485e-01] ... [-2.60240964e+00 -2.59801898e+00 -2.59362832e+00 ... -4.15861152e-01 -4.11470492e-01 -4.07079832e-01] [-2.63529412e+00 -2.63100677e+00 -2.62671942e+00 ... -5.00193830e-01 -4.95906480e-01 -4.91619130e-01] [-2.66666667e+00 -2.66247788e+00 -2.65828909e+00 ... -5.80649145e-01 -5.76460354e-01 -5.72271564e-01]] .. GENERATED FROM PYTHON SOURCE LINES 51-54 Load customized dataset ----------------------- Load the data with custom parameters and input-output naming. .. GENERATED FROM PYTHON SOURCE LINES 54-57 .. code-block:: default dataset = load_dataset("BurgersDataset", n_samples=20, n_x=700, fluid_viscosity=0.03) print(dataset) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Burgers Number of samples: 20 Number of variables: 2 Variables names and sizes by group: inputs: t (1) outputs: u_t (700) Number of dimensions (total = 701) by group: inputs: 1 outputs: 700 .. GENERATED FROM PYTHON SOURCE LINES 58-60 Plot the data ------------- .. GENERATED FROM PYTHON SOURCE LINES 60-63 .. code-block:: default Curves(dataset, "x", "u_t").execute(save=False, show=False) # Workaround for HTML rendering, instead of ``show=True`` plt.show() .. image-sg:: /examples/dataset/images/sphx_glr_plot_burgers_001.png :alt: plot burgers :srcset: /examples/dataset/images/sphx_glr_plot_burgers_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.240 seconds) .. _sphx_glr_download_examples_dataset_plot_burgers.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_burgers.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_burgers.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_