lca-algebraic-bw25 1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. lca_algebraic_bw25-1.3/LICENSE +25 -0
  2. lca_algebraic_bw25-1.3/PKG-INFO +139 -0
  3. lca_algebraic_bw25-1.3/README.md +110 -0
  4. lca_algebraic_bw25-1.3/lca_algebraic/__init__.py +42 -0
  5. lca_algebraic_bw25-1.3/lca_algebraic/activity.py +775 -0
  6. lca_algebraic_bw25-1.3/lca_algebraic/axis_dict.py +79 -0
  7. lca_algebraic_bw25-1.3/lca_algebraic/base_utils.py +184 -0
  8. lca_algebraic_bw25-1.3/lca_algebraic/cache.py +108 -0
  9. lca_algebraic_bw25-1.3/lca_algebraic/database.py +188 -0
  10. lca_algebraic_bw25-1.3/lca_algebraic/interpolation.py +116 -0
  11. lca_algebraic_bw25-1.3/lca_algebraic/io.py +61 -0
  12. lca_algebraic_bw25-1.3/lca_algebraic/lca.py +1066 -0
  13. lca_algebraic_bw25-1.3/lca_algebraic/log.py +24 -0
  14. lca_algebraic_bw25-1.3/lca_algebraic/methods.py +70 -0
  15. lca_algebraic_bw25-1.3/lca_algebraic/params.py +1298 -0
  16. lca_algebraic_bw25-1.3/lca_algebraic/settings.py +4 -0
  17. lca_algebraic_bw25-1.3/lca_algebraic/stats.py +1368 -0
  18. lca_algebraic_bw25-1.3/lca_algebraic/units.py +252 -0
  19. lca_algebraic_bw25-1.3/lca_algebraic_bw25.egg-info/PKG-INFO +139 -0
  20. lca_algebraic_bw25-1.3/lca_algebraic_bw25.egg-info/SOURCES.txt +25 -0
  21. lca_algebraic_bw25-1.3/lca_algebraic_bw25.egg-info/dependency_links.txt +1 -0
  22. lca_algebraic_bw25-1.3/lca_algebraic_bw25.egg-info/requires.txt +15 -0
  23. lca_algebraic_bw25-1.3/lca_algebraic_bw25.egg-info/top_level.txt +1 -0
  24. lca_algebraic_bw25-1.3/pyproject.toml +64 -0
  25. lca_algebraic_bw25-1.3/setup.cfg +4 -0
  26. lca_algebraic_bw25-1.3/test/test_axis_dict.py +74 -0
  27. lca_algebraic_bw25-1.3/test/test_units.py +136 -0
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2020, OIE - Mines ParisTech
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: lca_algebraic_bw25
3
+ Version: 1.3
4
+ Summary: This library provides a layer above brightway2 for defining parametric models and running super fast LCA for monte carlo analysis.
5
+ Author-email: OIE - Mines ParisTech <raphael.jolivet@mines-paristech.fr>
6
+ License: BSD
7
+ Project-URL: Homepage, https://lca-algebraic.readthedocs.io/en/stable/
8
+ Project-URL: Repository, https://github.com/oie-mines-paristech/lca_algebraic.git
9
+ Project-URL: Documentation, https://lca-algebraic.readthedocs.io/
10
+ Project-URL: Changelog, https://github.com/oie-mines-paristech/lca_algebraic/blob/main/RELEASE_NOTES.md
11
+ Keywords: LCA,brightway2,monte-carlo,parametric
12
+ Requires-Python: <3.13,>=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: tabulate
16
+ Requires-Dist: ipywidgets
17
+ Requires-Dist: pandas
18
+ Requires-Dist: pyarrow
19
+ Requires-Dist: seaborn
20
+ Requires-Dist: sympy
21
+ Requires-Dist: matplotlib
22
+ Requires-Dist: deprecation
23
+ Requires-Dist: brightway25
24
+ Requires-Dist: SALib
25
+ Requires-Dist: pint
26
+ Requires-Dist: typing-extensions
27
+ Requires-Dist: pypardiso; platform_machine == "x86_64"
28
+ Dynamic: license-file
29
+
30
+
31
+
32
+ <img src="./doc/source/_static/img/logo_lca_algebraic.png" alt="logo" width="200" style="margin:auto;display:block"/>
33
+
34
+
35
+ ![Python 3.10](https://img.shields.io/badge/python-3.10-blue)
36
+ ![Python 3.11](https://img.shields.io/badge/python-3.11-blue)
37
+ ![Python 3.12](https://img.shields.io/badge/python-3.12-blue)
38
+
39
+ [![Brightway 2.4](https://img.shields.io/badge/brightway-2.4-blue)](https://docs.brightway.dev/en/legacy/index.html)
40
+ [![Brightway 2.5](https://img.shields.io/badge/brightway-2.5-blue)](https://docs.brightway.dev/en/latest/)
41
+
42
+ **lca_algebraic** is a layer above [**Brightway**](https://brightway.dev/) designed for the definition of **parametric inventories**
43
+ with fast computation of LCA impacts, suitable for **monte-carlo** / global sensitivity analysis
44
+
45
+ It integrates the magic of [Sympy](https://www.sympy.org/en/index.html) in order to write parametric formulas as regular Python expressions.
46
+
47
+ **lca-algebraic** provides a set of **helper functions** for :
48
+ * **compact** & **human readable** definition of activities :
49
+ * search background (tech and biosphere) activities
50
+ * create new foreground activities with parametrized amounts
51
+ * parametrize / update existing background activities (extending the class **Activity**)
52
+ * Definition of parameters
53
+ * Fast computation of LCAs
54
+ * Computation of monte carlo method and global sensitivity analysis (Sobol indices)
55
+ * Support for automatic check of [homogeneity of physical units](https://lca-algebraic.readthedocs.io/en/stable/api/units.html)
56
+
57
+ # ⚙ Installation
58
+
59
+ We support both [Brightway 2.4 (legacy)](https://docs.brightway.dev/en/legacy/index.html)
60
+ and [Brightway 2.5](https://docs.brightway.dev/en/latest/) via two separate branches / libraries :
61
+
62
+ * [lca_algebraic](https://pypi.org/project/lca-algebraic/) (for Brightway 2.4)
63
+ * [lca_algebraic_bw25](https://pypi.org/project/lca-algebraic/) (for Brightway 2.5)
64
+
65
+ ## 1) Setup separate environment
66
+
67
+ First create a python environment, with **Python** [>=3.10, <3.13] :
68
+
69
+ **With Conda (or [mamba](https://mamba.readthedocs.io/en/latest/index.html))**
70
+
71
+ ```bash
72
+ conda create -n lca python==3.10
73
+ conda activate lca
74
+ ```
75
+
76
+ **With virtual env**
77
+
78
+ ```bash
79
+ python3.10 -m venv .venv
80
+ source .venv/bin/activate
81
+ ```
82
+
83
+ ## 2) Install lca_algebraic
84
+
85
+ > pip install lca_algebraic
86
+
87
+ Or, for brightway 25 :
88
+
89
+ > pip install lca_algebraic_bw25
90
+
91
+ ## 3) [Optional] Install Jupyter & Activity Browser
92
+
93
+ You may also install Jupyter and [Activity Browser](https://github.com/LCA-ActivityBrowser/activity-browser) on the same
94
+ environment.
95
+
96
+ **Jupyter** :
97
+ > pip install jupyter
98
+
99
+ **Activity Browser** can only be installed via conda/mamba. Note that it can also be installed on a separate Python env and will
100
+ still be able to access and browse the projects created programmatically with *lca_algebraic* / *Brightway*.
101
+ > conda install activity-browser
102
+
103
+ > **NOTE**
104
+ > While the inventories created in *lca_algebraic* are stored in the Brightway project,
105
+ > the formulas and parameters are not compatible with **Activity Browser**
106
+ > Before computing impacts with vanilla **Brightway2** or **Activity Browser**,
107
+ > you may use the function [freezeParams()](https://lca-algebraic.readthedocs.io/en/stable/api/parameters.html#lca_algebraic.freezeParams)
108
+ > to update the amounts in your database for a given scenario / set of parameter values.
109
+
110
+
111
+
112
+ # 📚 Documentation & resources
113
+
114
+ Full documentation is [hosted on **readthedocs**](https://lca-algebraic.readthedocs.io/)
115
+
116
+ We provide some notebooks :
117
+ * [Example notebook](./notebooks/example-notebook.ipynb) : Basic functionalities
118
+ * [Handbook](./notebooks/handbook.ipynb) : More examples, also showing the usage of the Brightway functions.
119
+ * [Workshop](https://git.sophia.mines-paristech.fr/oie/lca-algebraic-workshop) :
120
+ A "real life" exercise used as a short training on *lca_algebraic*
121
+
122
+ # 📧 Mailing list
123
+
124
+ Please register to this dedicated mailing list to discuss the evolutions of this library and be informed of future releases :
125
+
126
+ [lca_algebraic@groupes.mines-paristech.fr](https://groupes.minesparis.psl.eu/wws/subscribe/lca_algebraic)
127
+
128
+
129
+ # © Licence & Copyright
130
+
131
+ This library has been developed by [MinesParis - PSL - O.I.E team](https://www.oie.minesparis.psl.eu/), for the project [*INCER-ACV*](https://librairie.ademe.fr/energies-renouvelables-reseaux-et-stockage/4448-incer-acv.html),
132
+ lead by [ADEME](https://www.ademe.fr/).
133
+
134
+ It is distributed under the [BSD License](./LICENSE)
135
+
136
+ # Logo
137
+
138
+ Please use the following logo to advertise about this librairy.
139
+ ![](./doc/source/_static/img/logo_lca_algebraic.png)
@@ -0,0 +1,110 @@
1
+
2
+
3
+ <img src="./doc/source/_static/img/logo_lca_algebraic.png" alt="logo" width="200" style="margin:auto;display:block"/>
4
+
5
+
6
+ ![Python 3.10](https://img.shields.io/badge/python-3.10-blue)
7
+ ![Python 3.11](https://img.shields.io/badge/python-3.11-blue)
8
+ ![Python 3.12](https://img.shields.io/badge/python-3.12-blue)
9
+
10
+ [![Brightway 2.4](https://img.shields.io/badge/brightway-2.4-blue)](https://docs.brightway.dev/en/legacy/index.html)
11
+ [![Brightway 2.5](https://img.shields.io/badge/brightway-2.5-blue)](https://docs.brightway.dev/en/latest/)
12
+
13
+ **lca_algebraic** is a layer above [**Brightway**](https://brightway.dev/) designed for the definition of **parametric inventories**
14
+ with fast computation of LCA impacts, suitable for **monte-carlo** / global sensitivity analysis
15
+
16
+ It integrates the magic of [Sympy](https://www.sympy.org/en/index.html) in order to write parametric formulas as regular Python expressions.
17
+
18
+ **lca-algebraic** provides a set of **helper functions** for :
19
+ * **compact** & **human readable** definition of activities :
20
+ * search background (tech and biosphere) activities
21
+ * create new foreground activities with parametrized amounts
22
+ * parametrize / update existing background activities (extending the class **Activity**)
23
+ * Definition of parameters
24
+ * Fast computation of LCAs
25
+ * Computation of monte carlo method and global sensitivity analysis (Sobol indices)
26
+ * Support for automatic check of [homogeneity of physical units](https://lca-algebraic.readthedocs.io/en/stable/api/units.html)
27
+
28
+ # ⚙ Installation
29
+
30
+ We support both [Brightway 2.4 (legacy)](https://docs.brightway.dev/en/legacy/index.html)
31
+ and [Brightway 2.5](https://docs.brightway.dev/en/latest/) via two separate branches / libraries :
32
+
33
+ * [lca_algebraic](https://pypi.org/project/lca-algebraic/) (for Brightway 2.4)
34
+ * [lca_algebraic_bw25](https://pypi.org/project/lca-algebraic/) (for Brightway 2.5)
35
+
36
+ ## 1) Setup separate environment
37
+
38
+ First create a python environment, with **Python** [>=3.10, <3.13] :
39
+
40
+ **With Conda (or [mamba](https://mamba.readthedocs.io/en/latest/index.html))**
41
+
42
+ ```bash
43
+ conda create -n lca python==3.10
44
+ conda activate lca
45
+ ```
46
+
47
+ **With virtual env**
48
+
49
+ ```bash
50
+ python3.10 -m venv .venv
51
+ source .venv/bin/activate
52
+ ```
53
+
54
+ ## 2) Install lca_algebraic
55
+
56
+ > pip install lca_algebraic
57
+
58
+ Or, for brightway 25 :
59
+
60
+ > pip install lca_algebraic_bw25
61
+
62
+ ## 3) [Optional] Install Jupyter & Activity Browser
63
+
64
+ You may also install Jupyter and [Activity Browser](https://github.com/LCA-ActivityBrowser/activity-browser) on the same
65
+ environment.
66
+
67
+ **Jupyter** :
68
+ > pip install jupyter
69
+
70
+ **Activity Browser** can only be installed via conda/mamba. Note that it can also be installed on a separate Python env and will
71
+ still be able to access and browse the projects created programmatically with *lca_algebraic* / *Brightway*.
72
+ > conda install activity-browser
73
+
74
+ > **NOTE**
75
+ > While the inventories created in *lca_algebraic* are stored in the Brightway project,
76
+ > the formulas and parameters are not compatible with **Activity Browser**
77
+ > Before computing impacts with vanilla **Brightway2** or **Activity Browser**,
78
+ > you may use the function [freezeParams()](https://lca-algebraic.readthedocs.io/en/stable/api/parameters.html#lca_algebraic.freezeParams)
79
+ > to update the amounts in your database for a given scenario / set of parameter values.
80
+
81
+
82
+
83
+ # 📚 Documentation & resources
84
+
85
+ Full documentation is [hosted on **readthedocs**](https://lca-algebraic.readthedocs.io/)
86
+
87
+ We provide some notebooks :
88
+ * [Example notebook](./notebooks/example-notebook.ipynb) : Basic functionalities
89
+ * [Handbook](./notebooks/handbook.ipynb) : More examples, also showing the usage of the Brightway functions.
90
+ * [Workshop](https://git.sophia.mines-paristech.fr/oie/lca-algebraic-workshop) :
91
+ A "real life" exercise used as a short training on *lca_algebraic*
92
+
93
+ # 📧 Mailing list
94
+
95
+ Please register to this dedicated mailing list to discuss the evolutions of this library and be informed of future releases :
96
+
97
+ [lca_algebraic@groupes.mines-paristech.fr](https://groupes.minesparis.psl.eu/wws/subscribe/lca_algebraic)
98
+
99
+
100
+ # © Licence & Copyright
101
+
102
+ This library has been developed by [MinesParis - PSL - O.I.E team](https://www.oie.minesparis.psl.eu/), for the project [*INCER-ACV*](https://librairie.ademe.fr/energies-renouvelables-reseaux-et-stockage/4448-incer-acv.html),
103
+ lead by [ADEME](https://www.ademe.fr/).
104
+
105
+ It is distributed under the [BSD License](./LICENSE)
106
+
107
+ # Logo
108
+
109
+ Please use the following logo to advertise about this librairy.
110
+ ![](./doc/source/_static/img/logo_lca_algebraic.png)
@@ -0,0 +1,42 @@
1
+ #
2
+ # This file defines several utility functions above brightway2 to be used by notebooks
3
+ #
4
+
5
+ from .activity import *
6
+ from .base_utils import *
7
+ from .database import *
8
+ from .interpolation import *
9
+ from .io import *
10
+ from .lca import *
11
+ from .log import *
12
+ from .methods import *
13
+ from .params import *
14
+ from .settings import Settings
15
+ from .stats import *
16
+ from .units import *
17
+
18
+ # Backport the test of pypardiso from bw2calc to emit a warning
19
+ try:
20
+ from pypardiso import factorized, spsolve
21
+ except ImportError:
22
+ from scipy.sparse.linalg import factorized, spsolve
23
+ from scipy.sparse.linalg._dsolve import linsolve
24
+
25
+ if not linsolve.useUmfpack:
26
+ logger.warn(
27
+ """
28
+ Did not findPypardisio or Umfpack. Matrix computation may be very slow.
29
+
30
+ If you are on an Intel architecture, please install pypardiso as explained in the docs :
31
+ https://docs.brightway.dev/en/latest/content/installation/index.html
32
+
33
+ > pip install pypardiso
34
+ or
35
+ > conda install pypardiso
36
+ """
37
+ )
38
+
39
+
40
+ # Global print options
41
+ np.set_printoptions(threshold=30)
42
+ pd.options.display.float_format = "{:,g}".format