stats-arrays 0.6.6__tar.gz → 0.7.dev8__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.
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/CHANGES.md +5 -0
- stats_arrays-0.7.dev8/CODE_OF_CONDUCT.md +76 -0
- stats_arrays-0.7.dev8/CONTRIBUTING.md +109 -0
- stats_arrays-0.7.dev8/LICENSE +11 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/PKG-INFO +32 -18
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/index.rst +2 -3
- stats_arrays-0.7.dev8/pyproject.toml +106 -0
- stats_arrays-0.7.dev8/stats_arrays/__init__.py +61 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/dataset_statistics.py +6 -5
- stats_arrays-0.7.dev8/stats_arrays/distributions/__init__.py +30 -0
- stats_arrays-0.7.dev8/stats_arrays/distributions/base.py +348 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/distributions/bernoulli.py +14 -10
- stats_arrays-0.7.dev8/stats_arrays/distributions/beta.py +137 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/distributions/discrete_uniform.py +33 -32
- stats_arrays-0.7.dev8/stats_arrays/distributions/extreme.py +40 -0
- stats_arrays-0.7.dev8/stats_arrays/distributions/gamma.py +49 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/distributions/geometric.py +60 -43
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/distributions/lognormal.py +45 -48
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/distributions/normal.py +31 -30
- stats_arrays-0.7.dev8/stats_arrays/distributions/student.py +53 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/distributions/undefined.py +8 -7
- stats_arrays-0.7.dev8/stats_arrays/distributions/weibull.py +44 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/errors.py +0 -8
- stats_arrays-0.7.dev8/stats_arrays/random.py +319 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/uncertainty_choices.py +28 -8
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays/utils.py +15 -14
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays.egg-info/PKG-INFO +33 -19
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays.egg-info/SOURCES.txt +11 -5
- stats_arrays-0.7.dev8/stats_arrays.egg-info/requires.txt +17 -0
- stats_arrays-0.7.dev8/tests/test_base.py +127 -0
- stats_arrays-0.7.dev8/tests/test_choices.py +5 -0
- stats_arrays-0.7.dev8/tests/test_conversions.py +120 -0
- stats_arrays-0.7.dev8/tests/test_lhc.py +515 -0
- stats_arrays-0.7.dev8/tests/test_mc.py +43 -0
- stats_arrays-0.7.dev8/tests/test_rng.py +89 -0
- stats_arrays-0.6.6/LICENSE.txt +0 -29
- stats_arrays-0.6.6/requirements.txt +0 -3
- stats_arrays-0.6.6/setup.py +0 -33
- stats_arrays-0.6.6/stats_arrays/__init__.py +0 -7
- stats_arrays-0.6.6/stats_arrays/distributions/__init__.py +0 -12
- stats_arrays-0.6.6/stats_arrays/distributions/base.py +0 -325
- stats_arrays-0.6.6/stats_arrays/distributions/beta.py +0 -129
- stats_arrays-0.6.6/stats_arrays/distributions/extreme.py +0 -38
- stats_arrays-0.6.6/stats_arrays/distributions/gamma.py +0 -44
- stats_arrays-0.6.6/stats_arrays/distributions/student.py +0 -49
- stats_arrays-0.6.6/stats_arrays/distributions/weibull.py +0 -43
- stats_arrays-0.6.6/stats_arrays/fitting.py +0 -14
- stats_arrays-0.6.6/stats_arrays/random.py +0 -307
- stats_arrays-0.6.6/stats_arrays.egg-info/requires.txt +0 -2
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/MANIFEST.in +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/README.md +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/base.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/bernoulli.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/beta.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/discrete-uniform.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/extreme.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/gamma.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/lognormal.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/normal.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/student.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/triangular.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/uniform.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/distributions/weibull.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/lhc.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/mcrng.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/docs/rng.rst +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/setup.cfg +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays.egg-info/dependency_links.txt +0 -0
- {stats_arrays-0.6.6 → stats_arrays-0.7.dev8}/stats_arrays.egg-info/top_level.txt +0 -0
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# stats_arrays Changelog
|
|
2
2
|
|
|
3
|
+
# 0.7 (2024-08-19)
|
|
4
|
+
|
|
5
|
+
* Moved to `pyproject.toml` packaging and `pytest` tests
|
|
6
|
+
* Numpy 2.0 compatiblity
|
|
7
|
+
|
|
3
8
|
## 0.6.6 (2023-10-18)
|
|
4
9
|
|
|
5
10
|
* Merged [PR #13](https://github.com/brightway-lca/stats_arrays/pull/13). Move argsort to save on execution time. Thanks @Loisel!
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at cmutel@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
72
|
+
|
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
|
74
|
+
|
|
75
|
+
For answers to common questions about this code of conduct, see
|
|
76
|
+
https://www.contributor-covenant.org/faq
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Contributor Guide
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in improving this project.
|
|
4
|
+
This project is open-source under the [BSD 3 Clause][License] and
|
|
5
|
+
welcomes contributions in the form of bug reports, feature requests, and pull requests.
|
|
6
|
+
|
|
7
|
+
Here is a list of important resources for contributors:
|
|
8
|
+
|
|
9
|
+
- [Source Code][Source Code]
|
|
10
|
+
- [Documentation][Documentation]
|
|
11
|
+
- [Issue Tracker][Issue Tracker]
|
|
12
|
+
- [Code of Conduct][Code of Conduct]
|
|
13
|
+
|
|
14
|
+
[License]: https://opensource.org/licenses/BSD-3-Clause
|
|
15
|
+
[Source Code]: https://github.com/brightway-lca/stats_arrays
|
|
16
|
+
[Documentation]: https://stats_arrays.readthedocs.io/
|
|
17
|
+
[Issue Tracker]: https://github.com/brightway-lca/stats_arrays/issues
|
|
18
|
+
|
|
19
|
+
## How to report a bug
|
|
20
|
+
|
|
21
|
+
Report bugs on the [Issue Tracker][Issue Tracker].
|
|
22
|
+
|
|
23
|
+
When filing an issue, make sure to answer these questions:
|
|
24
|
+
|
|
25
|
+
- Which operating system and Python version are you using?
|
|
26
|
+
- Which version of this project are you using?
|
|
27
|
+
- What did you do?
|
|
28
|
+
- What did you expect to see?
|
|
29
|
+
- What did you see instead?
|
|
30
|
+
|
|
31
|
+
The best way to get your bug fixed is to provide a test case,
|
|
32
|
+
and/or steps to reproduce the issue.
|
|
33
|
+
|
|
34
|
+
## How to request a feature
|
|
35
|
+
|
|
36
|
+
Request features on the [Issue Tracker][Issue Tracker].
|
|
37
|
+
|
|
38
|
+
## How to set up your development environment
|
|
39
|
+
|
|
40
|
+
Install the package with development requirements:
|
|
41
|
+
|
|
42
|
+
```console
|
|
43
|
+
$ pip install -e ".[dev]"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## How to build the documentation locally
|
|
47
|
+
|
|
48
|
+
Make sure you have installed the `dev` and `docs` extras of the package.
|
|
49
|
+
|
|
50
|
+
```console
|
|
51
|
+
$ pip install -e ".[dev,docs]"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Build the documentation providing the `docs` directory at the root of the project as the source
|
|
55
|
+
and specifying the output directory.
|
|
56
|
+
|
|
57
|
+
```console
|
|
58
|
+
# use docs as source and docs/_build as output
|
|
59
|
+
sphinx-build docs docs/_build
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## How to test the project
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
1. Install the package with development requirements:
|
|
66
|
+
|
|
67
|
+
```console
|
|
68
|
+
$ pip install -e ".[testing]"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
2. Run the full test suite:
|
|
72
|
+
|
|
73
|
+
```console
|
|
74
|
+
$ pytest
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
Unit tests are located in the _tests_ directory,
|
|
79
|
+
and are written using the [pytest][pytest] testing framework.
|
|
80
|
+
|
|
81
|
+
## How to submit changes
|
|
82
|
+
|
|
83
|
+
Open a [pull request] to submit changes to this project.
|
|
84
|
+
|
|
85
|
+
Your pull request needs to meet the following guidelines for acceptance:
|
|
86
|
+
|
|
87
|
+
- The test suite must pass without errors and warnings.
|
|
88
|
+
- Include unit tests.
|
|
89
|
+
- If your changes add functionality, update the documentation accordingly.
|
|
90
|
+
|
|
91
|
+
To run linting and code formatting checks before committing your change, you can install pre-commit as a Git hook by running one of following commands, depending on your dependencies manager:
|
|
92
|
+
|
|
93
|
+
```console
|
|
94
|
+
# conda or mamba
|
|
95
|
+
$ conda install pre-commit
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
or
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
$ pip install pre-commit
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
It is recommended to open an issue before starting work on anything.
|
|
106
|
+
This will allow a chance to talk it over with the owners and validate your approach.
|
|
107
|
+
|
|
108
|
+
[pytest]: https://pytest.readthedocs.io/
|
|
109
|
+
[pull request]: https://github.com/brightway-lca/stats_arrays/pulls
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2024 Chris Mutel
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: stats_arrays
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.dev8
|
|
4
4
|
Summary: Standard NumPy array interface for defining uncertain parameters
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Classifier:
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: Intended Audience :: Science/Research
|
|
13
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
14
|
-
Classifier: Operating System :: MacOS :: MacOS X
|
|
15
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
-
Classifier: Operating System :: POSIX
|
|
5
|
+
Author-email: Chris Mutel <cmutel@gmail.com>
|
|
6
|
+
Maintainer-email: Chris Mutel <cmutel@gmail.com>
|
|
7
|
+
Project-URL: source, https://github.com/brightway-lca/stats_arrays
|
|
8
|
+
Project-URL: homepage, https://github.com/brightway-lca/stats_arrays
|
|
9
|
+
Project-URL: tracker, https://github.com/brightway-lca/stats_arrays/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
17
11
|
Classifier: Programming Language :: Python
|
|
18
|
-
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.
|
|
20
|
-
Classifier: Programming Language :: Python :: 3
|
|
21
|
-
Classifier:
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Requires-Python: >=3.6
|
|
22
21
|
Description-Content-Type: text/markdown
|
|
23
|
-
License-File: LICENSE
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy>=1.6.0
|
|
24
|
+
Requires-Dist: scipy>=1.1.0
|
|
25
|
+
Provides-Extra: testing
|
|
26
|
+
Requires-Dist: stats_arrays; extra == "testing"
|
|
27
|
+
Requires-Dist: pytest; extra == "testing"
|
|
28
|
+
Requires-Dist: pytest-cov; extra == "testing"
|
|
29
|
+
Requires-Dist: python-coveralls; extra == "testing"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: build; extra == "dev"
|
|
32
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
33
|
+
Requires-Dist: pylint; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-randomly; extra == "dev"
|
|
37
|
+
Requires-Dist: setuptools; extra == "dev"
|
|
24
38
|
|
|
25
39
|
The `stats_arrays` package provides a standard NumPy array interface for defining uncertain parameters used in models, and classes for Monte Carlo sampling. It also plays well with others.
|
|
26
40
|
|
|
@@ -148,11 +148,11 @@ Items in **bold** are required, items in *italics* are optional.
|
|
|
148
148
|
.. [#] `Extreme value distribution <https://en.wikipedia.org/wiki/Generalized_extreme_value_distribution>`_
|
|
149
149
|
.. [#] `Student's T distribution <https://en.wikipedia.org/wiki/Student%27s_t-distribution>`_
|
|
150
150
|
|
|
151
|
-
Unused columns can be given any value, but it is recommended that they are set to ``np.
|
|
151
|
+
Unused columns can be given any value, but it is recommended that they are set to ``np.nan``.
|
|
152
152
|
|
|
153
153
|
.. warning::
|
|
154
154
|
|
|
155
|
-
Unused optional columns **must** be set to ``np.
|
|
155
|
+
Unused optional columns **must** be set to ``np.nan`` to avoid unexpected behaviour!
|
|
156
156
|
|
|
157
157
|
Extending parameter arrays
|
|
158
158
|
--------------------------
|
|
@@ -197,4 +197,3 @@ Indices and tables
|
|
|
197
197
|
* :ref:`genindex`
|
|
198
198
|
* :ref:`modindex`
|
|
199
199
|
* :ref:`search`
|
|
200
|
-
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stats_arrays"
|
|
7
|
+
authors = [
|
|
8
|
+
{ name="Chris Mutel", email="cmutel@gmail.com" }
|
|
9
|
+
]
|
|
10
|
+
maintainers = [
|
|
11
|
+
{ name="Chris Mutel", email="cmutel@gmail.com" }
|
|
12
|
+
]
|
|
13
|
+
description = "Standard NumPy array interface for defining uncertain parameters"
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
dynamic = ["version"]
|
|
16
|
+
# Add here all kinds of additional classifiers as defined under
|
|
17
|
+
# https://pypi.org/classifiers/
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Programming Language :: Python",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Natural Language :: English",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Topic :: Scientific/Engineering"
|
|
29
|
+
]
|
|
30
|
+
requires-python = ">=3.6"
|
|
31
|
+
dependencies = [
|
|
32
|
+
# dependencies as strings with quotes, e.g. "foo"
|
|
33
|
+
# You can add version requirements like "foo>2.0"
|
|
34
|
+
"numpy>=1.6.0",
|
|
35
|
+
"scipy>=1.1.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
source = "https://github.com/brightway-lca/stats_arrays"
|
|
40
|
+
homepage = "https://github.com/brightway-lca/stats_arrays"
|
|
41
|
+
tracker = "https://github.com/brightway-lca/stats_arrays/issues"
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
# Getting recursive dependencies to work is a pain, this
|
|
45
|
+
# seems to work, at least for now
|
|
46
|
+
testing = [
|
|
47
|
+
"stats_arrays",
|
|
48
|
+
"pytest",
|
|
49
|
+
"pytest-cov",
|
|
50
|
+
"python-coveralls"
|
|
51
|
+
]
|
|
52
|
+
dev = [
|
|
53
|
+
"build",
|
|
54
|
+
"pre-commit",
|
|
55
|
+
"pylint",
|
|
56
|
+
"pytest",
|
|
57
|
+
"pytest-cov",
|
|
58
|
+
"pytest-randomly",
|
|
59
|
+
"setuptools",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[tool.setuptools]
|
|
63
|
+
license-files = ["LICENSE"]
|
|
64
|
+
include-package-data = true
|
|
65
|
+
packages = [
|
|
66
|
+
"stats_arrays",
|
|
67
|
+
"stats_arrays.distributions",
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[tool.setuptools.dynamic]
|
|
71
|
+
version = {attr = "stats_arrays.__version__"}
|
|
72
|
+
|
|
73
|
+
[tool.pytest.ini_options]
|
|
74
|
+
addopts = "--cov stats_arrays --cov-report term-missing --verbose"
|
|
75
|
+
norecursedirs = [
|
|
76
|
+
"dist",
|
|
77
|
+
"build",
|
|
78
|
+
".tox"
|
|
79
|
+
]
|
|
80
|
+
testpaths = ["tests/*.py", "tests/distributions/*.py"]
|
|
81
|
+
|
|
82
|
+
[tool.flake8]
|
|
83
|
+
# Some sane defaults for the code style checker flake8
|
|
84
|
+
max_line_length = 88
|
|
85
|
+
extend_ignore = ["E203", "W503"]
|
|
86
|
+
# ^ Black-compatible
|
|
87
|
+
# E203 and W503 have edge cases handled by black
|
|
88
|
+
exclude = [
|
|
89
|
+
".tox",
|
|
90
|
+
"build",
|
|
91
|
+
"dist",
|
|
92
|
+
".eggs",
|
|
93
|
+
"docs/conf.py",
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[tool.black]
|
|
97
|
+
line-length = 88
|
|
98
|
+
|
|
99
|
+
[tool.isort]
|
|
100
|
+
profile = "black"
|
|
101
|
+
line_length = 88
|
|
102
|
+
multi_line_output = 3
|
|
103
|
+
include_trailing_comma = true
|
|
104
|
+
force_grid_wrap = 0
|
|
105
|
+
use_parentheses = true
|
|
106
|
+
ensure_newline_before_comments = true
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
__version__ = "0.7.dev8"
|
|
2
|
+
|
|
3
|
+
__all__ = (
|
|
4
|
+
"BernoulliUncertainty",
|
|
5
|
+
"BetaUncertainty",
|
|
6
|
+
"BoundedUncertaintyBase",
|
|
7
|
+
"DiscreteUniform",
|
|
8
|
+
"GammaUncertainty",
|
|
9
|
+
"GeneralizedExtremeValueUncertainty",
|
|
10
|
+
"ImproperBoundsError",
|
|
11
|
+
"InvalidParamsError",
|
|
12
|
+
"LatinHypercubeRNG",
|
|
13
|
+
"LognormalUncertainty",
|
|
14
|
+
"MaximumIterationsError",
|
|
15
|
+
"MCRandomNumberGenerator",
|
|
16
|
+
"MultipleRowParamsArrayError",
|
|
17
|
+
"NormalUncertainty",
|
|
18
|
+
"NoUncertainty",
|
|
19
|
+
"RandomNumberGenerator",
|
|
20
|
+
"StatsArraysError",
|
|
21
|
+
"StudentsTUncertainty",
|
|
22
|
+
"TriangularUncertainty",
|
|
23
|
+
"uncertainty_choices",
|
|
24
|
+
"UncertaintyBase",
|
|
25
|
+
"UndefinedDistributionError",
|
|
26
|
+
"UndefinedUncertainty",
|
|
27
|
+
"UniformUncertainty",
|
|
28
|
+
"UnknownUncertaintyType",
|
|
29
|
+
"UnreasonableBoundsError",
|
|
30
|
+
"WeibullUncertainty",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
from .distributions import (
|
|
34
|
+
BernoulliUncertainty,
|
|
35
|
+
BetaUncertainty,
|
|
36
|
+
BoundedUncertaintyBase,
|
|
37
|
+
DiscreteUniform,
|
|
38
|
+
GammaUncertainty,
|
|
39
|
+
GeneralizedExtremeValueUncertainty,
|
|
40
|
+
LognormalUncertainty,
|
|
41
|
+
NormalUncertainty,
|
|
42
|
+
NoUncertainty,
|
|
43
|
+
StudentsTUncertainty,
|
|
44
|
+
TriangularUncertainty,
|
|
45
|
+
UncertaintyBase,
|
|
46
|
+
UndefinedUncertainty,
|
|
47
|
+
UniformUncertainty,
|
|
48
|
+
WeibullUncertainty,
|
|
49
|
+
)
|
|
50
|
+
from .errors import (
|
|
51
|
+
ImproperBoundsError,
|
|
52
|
+
InvalidParamsError,
|
|
53
|
+
MaximumIterationsError,
|
|
54
|
+
MultipleRowParamsArrayError,
|
|
55
|
+
StatsArraysError,
|
|
56
|
+
UndefinedDistributionError,
|
|
57
|
+
UnknownUncertaintyType,
|
|
58
|
+
UnreasonableBoundsError,
|
|
59
|
+
)
|
|
60
|
+
from .random import LatinHypercubeRNG, MCRandomNumberGenerator, RandomNumberGenerator
|
|
61
|
+
from .uncertainty_choices import uncertainty_choices
|
|
@@ -12,9 +12,9 @@ def weighted_mean(values, weights):
|
|
|
12
12
|
|
|
13
13
|
def weighted_sample_variance(values, weights):
|
|
14
14
|
assert values.shape == weights.shape
|
|
15
|
-
return (
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
return (
|
|
16
|
+
(weights * values**2).sum() * weights.sum() - ((weights * values).sum()) ** 2
|
|
17
|
+
) / ((weights.sum()) ** 2 - (weights**2).sum())
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def weighted_sample_stddev(values, weights):
|
|
@@ -23,12 +23,13 @@ def weighted_sample_stddev(values, weights):
|
|
|
23
23
|
|
|
24
24
|
def test():
|
|
25
25
|
from numpy import array
|
|
26
|
+
|
|
26
27
|
a = array((1, 2, 3, 4))
|
|
27
|
-
print(a
|
|
28
|
+
print(a**2)
|
|
28
29
|
b = array((0.5, 0.5, 1, 1))
|
|
29
30
|
print(weighted_mean(a, b))
|
|
30
31
|
print(weighted_sample_stddev(a, b))
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
if __name__ ==
|
|
34
|
+
if __name__ == "__main__":
|
|
34
35
|
test()
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
__all__ = (
|
|
2
|
+
"BernoulliUncertainty",
|
|
3
|
+
"BetaUncertainty",
|
|
4
|
+
"BoundedUncertaintyBase",
|
|
5
|
+
"DiscreteUniform",
|
|
6
|
+
"GammaUncertainty",
|
|
7
|
+
"GeneralizedExtremeValueUncertainty",
|
|
8
|
+
"LognormalUncertainty",
|
|
9
|
+
"NormalUncertainty",
|
|
10
|
+
"NoUncertainty",
|
|
11
|
+
"StudentsTUncertainty",
|
|
12
|
+
"TriangularUncertainty",
|
|
13
|
+
"UncertaintyBase",
|
|
14
|
+
"UndefinedUncertainty",
|
|
15
|
+
"UniformUncertainty",
|
|
16
|
+
"WeibullUncertainty",
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
from .base import BoundedUncertaintyBase, UncertaintyBase
|
|
20
|
+
from .bernoulli import BernoulliUncertainty
|
|
21
|
+
from .beta import BetaUncertainty
|
|
22
|
+
from .discrete_uniform import DiscreteUniform
|
|
23
|
+
from .extreme import GeneralizedExtremeValueUncertainty
|
|
24
|
+
from .gamma import GammaUncertainty
|
|
25
|
+
from .geometric import TriangularUncertainty, UniformUncertainty
|
|
26
|
+
from .lognormal import LognormalUncertainty
|
|
27
|
+
from .normal import NormalUncertainty
|
|
28
|
+
from .student import StudentsTUncertainty
|
|
29
|
+
from .undefined import NoUncertainty, UndefinedUncertainty
|
|
30
|
+
from .weibull import WeibullUncertainty
|