Skip to content

Commit 9328e31

Browse files
authored
restructure the distrubutions module (#91)
* move all docs inside the `sources` file * move all docs inside the `sources` file * add auto docs * replace using the environment.yml by requirements.txt * adjust the naming convention * adjust the naming convention * adjust the naming convention * remove the naming ci * update hooks * add example for the plotting position * update dev dependencies * make 3.11, 3.12 the testing python versions * remove macos from ci * add sensitivity to docs * add sensitivity to docs * add eva to docs * update sensitivity * fix senstivity docs * add missing members * update docs * reformat * reformat * fix equation * reformat * add extensions for math equations * reformat * reformat * add make docs files * reformat * reformat * add plot docs * add plot docs * add gev equation * fix error in gev equation * fix the `\left` error in gev equation * try to separate the two line equation * try to separate the two line equation * try to separate the two line equation * try to separate the two line equation * try to separate the two line equation * add labels to the equations * fix equation labels * fix equation labels * unify gev and gumbel * add cdf to gev and gumbel * add cdf to normal and exponential dists * add fx and FX * reformat * add check to test_fit_model * add check to test_fit_model * add check to test_fit_model * use Agg as backend in test files * simplify the test `TestGUMBEL::test_probability_plot` * simplify the test `TestGEV::test_probability_plot` * fix the Extreme value analysis.ipynb notebook * remove spaces from scripts names * use the factory class `Distribution` in the notebook * add examples * rename `theoretical_estimate` to `inverse_cdf` * remove the `chisquare` test from the `fit_model` * add examples * add missing images * correct images path * add properties * the `parameter` argument is optional for the pdf and cdf * switch parameters for the `inverse_cdf` method * reformat * add docstring * add images * reformat * correct the `inverse_cdf` parameter order in the abstract class method * remove the `dstatic`, `chi_pvalue`, `ks_pvalue properties * reformat * rename the metrics module to descriptors * rename metrics to descriptors * instantiating the distribution by either the parameter or the data * add description to gumbel * correct the `actual_data` parameter in the `cdf` method * correct the `actual_data` parameter in the `pdf` method * update the docstring for the `pdf` and `cdf` methods * return lost commits * validate parameters and data in the distribution constructor * add `random` method to `gumbel` * test providing the `pdf` and `cdf` with data parameters * add example to the `random` method in `gumbel` distribution * add example to the `random` method in `gev` distribution * reformat * add examples to the `exponential` class * update examples of the `gumbel` class * update examples of the `GEV` class * unifyt the docs of `ks` method * the argument `parameter` in the `confidence_interval` method is now optional and moved to the end * check the length of the cdf and data * abstract code into `confidence_level` function * provide the parameters as a kwarg in the `probability_plot`. * reformat docstring * the `prob_non_exceed` is now optional for the `confidence_interval` function * make the `prob_non_exceed` optional in the `confidence_interval` for the GEV class * remove duplicate test * reformat * test `confidence_interval` with the default parameters * update example * add example and test Gumbel.confidence_interval * add example and test GEV.confidence_interval * add images for the examples * move the `cdf` parameter to the end and make it kwarg in the `probability_plot` in gumbel and gev * update dependencies * add the main features to docs * update installation docs * add plt.show at the end of all the plots * remove the `confidence_interval` plot from the `probability_plot` method * update rhine example * update docstring * add `__str__` method * rename `probability_plot` to "plot" * move the `parameters` argument in the `pdf` and `cdf` function to the end * correct the matplotlib backend * update plot gumbel example * update plot gev example * rename the figsize parameter to fig_size for all functions * update the docstring of the `AbstractDistribution.plot` * add missing figures for the docstring * reorder the `plot` method `parameters` in the abstract method * reorder the `confidence_interval` method `parameters` in all classes * rename the `significance_level` parameter to the `ams_analysis` to `alpha` * add examples to the `ams_analysis` * update the examples of the `ams_analysis` * add missing images * rename the objective_fn to truncated_distribution * comment the truncated_distribution function * update checklist files * update ci workflows * rename `statfunction` to `state_function`in the `confidence_interval.boot_strap` * add a script for the truncated_distribution * update examples * update examples * remove the python version from the environment.yml
1 parent b3a7525 commit 9328e31

File tree

92 files changed

+6508
-2786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+6508
-2786
lines changed

.github/workflows/conda-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
- name: Install dev-dependencies
3636
run: |
37-
python -m pip install -r requirements-dev.txt
37+
pip install .[dev] --no-deps
3838
3939
- name: Run tests
4040
shell: bash -el {0}

.github/workflows/pull-request-naming-validation.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/pypi-deployment.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [ubuntu-latest, windows-latest, macos-latest]
16-
python-version: ["3.9", "3.10", "3.11"]
15+
os: [ubuntu-latest, windows-latest] # , macos-latest
16+
python-version: ["3.10", "3.11", "3.12"]
1717

1818
steps:
1919
- uses: actions/checkout@v3
@@ -25,8 +25,7 @@ jobs:
2525

2626
- name: Install dependencies
2727
run: |
28-
pip install -r requirements.txt -r requirements-dev.txt
29-
python setup.py install
28+
pip install .[dev]
3029
3130
- name: Generate coverage report
3231
run: |

.pre-commit-config.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fail_fast: true
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.5.0
4+
rev: v4.6.0
55
hooks:
66
- id: end-of-file-fixer
77
name: "[py - check] validate yaml"
@@ -58,7 +58,7 @@ repos:
5858
files: ^Hapi/
5959

6060
- repo: https://github.com/pycqa/flake8
61-
rev: 6.1.0
61+
rev: 7.1.0
6262
hooks:
6363
- id: flake8
6464
name: "[py - check] flake8"
@@ -70,7 +70,7 @@ repos:
7070
# hooks:
7171
# - id: black
7272
- repo: https://github.com/ambv/black
73-
rev: 22.8.0
73+
rev: 24.8.0
7474
hooks:
7575
- id: black
7676
name: "[py - format] black"
@@ -112,3 +112,19 @@ repos:
112112
language: system
113113
pass_filenames: false
114114
always_run: true
115+
116+
- repo: local
117+
hooks:
118+
- id: examples-notebook-check
119+
name: nbval
120+
entry: pytest --nbval
121+
language: system
122+
files: \.ipynb$
123+
124+
- repo: local
125+
hooks:
126+
- id: doctest
127+
name: doctest
128+
entry: pytest --doctest-modules
129+
language: system
130+
files: statista\.py$

.readthedocs.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@
55
# Required
66
version: 2
77

8-
conda:
9-
environment: docs/environment.yml
10-
# Build documentation in the docs/ directory with Sphinx
118
sphinx:
12-
configuration: docs/conf.py
13-
#Build documentation with MkDocs
14-
#mkdocs:
15-
# configuration: mkdocs.yml
9+
configuration: docs/source/conf.py
1610

11+
build:
12+
os: "ubuntu-22.04"
13+
tools:
14+
python: "3.12"
15+
16+
python:
17+
install:
18+
- method: pip
19+
path: .
20+
extra_requirements:
21+
- docs
1722

1823
# Optionally build your docs in additional formats such as PDF and ePub
1924
formats: all

HISTORY.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,27 @@ History
5050
* Use factory design pattern to create the distributions.
5151
* add tests for the eva module.
5252
* use snake_case for the methods and variables.
53+
54+
0.6.0 (2024-08-18)
55+
------------------
56+
57+
dev
58+
"""
59+
* Add documentations for the `distributions`, and `eva` modules.
60+
* Add autodoc for all modules.
61+
* Test docstrings as part of CI and pre-commit hooks.
62+
* Test notebooks as part of CI.
63+
* Simplify test for the distributions module
64+
65+
distributions
66+
"""""""""""""
67+
* move the `cdf` and `parameters` for all the methods to be optional parameters.
68+
* rename `theoretical_estimate` method to `inverse_cdf`.
69+
* All distributions can be instantiated with the parameters and/or data.
70+
* rename the `probability_plot` method to `plot`.
71+
* move the `confidence_interval` plot from the `probability_plot/plot` to the method `confidence_interval` and can be
72+
called by activating the `plot_figure=True`.
73+
74+
descriptors
75+
"""""""""""
76+
* rename the `metrics` module to `descriptors`.

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Main Features
2828
-------------
2929
- Statistical Distributions
3030
- GEV
31-
- GUMBL
31+
- GUMBEL
3232
- Normal
3333
- Exponential
3434
- Parameter estimation methods
@@ -40,6 +40,7 @@ Main Features
4040
- Statistical descriptors
4141
- Extreme value analysis
4242

43+
For the full documentation, please visit [statista documentation](https://statista.readthedocs.io/en/latest/?badge=latest)
4344

4445
Installing statista
4546
===============
@@ -50,22 +51,22 @@ Installing `statista` from the `conda-forge` channel can be achieved by:
5051
conda install -c conda-forge statista
5152
```
5253

53-
It is possible to list all of the versions of `statista` available on your platform with:
54+
It is possible to list all the versions of `statista` available on your platform with:
5455

5556
```
5657
conda search statista --channel conda-forge
5758
```
5859

59-
## Install from Github
60-
to install the last development to time you can install the library from github
60+
## Install from GitHub
61+
to install the last development to time, you can install the library from GitHub
6162
```
6263
pip install git+https://github.com/MAfarrag/statista
6364
```
6465

6566
## pip
66-
to install the last release you can easly use pip
67+
to install the last release, you can use pip
6768
```
68-
pip install statista==0.5.0
69+
pip install statista==0.6.0
6970
```
7071

7172
Quick start

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

0 commit comments

Comments
 (0)