SimResult#
- class progpy.sim_result.SimResult(times: list = None, data: list = None, _copy=True)#
SimResult is a data structure for the results of a simulation, with time. It is returned from the simulate_to* methods for inputs, outputs, states, and event_states for the beginning and ending time step of the simulation, plus any save points indicated by the savepts and save_freq configuration arguments. The class includes methods for analyzing, manipulating, and visualizing the results of the simulation.
- Parameters
- equals(other: progpy.sim_result.SimResult) bool #
New in version 1.5.0.
Compare 2 SimResults
- extend(other: progpy.sim_result.SimResult) None #
Extend the SimResult with another SimResult or LazySimResult object
- Parameters
other (SimResult/LazySimResult) –
- property frame: pandas.core.frame.DataFrame#
New in version 1.5.0.
pd.DataFrame: A pandas DataFrame representing the SimResult data
- property iloc#
New in version 1.5.0.
returns the iloc indexer
- index_of_data(other: dict, *args, **kwargs) int #
Get the index of the first sample where other occurs
- iterrows()#
New in version 1.5.0: Iterates – through keys
- monotonicity() Dict[str, float] #
Calculate monotonicty for a single prediction. Given a single simulation result, for each event: go through all predicted states and compare those to the next one. Calculates monotonicity for each event key using its associated mean value in UncertainData.
Where N is number of measurements and sign indicates sign of calculation.
Coble, J., et. al. (2021). Identifying Optimal Prognostic Parameters from Data: A Genetic Algorithms Approach. Annual Conference of the PHM Society. http://www.papers.phmsociety.org/index.php/phmconf/article/view/1404 Baptistia, M., et. al. (2022). Relation between prognostics predictor evaluation metrics and local interpretability SHAP values. Artificial Intelligence, Volume 306. https://www.sciencedirect.com/science/article/pii/S0004370222000078
- Parameters
None –
- Returns
Value between [0, 1] indicating monotonicity of a given event for the Prediction.
- Return type
- plot(**kwargs) matplotlib.pyplot.figure #
Plot the simresult as a line plot
- Keyword Arguments
keys (list[str]) – list of keys to plot. If not provided, all keys in the series are plotted.
figsize (tuple[float, float]) – width and height of the figure
compact (bool) – If true, all timeseries are displayed in one plot (multiple colored lines)
xlabel (str) – label for the x-axis. Default is ‘time’
ylabel (str) – label for the y-axis. Default is ‘state’
title (str) – plot title. Default is no title
title_fontsize (str or float) – plot title fontsize. Default is ‘x-large’
suptitle (str) – plot suptitle. Default is no suptitle
ticklabel_fontsize (str or float) – tick label font sizes. Default is ‘small’
tight_layout (bool) – whether to use tight layout (minimize figure blank space around the graph)
display_labels (str) – whether to display x and y-labels in the figure ([‘no’, ‘minimal’, ‘all’])
- Returns
Figure
- remove(d: dict = None, t: float = None) None #
Remove an element
- Parameters
d – Data value to be removed.
t – Time value to be removed.
- to_numpy(keys=None) numpy.ndarray #
Convert from simresult to numpy array
- Parameters
keys – Subset of keys to return as part of numpy array (by default, all)
- Returns
numpy array representing simresult
- Return type
np.ndarray