fastoad.cmd.api module

API

fastoad.cmd.api.generate_configuration_file(configuration_file_path: str, overwrite: bool = False)[source]

Generates a sample configuration file.

Parameters
  • configuration_file_path – the path of file to be written

  • overwrite – if True, the file will be written, even if it already exists

Raises

FastFileExistsError – if overwrite==False and configuration_file_path already exists

fastoad.cmd.api.generate_inputs(configuration_file_path: str, source_path: Optional[str] = None, source_path_schema='native', overwrite: bool = False)str[source]

Generates input file for the problem specified in configuration_file_path.

Parameters
  • configuration_file_path – where the path of input file to write is set

  • source_path – path of file data will be taken from

  • source_path_schema – set to ‘legacy’ if the source file come from legacy FAST

  • overwrite – if True, file will be written even if one already exists

Returns

path of generated file

Raises

FastFileExistsError – if overwrite==False and configuration_file_path already exists

fastoad.cmd.api.list_variables(configuration_file_path: str, out: Optional[Union[IO, str]] = None, overwrite: bool = False, force_text_output: bool = False, tablefmt: str = 'grid')[source]

Writes list of variables for the problem specified in configuration_file_path.

List is generally written as text. It can be displayed as a scrollable table view if: - function is used in an interactive IPython shell - out == sys.stdout - force_text_output == False

Parameters
  • configuration_file_path

  • out – the output stream or a path for the output file (None means sys.stdout)

  • overwrite – if True and out parameter is a file path, the file will be written even if one already exists

  • force_text_output – if True, list will be written as text, even if command is used in an interactive IPython shell (Jupyter notebook). Has no effect in other shells or if out parameter is not sys.stdout

  • tablefmt – The formatting of the requested table. Options are the same as those available to the tabulate package. See tabulate.tabulate_formats for a complete list.

Raises

FastFileExistsError – if overwrite==False and out parameter is a file path and the file exists

fastoad.cmd.api.list_modules(configuration_file_path: Optional[str] = None, out: Optional[Union[IO, str]] = None, overwrite: bool = False, verbose: bool = False, force_text_output: bool = False)[source]

Writes list of available systems. If configuration_file_path is given and if it defines paths where there are registered systems, they will be listed too.

param configuration_file_path

param out

the output stream or a path for the output file (None means sys.stdout)

param overwrite

if True and out is a file path, the file will be written even if one already exists

param verbose

if True, shows detailed information for each system if False, shows only identifier and path of each system

param force_text_output

if True, list will be written as text, even if command is used in an interactive IPython shell (Jupyter notebook). Has no effect in other shells or if out parameter is not sys.stdout

Raises

FastFileExistsError – if overwrite==False and out is a file path and the file exists

fastoad.cmd.api.write_n2(configuration_file_path: str, n2_file_path: str = 'n2.html', overwrite: bool = False)[source]

Write the N2 diagram of the problem in file n2.html

Parameters
  • configuration_file_path

  • n2_file_path

  • overwrite

fastoad.cmd.api.write_xdsm(configuration_file_path: str, xdsm_file_path: Optional[str] = None, overwrite: bool = False, depth: int = 2, wop_server_url=None, api_key=None)[source]
Parameters
  • configuration_file_path

  • xdsm_file_path

  • overwrite

  • depth

  • wop_server_url

  • api_key

Returns

fastoad.cmd.api.evaluate_problem(configuration_file_path: str, overwrite: bool = False)fastoad.openmdao.problem.FASTOADProblem[source]

Runs model according to provided problem file

Parameters
  • configuration_file_path – problem definition

  • overwrite – if True, output file will be overwritten

Returns

the OpenMDAO problem after run

fastoad.cmd.api.optimize_problem(configuration_file_path: str, overwrite: bool = False, auto_scaling: bool = False)fastoad.openmdao.problem.FASTOADProblem[source]

Runs driver according to provided problem file

Parameters
  • configuration_file_path – problem definition

  • overwrite – if True, output file will be overwritten

  • auto_scaling – if True, automatic scaling is performed for design variables and constraints

Returns

the OpenMDAO problem after run

fastoad.cmd.api.optimization_viewer(configuration_file_path: str)[source]

Displays optimization information and enables its editing

Parameters

configuration_file_path – problem definition

Returns

display of the OptimizationViewer

fastoad.cmd.api.variable_viewer(file_path: str, file_formatter: Optional[fastoad.io.formatter.IVariableIOFormatter] = None, editable=True)[source]

Displays a widget that enables to visualize variables information and edit their values.

Parameters
  • file_path – the path of file to interact with

  • file_formatter – the formatter that defines file format. If not provided, default format will be assumed.

  • editable – if True, an editable table with variable filters will be displayed. If False, the table will not be editable nor searchable, but can be stored in an HTML file.

Returns

display handle of the VariableViewer