# Summary

Read the results of an incremental sampling study from Dakota's HDF5-format output file and plot them using the Python packages h5py and matplotlib.

# Description

Dakota was used to perform an incremental sampling study of the cantilever problem. In an incremental sampling study, Dakota evaluates samples in batches or increments. After each increment, it computes statistics, such as the mean and standard deviation, on all the accumulated samples. This enables the convergence of statistics as samples are added to be examined.

The results of each increment were written to Dakota's HDF5-format results file. The Jupyter Notebook included with the example demonstrates how to use the Python `h5py` package to access the results and the `matplotlib` package to then plot them.

# Dakota Keywords

HDF5 output is not enabled in Dakota by default. To turn it on, add `results_output hdf5` to the `environment` section of the Dakota input. Additional keywords tailor the specific data written and the name of the file, as described in the [Reference Manual](https://dakota.sandia.gov//sites/default/files/docs/6.13/html-ref/environment-results_output-hdf5.html). Layout of the data in the output file [is also described there](https://dakota.sandia.gov//sites/default/files/docs/6.13/html-ref/hdf5_output.html).

# How to run the example

Use Jupyter Notebook or Jupyterlab to open `plot_increments.ipynb`. The notebook uses `dakota_results.h5`, which can be re-generated by running the Dakota input `dakota_refine.in`:

    $ dakota -i dakota_refine.in -o dakota_refine.out

On gitlab, `plot_increments.ipynb` can be viewed read-only. Another way to view the notebook read-only is by opening `plot_increments.html` in a web browser.

# Requirements

[Jupyter notebook or JupyterLab](https://jupyter.org/) is needed to run the notebook interactively. The Python packages `h5py` and `matplotlib` are also required. All these dependencies can be satisfied by installing the [Anaconda](https://www.anaconda.com/) Python distribution.

# Contents

* `dakota_refine.in`: Dakota input for incremental sampling study
* `dakota_results.h5`: HDF5-format results output file
* `plot_increments.ipynb`: Jupyter notebook, demonstrating how to read and plot results
* `plot_increments.html`: Read-only version of the notebook

