Linked Meta-Process¶
- class linkedmetaprocess.LinkedMetaProcessSystem(mp_list=None)¶
A linked meta-process system holds several interlinked meta-processes. It has methods for:
- loading / saving linked meta-process systems
- returning information, e.g. product and process names, the product-process matrix
- determining all alternatives to produce a given functional unit
- calculating LCA results for individual meta-processes
- calculating LCA results for a demand from the linked meta-process system (possibly for all alternatives)
Meta-processes cannot contain:
- 2 processes with the same name
- identical names for products and processes (recommendation is to capitalize process names)
Args:
- mp_list ([MetaProcess]): A list of meta-processes
- add_mp(mp_list, rename=False)¶
Adds meta-processes to the linked meta-process system.
mp_list can contain meta-process objects or the original data format used to initialize meta-processes.
- all_pathways(functional_unit)¶
Returns all alternative pathways to produce a given functional unit. Data output is a list of lists. Each sublist contains one path made up of products and processes. The input Graph may not contain cycles. It may contain multi-output processes.
Args:
- functional_unit: output product
- edges(mp_list=None)¶
Returns an edge list for all edges within the linked meta-process system.
mp_list can be a list of meta-process objects or meta-process names.
- get_cut_names(mp_list=None)¶
Returns cut/input product names for a list of meta-processes.
- get_output_names(mp_list=None)¶
Returns output product names for a list of meta-processes.
- get_pp_matrix(mp_list=None)¶
Returns the product-process matrix as well as two dictionaries that hold row/col values for each product/process.
mp_list can be used to limit the scope to the contained processes
- get_process_names(mp_list=None)¶
Returns a the names of a list of meta-processes.
- get_processes(mp_list=None)¶
Returns a list of meta-processes.
mp_list can be a list of meta-process objects or meta-process names.
- get_product_names(mp_list=None)¶
Returns the output and input product names of a list of meta-processes.
mp_list can be a list of meta-process objects or meta-process names.
- lca_alternatives(method, demand)¶
Calculation of LCA results for all alternatives in a linked meta-process system that yield a certain demand. Results are stored in a list of dictionaries as described in ‘lca_linked_processes’.
Args:
- method: LCIA method
- demand (dict): keys: product names, values: amount
- lca_linked_processes(method, process_names, demand)¶
Performs LCA for a given demand from a linked meta-process system. Works only for square matrices (see scaling_vector_foreground_demand).
Returns a dictionary with the following keys:
- path: involved process names
- demand: product demand
- scaling vector: result of the demand
- LCIA method: method used
- process contribution: contribution of each process
- relative process contribution: relative contribution
- LCIA score: LCA result
Args:
- method: LCIA method
- process_names: selection of processes from the linked meta-process system (that yields a square matrix)
- demand (dict): keys: product names, values: amount
- lca_processes(method, process_names=None, factorize=False)¶
Returns a dictionary where keys = meta-process name, value = LCA score
- load_from_file(filepath, append=False)¶
Loads a meta-process database, makes a MetaProcess object from each meta-process and adds them to the linked meta-process system.
Args:
- filepath: file path
- append: adds loaded meta-processes to the existing database if True
- processes¶
Returns all process names.
- product_process_dict(mp_list=None, process_names=None, product_names=None)¶
Returns a dictionary that maps meta-processes to produced products (key: product, value: meta-process). Optional arguments mp_list, process_names, product_names can used as filters.
- products¶
Returns all product names.
- remove_mp(mp_list)¶
Remove meta-processes from the linked meta-process system.
mp_list can be a list of meta-process objects or meta-process names.
- save_to_file(filepath)¶
Saves data for each meta-process in the meta-process data format using pickle and updates the linked meta process system.
- scaling_vector_foreground_demand(mp_list, demand)¶
Returns a scaling dictionary for a given demand and matrix defined by a list of processes (or names). Keys: process names. Values: scaling vector values.
Args:
- mp_list: meta-process objects or names
- demand (dict): keys: product names, values: amount
- update(mp_list)¶
Updates the linked meta-process system every time processes are added, modified, or deleted. Errors are thrown in case of:
- identical names for products and processes
- identical names of different meta-processes
- if the input is not of type MetaProcess()
- update_name_map()¶
Updates the name map, which maps product names (outputs or cuts) to activity keys. This is used in the Activity Browser to automatically assign a product name to already known activity keys.
- upstream_products_processes(product)¶
Returns all upstream products and processes related to a certain product (functional unit).