Post_Processing_Example_1


Post-processing Examples

This notebook provides some examples for using the post-processing features in RESSPyLab. Automatic table generation and calculation of the consistency metric $\xi_2$ are shown for both the original and updated Voce-Chaboche (UVC) models. Note that there is an example for plotting output in each of the calibration examples.


In [1]:
# First load RESSPyLab and necessary packages
import numpy as np
import RESSPyLab as rpl

Original Voce-Chaboche model

First we will use RESSPyLab to generate a formatted table of parameters including the relative error metric, $\bar{\varphi}$. The inputs to this function are:

  1. Information about the name of the data set and the load protocols used in the optimization.
  2. The file containing the history of parameters (generated from the optimization).
  3. The data used in the optimization.

Two tables are returned (as pandas DataFrames) and are printed to screen in LaTeX format. If you want the tables in some other format it is best to operate on the DataFrames directly (e.g., use to_csv()).


In [2]:
# Identify the material
material_def = {'material_id': ['Example 1'], 'load_protocols': ['1,5']}
# Set the path to the x log file
x_log_file_1 = './output/x_log.txt'
x_logs_all = [x_log_file_1]
# Load the data
data_files_1 = ['example_1.csv']
data_1 = rpl.load_data_set(data_files_1)
data_all = [data_1]

# Make the tables
param_table, metric_table = rpl.summary_tables_maker_vc(material_def, x_logs_all, data_all)


\begin{tabular}{llrrrrrrrrr}
\toprule
{} &   LP &  $\bar{\varphi}$[\%] &  $E$[GPa] &  $\sigma_{y,0}$[MPa] &  $Q_\infty$[MPa] &  $b$ &  $C_1$[MPa] &  $\gamma_1$ &  $C_2$[MPa] &  $\gamma_2$ \\
Material  &      &                      &           &                      &                  &      &             &             &             &             \\
\midrule
Example 1 &  1,5 &                 6.42 &    185.12 &               255.42 &            91.73 & 9.59 &    17430.52 &      157.28 &     1761.99 &        3.55 \\
\bottomrule
\end{tabular}

\begin{tabular}{lrrrrrr}
\toprule
{} &  $\sigma_{y,0}$[MPa] &  $\sigma_{sat}$[MPa] &  $\sigma_{hard}$[MPa] &  $\rho^{sat}_{yield}$ &  $\rho^{sat}_{iso}$ &  $\rho^{sat}_{kin}$ \\
Material  &                      &                      &                       &                       &                     &                     \\
\midrule
Example 1 &               255.42 &               954.48 &                699.06 &                  3.74 &                0.13 &                0.87 \\
\bottomrule
\end{tabular}

Tables can be easily generated following a standard format for several data sets by appending additional entries to the lists of values in material_def and to x_logs_all and data_all.

Now we will generate the consistency metric, $\xi_2$. The input arguments are:

  1. The parameters of the base case.
  2. The parameters of the case that you would like to compare with.
  3. The set of data to compute this metric over.

The metric is returned (the raw value, NOT as a percent) directly from this function.


In [3]:
# Load the base parameters, we want the last entry in the file
x_base = np.loadtxt(x_log_file_1, delimiter=' ')
x_base = x_base[-1]
# Load (or set) the sample parameters
x_sample = np.array([179750., 318.47, 100.72, 8.00, 11608.17, 145.22, 1026.33, 4.68])

# Calculate the metric
consistency_metric = rpl.vc_consistency_metric(x_base, x_sample, data_1)
print consistency_metric


0.6496966577968584

The value of $\xi_2 = 65$ %, indicating that the two sets of parameters are inconsistent for this data set.

Updated Voce-Chaboche model

The inputs to generate the tables are the same as for the original model, however the input parameters have to come from optimization using the updated model.


In [4]:
# Identify the material
material_def = {'material_id': ['Example 1'], 'load_protocols': ['1']}
# Set the path to the x log file
x_log_file_2 = './output/x_log_upd.txt'
x_logs_all = [x_log_file_2]
# Load the data
data_files_2 = ['example_1.csv']
data_2 = rpl.load_data_set(data_files_2)
data_all = [data_2]

# Make the tables
param_table, metric_table = rpl.summary_tables_maker_uvc(material_def, x_logs_all, data_all)


\begin{tabular}{llrrrrrrrrr}
\toprule
{} & LP &  $\bar{\varphi}$[\%] &  $E$[GPa] &  $\sigma_{y,0}$[MPa] &  $Q_\infty$[MPa] &   $b$ &  $D_\infty$[MPa] &    $a$ &  $C_1$[MPa] &  $\gamma_1$ \\
Material  &    &                      &           &                      &                  &       &                  &        &             &             \\
\midrule
Example 1 &  1 &                 5.84 &    195.58 &               335.31 &           107.20 & 17.20 &           110.78 & 197.20 &    20060.19 &      138.01 \\
\bottomrule
\end{tabular}

\begin{tabular}{lrrrrrrr}
\toprule
{} &  $\sigma_{y,0}$[MPa] &  $\sigma_{sat}$[MPa] &  $\sigma_{hard}$[MPa] &  $\rho^{sat}_{yield}$ &  $\rho^{sat}_{iso}$ &  $\rho^{sat}_{kin}$ &  $\rho^{sat}_{D}$ \\
Material  &                      &                      &                       &                       &                     &                     &                   \\
\midrule
Example 1 &               335.31 &               477.09 &                252.55 &                  1.42 &                0.42 &                0.58 &              0.44 \\
\bottomrule
\end{tabular}

The consistency metric can be calculated in the same way as for the original model, but just using the uvc_consistency_metric function instead of vco_consistency_metric.