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
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:
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)
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:
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
The value of $\xi_2 = 65$ %, indicating that the two sets of parameters are inconsistent for this data set.
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)
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
.