apparun.results#

Attributes#

Classes#

ImpactModelResult

An impact model result is one, or a collection of tables and/or figures generated

NodesSobolIndexResult

NodesUncertaintyResult

Generate uncertainty for each node using Monte Carlo. Result figure as a boxplot.

SankeyDiagramResult

Generate a Sankey diagram for each impact, representing the contribution of all

SobolIndexResult

Generate sobol S1 index for each impact as a heatmap. Sobol S1 indices represent

TreeMapResult

Generate a TreeMap for each impact, representing the contribution of all nodes to

UncertaintyResult

An impact model result is one, or a collection of tables and/or figures generated

Functions#

get_result(result_name)

Get a registered ImpactModelResult class by name.

register_result(result_name)

This decorator registers a new ImpactModelResult class in RESULTS registry.

registered_results(→ List[str])

Get a list of registered ImpactModelResult names.

Module Contents#

class apparun.results.ImpactModelResult#

Bases: pydantic.BaseModel

An impact model result is one, or a collection of tables and/or figures generated by executing an impact model.

get_figure(table: pandas.DataFrame)#

Abstract method. Generate the output as a figures, or a collection of figures, using the output of the get_table method. :param table: tabular result data. :return: figure, or collection of figure generated.

get_table() pandas.DataFrame | pandas.Series#

Abstract method. Generate the output as a table, or a collection of tables. :return: tabular results as a pandas DataFrame.

run()#

Execute the result to generate wanted outputs.

save_figure(fig, name_suffix=None)#

Save a figure to disk, according to the configuration specified in result attributes. :param fig: figure to save :param name_suffix: optional file name suffix.

height: int | None = None#
html_save_path: str | None = None#
impact_model: apparun.impact_model.ImpactModel#
output_name: str#
pdf_save_path: str | None = None#
png_save_path: str | None = None#
table_save_path: str | None = None#
width: int | None = None#
class apparun.results.NodesSobolIndexResult#

Bases: ImpactModelResult

get_figure(table: pandas.DataFrame)#

Abstract method. Generate the output as a figures, or a collection of figures, using the output of the get_table method. :param table: tabular result data. :return: figure, or collection of figure generated.

get_table() pandas.DataFrame#

Abstract method. Generate the output as a table, or a collection of tables. :return: tabular results as a pandas DataFrame.

n: int#
parameters: dict[str, float | str] | None = None#
class apparun.results.NodesUncertaintyResult#

Bases: ImpactModelResult

Generate uncertainty for each node using Monte Carlo. Result figure as a boxplot.

get_figure(table: pandas.DataFrame)#

Display uncertainty result of each node with boxplots, one figure per impact. :param table: results of each draw for each node as a long format table :return: all figures generated

get_table() pandas.DataFrame#

Run monte carlo simulation for each node, get all values as a long format table. :return: results of each draw for each node as a long format table

n: int#
class apparun.results.SankeyDiagramResult#

Bases: ImpactModelResult

Generate a Sankey diagram for each impact, representing the contribution of all nodes to the root node result. See https://plotly.com/python/sankey-diagram/ for more information.

get_figure(table: pandas.DataFrame) List[plotly.graph_objects.Figure]#

Generate one distinct Sankey diagram per impact method. Save figure(s) to disk, according to the configuration specified in result attributes. :param table: tabular sankey result data. :return: figure, or collection of figure generated.

get_table() pandas.DataFrame#

Generate Sankey output as a table, or a collection of tables. Save it to disk according to configuration specified in result attributes. :return: tabular results as a pandas DataFrame.

parameters: dict[str, float | str] | None#
class apparun.results.SobolIndexResult#

Bases: ImpactModelResult

Generate sobol S1 index for each impact as a heatmap. Sobol S1 indices represent the first order contribution of each model’s parameter to the score variance. See https://plotly.com/python/sankey-diagram/ for more information.

get_figure(table: pandas.DataFrame)#

Generate a heatmap for S1 sobol indices of each model’s parameter, and for each impact method. Save figure(s) to disk, according to the configuration specified in result attributes. :param table: tabular sankey result data. :return: figure, or collection of figure generated.

get_table() pandas.DataFrame#

Generate sobol S1 indices. Save it to disk according to configuration specified in result attributes. :return: tabular results as a pandas DataFrame.

n: int#
parameters: dict[str, float | str] | None = None#
class apparun.results.TreeMapResult#

Bases: ImpactModelResult

Generate a TreeMap for each impact, representing the contribution of all nodes to the root node result. See https://plotly.com/python/treemaps/ for more information.

get_figure(table: pandas.DataFrame)#

Generate one distinct treemap per impact method. Save figure(s) to disk, according to the configuration specified in result attributes. :param table: tabular treemap result data. :return: figure, or collection of figure generated.

get_table() pandas.DataFrame#

Generate treemap output as a table, or a collection of tables. Save it to disk according to configuration specified in result attributes. :return: tabular results as a pandas DataFrame.

parameters: dict[str, float | str] | None#
class apparun.results.UncertaintyResult#

Bases: ImpactModelResult

An impact model result is one, or a collection of tables and/or figures generated by executing an impact model.

get_figure(table: pandas.DataFrame)#

Display uncertainty result of FU with boxplot, one figure per impact. :param table: results of each draw for each node as a long format table :return: all figures generated

get_table() pandas.DataFrame#

Run monte carlo simulation for FU, get all values as a long format table. :return: results of each draw as a long format table

n: int#

Generate uncertainty for FU using Monte Carlo. Result figure as a boxplot.

apparun.results.get_result(result_name: str)#

Get a registered ImpactModelResult class by name. :param result_name: registered name of the desired ImpactModelResult. :return: registered ImpactModelResult class corresponding to the name.

apparun.results.register_result(result_name)#

This decorator registers a new ImpactModelResult class in RESULTS registry. :param result_name: name of the new result to register :return: new ImpactModelResult class

apparun.results.registered_results() List[str]#

Get a list of registered ImpactModelResult names. :return: list of registered ImpactModelResult names.

apparun.results.RESULTS#