bw_graph_tools.graph_traversal.utils
Classes
Class which caches expensive linear algebra solution vectors. |
|
Custom counter to have easy access to current value |
Functions
|
Get input matrix indices and amounts for a given activity. Ignores the reference production |
Module Contents
- class bw_graph_tools.graph_traversal.utils.CachingSolver(lca: bw2calc.LCA)[source]
Class which caches expensive linear algebra solution vectors.
- add_to_cache(index: int, result: numpy.ndarray) None[source]
Store a pre-computed supply vector. Result must be for a demand amount of 1.
- class bw_graph_tools.graph_traversal.utils.Counter[source]
Custom counter to have easy access to current value
- bw_graph_tools.graph_traversal.utils.get_demand_vector_for_activity(node: bw_graph_tools.graph_traversal.graph_objects.Node, skip_coproducts: bool, matrix: scipy.sparse.spmatrix)[source]
Get input matrix indices and amounts for a given activity. Ignores the reference production exchanges and optionally other co-production exchanges.
- Parameters:
node (Node) – Activity whose inputs we are iterating over
skip_coproducts (bool) – Whether or not to ignore positive production exchanges other than the reference product, which is always ignored
matrix (scipy.sparse.spmatrix) – Technosphere matrix
- Returns:
row indices (list) – Integer row indices for products consumed by Node
amounts (list) – The amount of each product consumed, scaled to Node.supply_amount. Same order as row indices.