Purpose

This example demonstrates how to access method results in Dakota's HDF5 output. Specifically, the univariate effects computed by a centered parameter study are plotted. In addition to numerical results, metadata (response labels) are extracted from a dimension scale on a dataset. Complete details about the organization of results and evaluation data in Dakota's HDF5 output are available in the Reference Manual. The h5py documentation is also a valuable resource.

Study Details

The simulation that Dakota runs is a simple analytical model of a cantilever beam. The variables studied are:

The length and other pertinent material properties of the beam are fixed.

The responses are the cross-sectional area of the beam, the stress, and the tip displacement.

To (re)generate the results output (dakota_results.h5), run dakota -i dakota_centered.in.

Plotting Strategy

A separate plot will be produced for each of the three responses--area, stress, and displacement--that shows the univariate effects of all the variables. To put the variables on a common axis, the responses will be plotted versus step index, from -5 to 5.

In the results file, the method results group /methods/NO_METHOD_ID/results/execution:1 contains a group named variable_slices, and variable_slices contains one subgroup per variable. Within these subgroups, there are two datasets:

(Examining the results of a centered parameter study by using the variable_slices datasets in the HDF5 output is simpler than using Dakota's tabular output inasmuch as the center point is repeated.)

Because the data are grouped by variable rather than by response, we'll have to iterate over the groups repeatedly for each response.

The approach is:

  1. Open the Dakota results file in read-only mode using the h5py.File() method.
  2. Iterate over the response labels
  3. For each response, iterate over the variable groups to obtain the response values.
  4. Plot the response values versus the step indexes.

Begin by importing h5py and other required modules.