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

from __future__ import division, unicode_literals

from os import mkdir
from os.path import exists, 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 - 12:57:13: Detected the following disciplines: ['Discipline1', 'Discipline2', 'Scenario']
INFO - 12:57:13: Parsing discipline Discipline1
INFO - 12:57:13: Inputs: ['a', 'b', 'c']
INFO - 12:57:13: Outputs: ['d', 'e', 'g']
INFO - 12:57:13: Parsing discipline Discipline2
INFO - 12:57:13: Inputs: ['z', 'x', 'd', 'g']
INFO - 12:57:13: Outputs: ['a', 'b', 'f']
INFO - 12:57:13: Detected scenario in sheet: Scenario
INFO - 12:57:13: New scenario: Scenario
INFO - 12:57:13: Objectives: ['f']
INFO - 12:57:13: Disciplines: ['Discipline1', 'Discipline2']
INFO - 12:57:13: Constraints: ['g']
INFO - 12:57:13: Design variables: ['b', 'x']
INFO - 12:57:13: Formulation: MDF

Generate N2 chrt

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

Generate XDSM



    INFO - 12:57:14: Generated the following Scenario:
    INFO - 12:57:14: MDOScenario
    INFO - 12:57:14: Optimization problem:
    INFO - 12:57:14:    Minimize: f(x)
    INFO - 12:57:14:    With respect to: x
    INFO - 12:57:14:    Subject to constraints:
    INFO - 12:57:14:       g(x) == 0.0
    INFO - 12:57:14: Generating HTML XDSM file in : outputs/xdsm.html

   Disciplines: Discipline1 Discipline2
   MDOFormulation: MDF
   Algorithm: None

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.366 seconds)

Gallery generated by Sphinx-Gallery