gemseo / post

variable_influence module

Plot the partial sensitivity of the functions.


Bases: OptPostProcessor

First order variable influence analysis.

This post-processing computes \(\frac{\partial f(x)}{\partial x_i}\left(x_i^* - x_i^{(0)}\right)\) where \(x_i^{(0)}\) is the initial value of the variable and \(x_i^*\) is the optimal value of the variable.

Options of the plot method are:

  • proportion of the total sensitivity to use as a threshold to filter the variables,

  • the use of a logarithmic scale,

  • the possibility to save the indices of the influential variables indices in a NumPy file.


opt_problem (OptimizationProblem) – The optimization problem to be post-processed.


ValueError – If the JSON grammar file for the options of the post-processor does not exist.


Check the options of the post-processor.


**options (Union[int, float, str, bool, Sequence[str]]) – The options of the post-processor.


InvalidDataException – If an option is invalid according to the grammar.

Return type:


execute(save=True, show=False, file_path=None, directory_path=None, file_name=None, file_extension=None, fig_size=None, **options)

Post-process the optimization problem.

  • save (bool) –

    If True, save the figure.

    By default it is set to True.

  • show (bool) –

    If True, display the figure.

    By default it is set to False.

  • file_path (str | Path | None) – The path of the file to save the figures. If the extension is missing, use file_extension. If None, create a file path from directory_path, file_name and file_extension.

  • directory_path (str | Path | None) – The path of the directory to save the figures. If None, use the current working directory.

  • file_name (str | None) – The name of the file to save the figures. If None, use a default one generated by the post-processing.

  • file_extension (str | None) – A file extension, e.g. ‘png’, ‘pdf’, ‘svg’, … If None, use a default file extension.

  • fig_size (tuple[float, float] | None) – The width and height of the figure in inches, e.g. (w, h). If None, use the OptPostProcessor.DEFAULT_FIG_SIZE of the post-processor.

  • **options (OptPostProcessorOptionType) – The options of the post-processor.


The figures, to be customized if not closed.


ValueError – If the opt_problem.database is empty.

DEFAULT_FIG_SIZE = (20.0, 5.0)

The default width and height of the figure, in inches.


tuple(float, float)

database: Database

The database generated by the optimization problem.

property figures: dict[str, matplotlib.figure.Figure]

The Matplotlib figures indexed by a name, or the nameless figure counter.

materials_for_plotting: dict[Any, Any]

The materials to eventually rebuild the plot in another framework.

opt_problem: OptimizationProblem

The optimization problem.

property output_files: list[str]

The paths to the output files.