Purpose

This example demonstrates how to access method results in Dakota's HDF5 output. Specifically, statistics computed by an incremental sampling study are plotted. In addition to numerical results, metadata (the number of samples, a probability level ) are extracted from a group attirbute and a dataset dimension scale. 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 the text_book function, which is documented in both the User's and Reference Manuals. There are four normally distributed variables, x1-x4, and one response, f. The method was assigned the ID "my_sampling".

To (re)generate the results output, run dakota -i dakota_refine.in.


Begin by importingh5py and other required modules.

In this example, we will examine how a few statistics converge as the number of samples is increased from 5 to 160. When the refinement_samples keyword is present, results from a sampling study are nested in groups named increment:<N>, where <N> is an integer index (beginning with 1) for the refinement.

Moments

Let's first examine the mean and standard deviation of f and their 95% confidence bounds. These are stored in the datasets

Our approach will be to iterate the increment groups to collect the moment, standard deviation, and bounds into numpy arrays. Then we'll make the plots.

Plot Mean

Plot Standard Deviation

Probability Levels

The study also computed the 90th percentile on f.