Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: brightway-lca/brightway2-calc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.0.1
Choose a base ref
...
head repository: brightway-lca/brightway2-calc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.0.2
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Mar 21, 2025

  1. Fix #119

    cmutel committed Mar 21, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    fpletz Franz Pletz
    Copy the full SHA
    742549c View commit details
  2. 2.0.2

    cmutel committed Mar 21, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    fpletz Franz Pletz
    Copy the full SHA
    a51ac18 View commit details
Showing with 18 additions and 2 deletions.
  1. +4 −0 CHANGES.md
  2. +1 −1 bw2calc/__init__.py
  3. +1 −1 bw2calc/lca_base.py
  4. +12 −0 tests/multi_lca.py
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# `bw2calc` Changelog

# 2.0.2 (2025-03-21)

* Fix [#110](https://github.com/brightway-lca/brightway2-calc/issues/119): Method `invert_technosphere_matrix` crashes with multi LCA

# 2.0.1 (2024-12-10)

* Update `matrix_utils` dependency
2 changes: 1 addition & 1 deletion bw2calc/__init__.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"MultiLCA",
]

__version__ = "2.0.1"
__version__ = "2.0.2"


import platform
2 changes: 1 addition & 1 deletion bw2calc/lca_base.py
Original file line number Diff line number Diff line change
@@ -245,7 +245,7 @@ def invert_technosphere_matrix(self):
See `Intel forum <https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/ How-to-find-inverse-of-a-sparse-matrix-using-pardiso/m-p/1165970#M28249>`__
for a discussion on why we use this approach.""" # noqa: E501
assert hasattr(self, "inventory"), "Must do lci first"
assert hasattr(self, "technosphere_matrix"), "Must load lci data first"

if not PYPARDISO:
warnings.warn(
12 changes: 12 additions & 0 deletions tests/multi_lca.py
Original file line number Diff line number Diff line change
@@ -630,3 +630,15 @@ def test_pass_full_methodconfig(dps, func_units):
== 3 * (3 * 10 + 1 * 10) * 84
)
assert mlca.scores[(("w", "1"), ("n", "1"), ("first", "category"), "γ")] == 3 * 42


def test_inventory_matrix_inversion(dps, config, func_units):
mlca = MultiLCA(demands=func_units, method_config=config, data_objs=dps)
with pytest.raises(AssertionError):
mlca.invert_technosphere_matrix()

mlca.load_lci_data()

result = mlca.invert_technosphere_matrix()
assert isinstance(result, np.ndarray)
assert result.sum()