DesignSpace import and export from disk

In this example, we will see how to read, filter, and export a design space from the disk.

from __future__ import annotations

from gemseo import configure_logger
from gemseo import read_design_space
from gemseo import write_design_space

configure_logger()
<RootLogger root (INFO)>

Read a design space from a file

The user can read a design space from a file using the create_design_space() function.

design_space = read_design_space("design_space.csv")
design_space
Design space:
Name Lower bound Value Upper bound Type
x1 -1 0 1 float
x2 5 6 8 float
x 2 3 5 integer


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 DesignSpace.filter() method:

design_space.filter(["x1", "x2"])
design_space
Design space:
Name Lower bound Value Upper bound Type
x1 -1 0 1 float
x2 5 6 8 float


Export the design space

The user can export a DesignSpace instance by using the write_design_space() function.

write_design_space(design_space, "new_design_space.csv")

Total running time of the script: (0 minutes 0.005 seconds)

Gallery generated by Sphinx-Gallery