src.plots.vvuq_plots module

This module is responsible for the plotting the results from the VV&UQ methodology.

It includes several functions that plot different aspects. See details in their own documentations. Generally, a index dictionary can be used to select only a subset of the data arrays that shall be plotted.

Examples:

idx_dict = {‘quantities’: ‘Car.ax’, ‘space_samples’: 1, ‘timesteps’: slice(1000, 3000)} idx_dict = {‘quantities’: ‘Car.ax’, ‘timesteps’: slice(1000, 3000)} idx_dict = {‘quantities’: ‘Car.ax’, ‘space_samples’: 1} idx_dict = {‘quantities’: ‘Car.ax’}

Contact person: Stefan Riedmaier Creation date: 20.08.2020 Python version: 3.8

src.plots.vvuq_plots.plot_area_metrics(config, cfgpl, pbox_y_model, pbox_y_system, pbox_x_model_list, pbox_x_system_list, metric_da, scenarios_da, save_path='')

This function plots the area between CDFs or pboxes (see area validation metrics).

Parameters:
  • config (dict) – user configuration

  • cfgpl (dict) – user configuration of this plot

  • pbox_y_model (np.ndarray) – y vector of the model

  • pbox_y_system (np.ndarray) – y vector of the system

  • pbox_x_model_list (list[np.ndarray, np.ndarray]) – list with left and right x vector of the model

  • pbox_x_system_list (list[np.ndarray, np.ndarray]) – list with left and right x vector of the system

  • metric_da (xr.DataArray) – array with validation metric results

  • scenarios_da (xr.DataArray) – array with scenarios

  • save_path (str) – path where the plots shall be saved (otherwise they will be shown)

Returns:

src.plots.vvuq_plots.plot_cdf(config, cfgpl, qois_kpi_raw_da, fill_flag=False, qois_kpi_da=None, save_path='')

This function plots an Empirical (step function) Cumulative Distribution Function (ECDF).

Parameters:
  • config (dict) – user configuration

  • cfgpl (dict) – user configuration of this plot

  • qois_kpi_raw_da (xr.DataArray) – array with KPIs, in the raw form without CDFs

  • fill_flag (bool) – flag to fill the area between CDFs

  • qois_kpi_da (xr.DataArray) – array with KPIs, in the form of a pbox

  • save_path (str) – path where the plots shall be saved (otherwise they will be shown)

Returns:

src.plots.vvuq_plots.plot_decision_space(config, cfgpl, scenarios_application_da=<xarray.DataArray ()> array(None, dtype=object), decision_application_system_estimated_da=<xarray.DataArray ()> array(None, dtype=object), decision_application_system_da=<xarray.DataArray ()> array(None, dtype=object), decision_application_model_da=<xarray.DataArray ()> array(None, dtype=object), scenarios_validation_da=<xarray.DataArray ()> array(None, dtype=object), decision_validation_da=<xarray.DataArray ()> array(None, dtype=object), decision_validation_system_da=<xarray.DataArray ()> array(None, dtype=object), decision_validation_model_da=<xarray.DataArray ()> array(None, dtype=object), save_path='')

This function plots the binary decisions across the scenario space by coloring the points.

The idx_dict must contain a ‘qois’ and a ‘parameters’ key. The ‘qois’-key must contain exactly one string value: qoi name from the decision arrays. The ‘parameters’-key must contain a list of either two or three string values: parameter names from scenario arrays. Depending on the ‘parameters’-key, a two or three dimensional scatter plot will be created. The order of the parameter names in the list determines the x, y and z axes in the plot. The idx_dict can contain a ‘space_samples’ key to index only a subset of the whole data, e.g. slice(None, None, 10). This is important for high-dimensional spaces to only visualize one layer in the 2D scatter plot.

The function arguments are not fully optional. Please provide either application or validation data, so that something can be plotted. Please provide the scenario and decision data together, since they cannot be plotted standalone.

The decision_system_da and decision_model_da arguments are fully optional. However, please provide not both at the same time.

Parameters:
  • config (dict) – user configuration

  • cfgpl (dict) – user configuration of this plot

  • scenarios_application_da (xr.DataArray) – (optional) application scenario array

  • decision_application_system_estimated_da (xr.DataArray) – (optional) decisions of the system estimator in appl.

  • decision_application_system_da (xr.DataArray) – (optional) decisions of the actual system in the appl. domain

  • decision_application_model_da (xr.DataArray) – (optional) decisions of the model in the application domain

  • scenarios_validation_da (xr.DataArray) – (optional) validation scenario array

  • decision_validation_da (xr.DataArray) – (optional) model accuracy decisions in the validation domain

  • decision_validation_system_da (xr.DataArray) – (optional) safety decisions of the system in validation domain

  • decision_validation_model_da (xr.DataArray) – (optional) safety decisions of the model in the validation domain

  • save_path (str) – (optional) path where the plots shall be saved (otherwise they will be shown)

