Generate an N2 and XDSM from an Excel description of the MDO problem

from os import mkdir
from os.path import exists
from os.path import join

from gemseo.api import configure_logger
from gemseo.utils.study_analysis import StudyAnalysis



<RootLogger root (INFO)>

Describe your MDO problem in an Excel file


Visualize this study

study = StudyAnalysis("disciplines_spec.xlsx")
if not exists("outputs"):


INFO - 07:18:15: Detected the following disciplines: ['Discipline1', 'Discipline2', 'Scenario']
INFO - 07:18:15: Parsing discipline Discipline1
INFO - 07:18:15: Inputs: ['a', 'b', 'c']
INFO - 07:18:15: Outputs: ['d', 'e', 'g']
INFO - 07:18:15: Parsing discipline Discipline2
INFO - 07:18:15: Inputs: ['z', 'x', 'd', 'g']
INFO - 07:18:15: Outputs: ['a', 'b', 'f']
INFO - 07:18:15: Detected scenario in sheet: Scenario
INFO - 07:18:15: New scenario: Scenario
INFO - 07:18:15: Objectives: ['f']
INFO - 07:18:15: Disciplines: ['Discipline1', 'Discipline2']
INFO - 07:18:15: Constraints: ['g']
INFO - 07:18:15: Design variables: ['b', 'x']
INFO - 07:18:15: Formulation: MDF

Generate N2 chrt

study.generate_n2(file_path=join("outputs", "n2.png"), save=False, show=True)
plot study prototyping

Generate XDSM



    INFO - 07:18:16: Generated the following Scenario:
    INFO - 07:18:16: MDOScenario
    INFO - 07:18:16: Optimization problem:
    INFO - 07:18:16:    minimize f(x)
    INFO - 07:18:16:    with respect to x
    INFO - 07:18:16:    subject to constraints:
    INFO - 07:18:16:       g(x) == 0.0
    INFO - 07:18:16: Generating HTML XDSM file in : outputs/xdsm.html

   Disciplines: Discipline1 Discipline2
   MDO formulation: MDF

Visualize this study from command line

We can create the same figures using command line inputs:

gemseo-study disciplines_spec.xlsx -o outputs -s '(5,5)' -x -l


  • gemseo-study is an executable provided by GEMSEO,

  • disciplines_spec.xlsx is the Excel file path,

  • -o outputs is the output directory,

  • -s '(5,5)' is the size of the N2 chart,

  • -x is an option to create of the XDSM,

  • -l is an option to create a PDF file with the creation of the XDSM.

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

Gallery generated by Sphinx-Gallery