.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/design_space/plot_load_design_space.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_examples_design_space_plot_load_design_space.py: DesignSpace import and export from disk ======================================= In this example, we will see how to read, filter, and export a design space from the disk. .. GENERATED FROM PYTHON SOURCE LINES 28-38 .. code-block:: Python from __future__ import annotations from gemseo import configure_logger from gemseo import read_design_space from gemseo import write_design_space configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 39-44 Read a design space from a file ------------------------------- The user can read a design space from a file using the :func:`.create_design_space` function. .. GENERATED FROM PYTHON SOURCE LINES 44-47 .. code-block:: Python design_space = read_design_space("design_space.csv") design_space .. raw:: html
Design space:
Name Lower bound Value Upper bound Type
x1 -1 0 1 float
x2 5 6 8 float
x 2 3 5 integer


.. GENERATED FROM PYTHON SOURCE LINES 48-53 Filtering the design space -------------------------- The user can filter the design space in order to only keep some variables. To do so, the user can use the :meth:`.DesignSpace.filter` method: .. GENERATED FROM PYTHON SOURCE LINES 53-56 .. code-block:: Python design_space.filter(["x1", "x2"]) design_space .. raw:: html
Design space:
Name Lower bound Value Upper bound Type
x1 -1 0 1 float
x2 5 6 8 float


.. GENERATED FROM PYTHON SOURCE LINES 57-62 Export the design space ----------------------- The user can export a :class:`.DesignSpace` instance by using the :func:`.write_design_space` function. .. GENERATED FROM PYTHON SOURCE LINES 62-63 .. code-block:: Python write_design_space(design_space, "new_design_space.csv") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.005 seconds) .. _sphx_glr_download_examples_design_space_plot_load_design_space.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_load_design_space.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_load_design_space.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_