src.plots.vvuq_plots.plot_error_integration_deterministic(config, cfgpl, qois_kpi_model_da, qois_kpi_system_estimated_da, scenarios_model_da, qois_kpi_system_da=<xarray.DataArray ()> array(None, dtype=object), save_path='')

This function plots the deterministic model kpis with uncertainty, the true system kpis and the regulation.

Parameters:
  • config (dict) – user configuration

  • cfgpl (dict) – user configuration of this plot

  • qois_kpi_model_da (xr.DataArray) – array with model kpis in the application domain

  • qois_kpi_system_estimated_da (xr.DataArray) – array with estimated system values in the application domain

  • scenarios_model_da (xr.DataArray) – array with application scenarios

  • qois_kpi_system_da (xr.DataArray) – (optional) array with the true system kpis in the application domain

  • save_path (str) – (optional) path where the plots shall be saved (otherwise they will be shown)

Returns:

src.plots.vvuq_plots.plot_extrapolation_surface(config, cfgpl, scenarios_validation_da, metric_validation_da, scenarios_application_da, error_validation_da, save_path='')

This function plots the response surface of the error model including prediction interval and the metric results.

The idx_dict must contain a ‘qois’ and a ‘parameters’ key. The ‘qois’-key must contain exactly one string value: qoi name from the decision arrays. The ‘parameters’-key must contain a list of two string values: parameter names from scenario arrays. The order of the parameter names in the list determines the x, y and z axes in the plot. The idx_dict can contain a ‘space_samples’ key to index only a subset of the whole data, e.g. slice(None, None, 10). This is important for high-dimensional spaces to only visualize one layer in the 2D scatter plot.

In case of non-deterministic data, the idx_dict should contain an ‘interval’-key. Then, either the left or the right metric results are plotted (scatter points) and three surfaces for the lower and upper prediction interval and the regression estimate. In case of deterministic data, the idx_dict should not contain an ‘interval’-key. Then, the metric results are plotted (scatter points) and the error estimation with both bounds (three surfaces).

Parameters:
  • config (dict) – user configuration

  • cfgpl (dict) – user configuration of this plot

  • scenarios_validation_da (xr.DataArray) – array with validation scenarios

  • metric_validation_da (xr.DataArray) – array with validation metric results

  • scenarios_application_da (xr.DataArray) – array with application scenarios

  • error_validation_da (xr.DataArray) – array with inferred errors across the application domain

  • save_path (str) – (optional) path where the plots shall be saved (otherwise they will be shown)

src.plots.vvuq_plots.plot_kpi_surface(config, cfgpl, scenarios_da, qois_kpi_raw_da, plot_type='', save_path='')

This function plots a response surface of KPIs across the scenario space.

The idx_dict must contain a ‘qois’ and a ‘parameters’ key. The ‘qois’-key must contain exactly one string value: qoi name from the decision arrays. The ‘parameters’-key must contain a list of either two or three string values: parameter names from scenario arrays. The order of the parameter names in the list determines the x and y (and z) axes in the plot. The idx_dict can contain a ‘space_samples’ key to index only a subset of the whole data, e.g. slice(None, None, 10). This is important for high-dimensional spaces to only visualize one layer in the 2D scatter plot. The idx_dict can contain the dimensions ‘repetitions’, ‘aleatory_samples’ or ‘epistemic_samples’ to index a subset.

It creates a surface plot if the selected data is one-dimensional. Otherwise it creates a scatter plot. Depending on the ‘parameters’-key, the scatter plot is two or three dimensional.

Parameters:
  • config (dict) – user configuration

  • cfgpl (dict) – user configuration of this plot

  • scenarios_da (xr.DataArray) – array with scenarios

  • qois_kpi_raw_da (xr.DataArray) – array with KPIs

  • plot_type (str) – (optional) type of the plot: surface, scatter or stem (depending on dimensionality!)

  • save_path (str) – (optional) path where the plots shall be saved (otherwise they will be shown)

src.plots.vvuq_plots.plot_scenario_space(config, cfgpl, scenarios_verification_da=<xarray.DataArray ()> array(None, dtype=object), scenarios_validation_model_da=<xarray.DataArray ()> array(None, dtype=object), scenarios_validation_system_da=<xarray.DataArray ()> array(None, dtype=object), scenarios_application_da=<xarray.DataArray ()> array(None, dtype=object), scenarios_space_validation_da=<xarray.DataArray ()> array(None, dtype=object), scenarios_space_application_da=<xarray.DataArray ()> array(None, dtype=object), save_path='')

