@@ -46,23 +46,23 @@ def get_lca(fu, method):
4646 return lca
4747
4848
49- def filter_technosphere_exchanges (fu , method , cutoff = 0.05 , max_calc = 1000 ):
49+ def filter_technosphere_exchanges (lca , cutoff = 0.05 , max_calc = 1000 ):
5050 """Use brightway's GraphTraversal to identify the relevant
5151 technosphere exchanges in a non-stochastic LCA."""
5252 start = time ()
53- res = NewNodeEachVisitGraphTraversal .calculate (fu , method , cutoff = cutoff , max_calc = int (max_calc ))
53+ res = NewNodeEachVisitGraphTraversal .calculate (lca , cutoff = cutoff , max_calc = int (max_calc ))
5454
5555 # get all edges
5656 technosphere_exchange_indices = []
5757 for e in res ["edges" ]:
58- if e [ "to" ] != - 1 : # filter out head introduced in graph traversal
59- technosphere_exchange_indices .append ((e [ "from" ] , e [ "to" ] ))
58+ if e . consumer_index != - 1 : # filter out head introduced in graph traversal
59+ technosphere_exchange_indices .append ((e . producer_index , e . consumer_index ))
6060 log .info (
6161 "TECHNOSPHERE {} filtering resulted in {} of {} exchanges and took {} iterations in {} seconds." .format (
62- res [ " lca" ] .technosphere_matrix .shape ,
62+ lca .technosphere_matrix .shape ,
6363 len (technosphere_exchange_indices ),
64- res [ " lca" ] .technosphere_matrix .getnnz (),
65- res ["counter " ],
64+ lca .technosphere_matrix .getnnz (),
65+ res ["calculation_count " ],
6666 np .round (time () - start , 2 ),
6767 )
6868 )
@@ -348,7 +348,7 @@ def perform_GSA(
348348 # technosphere
349349 if self .mc .include_technosphere :
350350 self .t_indices = filter_technosphere_exchanges (
351- self .fu , self . method , cutoff = cutoff_technosphere , max_calc = 1e4
351+ self .lca , cutoff = cutoff_technosphere , max_calc = 1e4
352352 )
353353 self .t_exchanges , self .t_indices = get_exchanges (self .lca , self .t_indices )
354354 self .dft = get_exchanges_dataframe (self .t_exchanges , self .t_indices )
0 commit comments