Skip to content

Commit

Permalink
Merge pull request #30 from Serapieum-of-alex/more-distributions
Browse files Browse the repository at this point in the history
more distributions
  • Loading branch information
MAfarrag authored Nov 26, 2023
2 parents 040072e + df3bd5b commit 1f6d7d2
Show file tree
Hide file tree
Showing 28 changed files with 1,468 additions and 2,200 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, E741
ignore = E501, W503
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4
46 changes: 46 additions & 0 deletions .github/workflows/conda-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: conda-deployment

on: [push]

jobs:
Main-package:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
env:
OS: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
#use-mamba: true
auto-update-conda: false
environment-file: environment.yml
auto-activate-base: false
activate-environment: test
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: true
show-channel-urls: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install dev-dependencies
run: |
python -m pip install -r requirements-dev.txt
- name: Run tests
shell: bash -el {0}
run: |
conda info
conda list
conda config --show-sources
conda config --show
pytest -sv
36 changes: 36 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: gitHub-release

on:
workflow_dispatch:
push:
tags:
- '*'

jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup GitHub CLI
run: |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
- name: Extract tag name
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV


- name: Create GitHub Release
id: create_release
run: |
gh release create $TAG_NAME --title "$TAG_NAME" --notes-from-tag
env:
GH_TOKEN: ${{ secrets.CREATE_RELEASE }}
36 changes: 36 additions & 0 deletions .github/workflows/pypi-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pypi-deployment

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
Run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} ${{ matrix.os }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install dependencies
run: |
pip install -r requirements.txt -r requirements-dev.txt
python setup.py install
- name: Generate coverage report
run: |
python -m pytest -vvv --cov=statista --cov-report=xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
34 changes: 34 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: pypi-release

on:
workflow_dispatch:
release:
types: [released, published, created]

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install tools
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERS }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
30 changes: 0 additions & 30 deletions .github/workflows/pypi.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/ubuntu.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
name: "[py - check] validate yaml"
Expand Down Expand Up @@ -51,14 +51,14 @@ repos:
# args: [ -i, --wrap-summaries, "0" ]

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.1.1
rev: 6.3.0
hooks:
- id: pydocstyle
name: "[py - check] pydocstyle"
files: ^Hapi/

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
name: "[py - check] flake8"
Expand All @@ -83,7 +83,7 @@ repos:

# pre-commit-shell: Checks shell scripts against shellcheck.
- repo: https://github.com/detailyang/pre-commit-shell
rev: v1.0.6
rev: 1.0.5
hooks:
- id: shell-lint
name: "[bash - lint] shell-lint"
Expand Down
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ History
* add exponential and normal distributions
* modify the pdf, cdf, and probability plot plots
* create separate plot and confidence_interval modules.

0.4.0 (2023-011-23)
------------------

* add Pearson 3 distribution
* Use setup.py instead of pyproject.toml.
* Correct pearson correlation coefficient and add documentation .
* replace the pdf and cdf by the methods from scipy package.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pip install git+https://github.com/MAfarrag/statista
## pip
to install the last release you can easly use pip
```
pip install statista==0.3.0
pip install statista==0.4.0
```

Quick start
Expand Down
13 changes: 13 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
channels:
- conda-forge
dependencies:
- python >=3.11
- numpy >=1.25.2
- pip >=23.2.1
- matplotlib >=3.8.0
- pandas >=2.1.0
- scipy >=1.11.4
- scikit-learn >=1.3.2
- loguru >=0.7.2
- pytest >=7.4.2
- pytest-cov >=4.1.0
20 changes: 10 additions & 10 deletions examples/Extreme value statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,23 @@
#%% Generalized Extreme Value (GEV)
Gevdist = GEV(time_series2)
# default parameter estimation method is maximum liklihood method
Param_dist = Gevdist.estimateParameter()
mle_param = Gevdist.estimateParameter(method="mle")
Gevdist.ks()
Gevdist.chisquare()

print(Param_dist)
shape = Param_dist[0]
loc = Param_dist[1]
scale = Param_dist[2]
print(mle_param)
shape = mle_param[0]
loc = mle_param[1]
scale = mle_param[2]
# calculate and plot the pdf
pdf, fig, ax = Gevdist.pdf(shape, loc, scale, plot_figure=True)
cdf, _, _ = Gevdist.cdf(shape, loc, scale, plot_figure=True)
#%% lmoment method
Param_dist = Gevdist.estimateParameter(method="lmoments")
print(Param_dist)
shape = Param_dist[0]
loc = Param_dist[1]
scale = Param_dist[2]
lmom_param = Gevdist.estimateParameter(method="lmoments")
print(lmom_param)
shape = lmom_param[0]
loc = lmom_param[1]
scale = lmom_param[2]
# calculate and plot the pdf
pdf, fig, ax = Gevdist.pdf(shape, loc, scale, plot_figure=True)
cdf, _, _ = Gevdist.cdf(shape, loc, scale, plot_figure=True)
Expand Down
Loading

0 comments on commit 1f6d7d2

Please sign in to comment.