This function plots scatter points over the coordinates given by scenario points of multiple domains.

The idx_dict must contain a ‘parameters’ key. The ‘parameters’-key must contain a list of either two or three string values: parameter names from scenario arrays. Depending on the ‘parameters’-key, a two or three dimensional scatter plot will be created. The order of the parameter names in the list determines the x, y and z axes in the plot.

The function arguments are not fully optional. Please provide at least one array, so that something can be plotted.

Parameters:
  • config (dict) – user configuration

  • cfgpl (dict) – user configuration of this plot

  • scenarios_verification_da (xr.DataArray) – (optional) verification scenario array

  • scenarios_validation_model_da (xr.DataArray) – (optional) validation scenario array of the simulator

  • scenarios_validation_system_da (xr.DataArray) – (optional) validation scenario array of the experiment

  • scenarios_application_da (xr.DataArray) – (optional) application scenario array

  • scenarios_space_validation_da (xr.DataArray) – (optional) nominal validation scenario points

  • scenarios_space_application_da (xr.DataArray) – (optional) nominal appl. scenario points

  • save_path (str) – (optional) path where the plots shall be saved (otherwise they will be shown)

src.plots.vvuq_plots.plot_timeseries(config, cfgpl, qois_ts_da, qois_kpi_da=<xarray.DataArray ()> array(None, dtype=object), save_path='')

This function plots possibly multiple time series.

The idx_dict should contain the qoi to be plotted. It can include a timesteps key to slice the time dimension.

Parameters:
  • config (dict) – user configuration

  • cfgpl (dict) – user configuration of this plot

  • qois_ts_da (xr.DataArray) – array of qoi time series

  • qois_kpi_da (xr.DataArray) – (optional) array of model kpis

  • save_path (str) – (optional) path where the plots shall be saved (otherwise they will be shown)

src.plots.vvuq_plots.plot_timeseries_unecer79(cfgpl, qois_ts_da, quantities_ts_da, qois_ts_untrimmed_da, qois_kpi_da=<xarray.DataArray ()> array(None, dtype=object), start_idx=None, stop_idx=None, ay_lower_bound=None, ay_upper_bound=None, save_path='')

This function plots a specific time series of lateral acceleration and distance to line for the UNECE-R79.

In the upper subplot, it visualizes the check against the stationary ay-conditions to extract the valid events. In the lower subplot, it visualizes the actual distance to line qoi signal during the valid event. The idx_dict should not contain the actual qoi.

If the start and stop indices are provided, it visualizes vertical lines as event borders. If the ay bounds are provided, it visualizes horizontal bounds as stationary conditions.

If the KPI is provided, it will be highlighted as point in the time series of the distance to line.

Parameters:
  • cfgpl (dict) – user configuration of this plot

  • qois_ts_da (xr.DataArray) – array of qoi time series

  • quantities_ts_da (xr.DataArray) – array of quantity time series

  • qois_ts_untrimmed_da (xr.DataArray) – array of untrimmed qoi time series

  • start_idx (tuple(np.ndarray)) – (optional) tuple of integer index arrays with the event start indices

  • stop_idx (tuple(np.ndarray)) – (optional) tuple of integer index arrays with the event stop indices

  • ay_lower_bound (np.ndarray) – (optional) lower ay bound to be plotted as horizontal line

  • ay_upper_bound (np.ndarray) – (optional) upper ay bound to be plotted as horizontal line

  • qois_kpi_da (xr.DataArray) – (optional) array of model kpis

  • save_path (str) – (optional) path where the plots shall be saved (otherwise they will be shown)

src.plots.vvuq_plots.plot_uncertainty_expansion_nondeterministic(config, cfgpl, qois_kpi_model_da, qois_kpi_system_estimated_da, qois_kpi_system_estimated_validation_da, scenarios_model_da, qois_kpi_system_da=<xarray.DataArray ()> array(None, dtype=object), save_path='')

This function plots the three non-deterministic model uncertainties, the true system uncertainty and the regulation.

Parameters:
  • config (dict) – user configuration

  • cfgpl (dict) – user configuration of this plot

  • qois_kpi_model_da (xr.DataArray) – array with model kpis in the application domain

  • qois_kpi_system_estimated_da (xr.DataArray) – array with estimated system responses

  • qois_kpi_system_estimated_validation_da (xr.DataArray) – array with estimated system responses, only validation

  • scenarios_model_da (xr.DataArray) – array with application scenarios

  • qois_kpi_system_da (xr.DataArray) – (optional) array with the true system kpis in the application domain

  • save_path (str) – (optional) path where the plots shall be saved (otherwise they will be shown)

Returns: