apparun.impact_model#
Classes#
Impact model contains all the information required to compute the impact of an |
|
Information about a LCA practitioner. |
|
Information about LCA study, in order to understand its scope and for |
|
Contain information various information about the context of production of the |
Module Contents#
- class apparun.impact_model.ImpactModel#
Bases:
pydantic.BaseModel
Impact model contains all the information required to compute the impact of an LCA built with Appa Build.
- static from_dict(impact_model: dict) ImpactModel #
Convert dict to ImpactModel object. :param impact_model: dict containing construction parameters of the impact model. :return: constructed impact model.
- from_tree_children() List[ImpactModel] #
Create a new impact model for each of Impact Model tree root node’s children. Parameters of the impact model are copied, so unused parameters can remain in newly created impact models. :return: a list of newly created impact models.
- static from_yaml(filepath: str) ImpactModel #
Convert a yaml file to an ImpactModel object. :param filepath: yaml file containing construction parameters of the impact model. :return: constructed impact model.
- get_nodes_scores(by_property: str | None = None, **params) List[apparun.tree_node.NodeScores] #
Get impact scores of the each node for each impact method, according to the parameters. :param by_property: if different than None, results will be pooled by nodes sharing the same property value. Property name is the value of by_property. :param params: value, or list of values of the impact model’s parameters. List of values must have the same length. If single values are provided alongside a list of values, it will be duplicated to the appropriate length. :return: a list of dict mapping impact names and corresponding score, or list of scores, for each node/property value.
- get_scores(**params) apparun.score.LCIAScores #
Get impact scores of the root node for each impact method, according to the parameters. :param params: value, or list of values of the impact model’s parameters. List of values must have the same length. If single values are provided alongside a list of values, it will be duplicated to the appropriate length. :return: a dict mapping impact names and corresponding score, or list of scores.
- get_sobol_s1_indices(n, all_nodes: bool = False) List[Dict[str, str | numpy.ndarray]] #
Get sobol first indices, which corresponds to the contribution of each parameter to total result variance. :param n: number of samples to draw with monte carlo. :param all_nodes: if True, sobol s1 indices will be computed for each node. Else, only for root node (FU). :return: unpivoted dataframe containing sobol first indices for each parameter, impact method, and node name if all_nodes is True.
- get_uncertainty_nodes_scores(n) List[apparun.tree_node.NodeScores] #
- get_uncertainty_scores(n) apparun.score.LCIAScores #
- to_dict()#
Convert self to dict. :return: self as a dict
- to_yaml(filepath: str, compile_models: bool = True)#
Convert self to yaml file. :param filepath: filepath of the yaml file to create. :param compile_models: if True, all models in tree nodes will be compiled. ImpactModel will be bigger, but its execution will be faster at first use.
- transform_parameters(parameters: Dict[str, List[str | float] | str | float]) Dict[str, List[str | float] | str | float] #
Transform all the parameters’ values, so it can be fed into a node’s compute method. See ImpactModelParam’s transform methods for more information. :param parameters: a dict mapping parameters’ name and parameters’ value, or list of values. :return: a dict mapping parameters’ name and parameters’ transformed value, or list of transformed values.
- metadata: ModelMetadata | None = None#
- property name#
- parameters: apparun.parameters.ImpactModelParams | None = None#
- property transformation_table: Dict[str, Callable[[str | float], Dict[str, float]]]#
Map each parameter to its transform method. :return: a dict mapping impact model’s parameters’ name with their transform method.
- tree: apparun.impact_tree.ImpactTreeNode | None = None#
- class apparun.impact_model.LcaPractitioner#
Bases:
pydantic.BaseModel
Information about a LCA practitioner.
- mail: str | None = None#
- name: str | None = None#
- organization: str | None = None#
- class apparun.impact_model.LcaStudy#
Bases:
pydantic.BaseModel
Information about LCA study, in order to understand its scope and for reproducibility.
- appabuild_version: str | None = None#
- date: str | None = None#
- description: str | None = None#
- license: str | None = None#
- link: str | None = None#
- version: str | None = None#
- class apparun.impact_model.ModelMetadata#
Bases:
pydantic.BaseModel
Contain information various information about the context of production of the impact model.
- static from_dict(model_metadata: dict) ModelMetadata #
Convert dict to ModelMetadata object. :param model_metadata: dict containing construction parameters of the model metadata. :return: constructed model metadata.
- to_dict()#
Convert self to dict. :return: self as a dict
- author: LcaPractitioner | None = None#
- reviewer: LcaPractitioner | None = None#