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
  • times (array[float]) – Times for each data point where times[n] corresponds to data[n]

  • data (array[Dict[str, float]]) – Data points where data[n] corresponds to times[n]

clear() None#

Clear the SimResult

equals(other: progpy.sim_result.SimResult) bool#

New in version 1.5.0.

Compare 2 SimResults

Parameters

other (SimResult) –

Returns

If the two SimResults are equal

Return type

bool

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

frame_is_empty() bool#

New in version 1.5.0.

Returns

If the value has been calculated

Return type

bool

property iloc#

New in version 1.5.0.

returns the iloc indexer

index(other: dict, *args, **kwargs) int#

Get the index of the first sample where other occurs

Parameters

other (dict) –

Returns

Index of first sample where other occurs

Return type

int

index_of_data(other: dict, *args, **kwargs) int#

Get the index of the first sample where other occurs

Parameters

other (dict) –

Returns

Index of first sample where other occurs

Return type

int

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

float

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

pop(index: int = - 1) dict#

Remove and return an element

Parameters

index (int, optional) – Index of element to be removed. Defaults to -1.

Returns

Element Removed

Return type

dict

pop_by_index(index: int = - 1) dict#

Remove and return an element

Parameters

index (int, optional) – Index of element to be removed. Defaults to -1.

Returns

Element Removed

Return type

dict

remove(d: dict = None, t: float = None) None#

Remove an element

Parameters
  • d – Data value to be removed.

  • t – Time value to be removed.

time(index: int) float#

Get time for data point at index index

Parameters

index (int) –

Returns

Time for which the data point at index index corresponds

Return type

float

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