fault_injector.FaultVisualizer module
plotting class
- class fault_injector.visualizer.FaultVisualizer(font_size: int = 16, plot_size=(10, 4), colors_dict: dict = None)[source]
Bases:
objectThis class is designed to make it easier to plot and compare faulty data to its original data.
- Parameters:
font_size (int, optional) – controls the fault size in the plots. Defaults to 16.
plot_size (tuple, optional) – controls the plot/fig size. Defaults to (10, 4).
colors_dict (dict, optional) – dictionary that controls the colors used in the plot. Defaults to original being blue, new being red, and delta being purple.
- plot_fault_delta(original_values: ndarray, new_values: ndarray, title: str = None, file_name: str = None)[source]
Plot the fault delta (new - original)
- Parameters:
original_values (np.ndarray) – array of numeric values used to represent the original/true values
new_values (np.ndarray) – array of numeric values used to represent the fault values
title (str, optional) – used as the title in the plot. Defaults to None.
file_name (str, optional) – file name when saving the figure. When not equal to None, the plot will be saved. Defaults to None.
- plot_fault_delta_df(original_df: DataFrame, new_df: DataFrame, title: str = None, file_name: str = None)[source]
Plot all of the columns in the dataframes
- Parameters:
original_df (pd.DataFrame) – original values
new_df (pd.DataFrame) – new values
title (str, optional) – base of plot titles. Defaults to None.
file_name (str, optional) – base of the file name. Defaults to None.
- plot_comparison(original_values: ndarray, new_values: ndarray, title: str = None, file_name: str = None)[source]
Plot original values and new values
- Parameters:
original_values (np.ndarray) – _description_
new_values (np.ndarray) – _description_
title (str, optional) – _description_. Defaults to None.
file_name (str, optional) – _description_. Defaults to None.
- plot_comparison_df(original_df: DataFrame, new_df: DataFrame, title: str = None, file_name: str = None)[source]
Plot all of the columns in the dataframes
- Parameters:
original_df (pd.DataFrame) – original values
new_df (pd.DataFrame) – new values
title (str, optional) – base of plot titles. Defaults to None.
file_name (str, optional) – base of the file name. Defaults to None.