Skip to content

Commit

Permalink
Black reformating
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Mar 28, 2024
1 parent ab5b6b1 commit 568462f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pathways/lca.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ def get_lca_matrices(
indices_array=a_indices,
data_array=a_data,
flip_array=a_sign,
distributions_array= a_distributions,
distributions_array=a_distributions,
)

dp.add_persistent_vector(
matrix="biosphere_matrix",
indices_array=b_indices,
data_array=b_data,
flip_array=b_sign,
distributions_array= b_distributions,
distributions_array=b_distributions,
)

return dp, A_inds, B_inds
Expand Down Expand Up @@ -222,7 +222,10 @@ def fill_characterization_factors_matrices(

return matrix

def remove_double_counting(characterized_inventory: csr_matrix, vars_info: dict, activity_idx: int) -> csr_matrix:

def remove_double_counting(
characterized_inventory: csr_matrix, vars_info: dict, activity_idx: int
) -> csr_matrix:
"""
Remove double counting from a characterized inventory matrix for all activities except
the activity being evaluated, across all methods.
Expand All @@ -237,7 +240,9 @@ def remove_double_counting(characterized_inventory: csr_matrix, vars_info: dict,
if isinstance(characterized_inventory, np.ndarray):
characterized_inventory = csr_matrix(characterized_inventory)
elif not isinstance(characterized_inventory, csr_matrix):
raise TypeError("characterized_inventory must be a csr_matrix or a numpy array.")
raise TypeError(
"characterized_inventory must be a csr_matrix or a numpy array."
)

# Gather all indices for which we want to avoid double counting, except the evaluated activity
list_of_idx_to_remove = []
Expand All @@ -255,4 +260,3 @@ def remove_double_counting(characterized_inventory: csr_matrix, vars_info: dict,
characterized_inventory[:, idx] = 0

return characterized_inventory.tocsr()

0 comments on commit 568462f

Please sign in to comment.