Skip to content

Commit

Permalink
Merge pull request #27 from Serapieum-of-alex/more-distributions
Browse files Browse the repository at this point in the history
More distributions
  • Loading branch information
MAfarrag authored Feb 19, 2023
2 parents 36d4b5d + 29e5436 commit e38fd6e
Show file tree
Hide file tree
Showing 27 changed files with 3,246 additions and 526 deletions.
22 changes: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ repos:
# hooks:
# - id: isort
# name: "[py - format] isort"
- repo: https://github.com/PyCQA/docformatter
rev: v1.4
hooks:
- id: docformatter
name: "[py - format] docformatter"
args: [ -i, --wrap-summaries, "0" ]
# - repo: https://github.com/PyCQA/docformatter
# rev: v1.4
# hooks:
# - id: docformatter
# name: "[py - format] docformatter"
# args: [ -i, --wrap-summaries, "0" ]

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.1.1
Expand All @@ -57,12 +57,12 @@ repos:
name: "[py - check] pydocstyle"
files: ^Hapi/

- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
name: "[py - check] flake8"
language_version: python3.9
# language_version: python3.9
exclude: ^(examples/|tests/)

#- repo: https://github.com/psf/black
Expand All @@ -74,7 +74,7 @@ repos:
hooks:
- id: black
name: "[py - format] black"
language_version: python3.9
# language_version: python3.9
- repo: https://github.com/lovesegfault/beautysh
rev: v6.2.1
hooks:
Expand Down Expand Up @@ -108,7 +108,7 @@ repos:
hooks:
- id: pytest-check
name: pytest-check
entry: pytest -vvv --cov=Hapi
entry: pytest -vvv --cov=statista
language: system
pass_filenames: false
always_run: true
10 changes: 10 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ History

* add eva (Extreme value analysis) module
* fix bug in obtaining distribution parameters using optimization method


0.3.0 (2023-02-19)
------------------

* add documentations for both GEV and gumbel distributions.
* add lmoment parameter estimation method for all distributions.
* add exponential and normal distributions
* modify the pdf, cdf, and probability plot plots
* create separate plot and confidence_interval modules.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ statista

Main Features
-------------
- Statistical Distributions (GEV/GUMBL)
- Parameter estimation Lmoments/ML/MOM
- Statistical Distributions
- GEV
- GUMBL
- Normal
- Exponential
- Parameter estimation methods
- Lmoments
- ML
- MOM
- One-at-time (O-A-T) Sensitivity analysis.
- Sobol visualization
- Statistical Metrics

Future work
-------------
- More distributions
- Statistical descriptors
- Extreme value analysis


Installing statista
Expand All @@ -61,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.2.0
pip install statista==0.3.0
```

Quick start
Expand Down
61 changes: 39 additions & 22 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import os
import sys

# import sphinx_rtd_theme

# General information about the project.
project = "pyramids"
project = "statista"
author = "Mostafa Farrag"

# copyright = u"2013-2019, "


html_theme = "sphinxdoc"
# html_theme = "agogo"
html_theme_path = ["."]
Expand All @@ -28,7 +28,7 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath("../pyramids"))
sys.path.insert(0, os.path.abspath("../statista"))
sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath("../examples"))

Expand All @@ -37,7 +37,7 @@
# os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath("sphinxext"))

# import pyramids
# import statista


# -- General configuration -----------------------------------------------------
Expand All @@ -48,13 +48,19 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
"matplotlib.sphinxext.plot_directive",
"sphinx.ext.todo",
"sphinx.ext.mathjax",
"sphinx.ext.autodoc",
"sphinx.ext.graphviz",
"sphinx.ext.doctest",
"sphinx.ext.autosectionlabel",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
"sphinx.ext.imgmath",
"easydev.copybutton",
# "matplotlib.sphinxext.plot_directive",
# "sphinx.ext.todo",
# "sphinx.ext.mathjax",
# "sphinx.ext.graphviz",
# "sphinx.ext.doctest",
# "sphinx.ext.autosectionlabel",
"numpydoc",
"nbsphinx",
]

autosectionlabel_prefix_document = True
Expand Down Expand Up @@ -117,7 +123,9 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "sphinx_rtd_theme"
# html_theme = "sphinx_rtd_theme"
html_theme = "pydata_sphinx_theme"


# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -137,7 +145,7 @@
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
"""
html_logo = "images/pyramids.png"
html_logo = "images/statista.png"
"""
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
Expand All @@ -164,7 +172,13 @@
# html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
html_sidebars = {
"**": [
"globaltoc.html",
"relations.html", # needs 'show_related': True theme option to display
"searchbox.html",
]
}

# Additional templates that should be rendered to pages, maps page names to
# template names.
Expand Down Expand Up @@ -197,16 +211,20 @@
html_file_suffix = ".html"

# Output file base name for HTML help builder.
htmlhelp_basename = "pyramidsdoc"
htmlhelp_basename = "statistadoc"


# -- Options for LaTeX output --------------------------------------------------


# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
("index", "pyramids.tex", "pyramids Documentation", "Mostafa Farrag", "report")
(
"index",
"statista.tex",
"statista Documentation",
"Mostafa Farrag",
"report",
)
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -234,7 +252,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [("index", "pyramids", "pyramids Documentation", [author], 1)]
man_pages = [("index", "statista", "statista Documentation", [author], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -248,10 +266,9 @@
texinfo_documents = [
(
"index",
"pyramids",
"pyramids Documentation",
"statista",
"statista Documentation",
"Mostafa Farrag",
"pyramids",
"One line description of project.",
"Miscellaneous",
)
Expand All @@ -277,5 +294,5 @@
# "netCDF4_utils",
# "netcdftime",
# "pyproj",
# "pyramids.version",
# "statista.version",
]
56 changes: 56 additions & 0 deletions docs/distributions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#############
Distributions
#############

********************************************
Generalized extreme value distribution (GEV)
********************************************

- The generalised extreme value (or generalized extreme value) distribution characterises the behaviour of ‘block
maxima’

probability density function (pdf)
==================================

.. math::
f(x) = \frac{1}{\sigma}\ast{Q(x)}^{\xi+1}\ast e^{-Q(x)}
.. math::
Q(x) =
\begin{cases}
{(1+\xi(\frac{x-\mu}{\delta}))}^\frac{-1}{\xi} & \quad \text{if } \xi \text{ \neq 0}\\
e^{-(\frac{x-\mu}{\delta})} & \quad \text{if } \xi \text{ = 0}
\end{cases}
- where
- :math: `\sigma` is the scale parameter
- :math: `\mu` is the location parameter
- :math: `\delta` is the scale parameter


Cumulative distribution function (cdf)
======================================

.. math::
F(x)=e^{-Q(x)}
*******************
Gumbel Distribution
*******************

- The Gumbel distribution is a special case of the `Generalized extreme value distribution (GEV)`_ when the shape
parameter :math: `\sigma` equals zero.

probability density function (pdf)
==================================

.. math::
f(x) = \frac{1}{\sigma} \ast { {e}^{-(\frac{x-\mu}{\delta}) - {e}^{- (\frac{x-\mu}{\delta})} }}
Cumulative distribution function (cdf)
======================================

.. math::
F(x) = {e}^{- {e}^{- (\frac{x-\mu}{\delta})} }
17 changes: 10 additions & 7 deletions docs/environment.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
channels:
- conda-forge
dependencies:
- python >=3.9.0
- pip >=21.3.1
- matplotlib >=3.4.2,<3.6.0
# - pandas >=1.3.2,<1.4.3
# - pip:
# - geoplot >=0.5.1
# - loguru >=0.5.3
- python >=3.9,<3.11
- pip >=22.3.1
- pandas
- numpy==1.20.*
- numpydoc==1.1.0
- typing-extensions==3.10.*
- pip:
- pydata-sphinx-theme
- nbsphinx
- easydev
Binary file added docs/images/sensitivityAnalysis1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/sensitivityAnalysis2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/sensitivityAnalysis3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ Current release info
:target: https://pypi.org/project/statista/0.1.2/


.. image:: https://img.shields.io/conda/v/conda-forge/hapi?label=conda-forge
.. image:: https://img.shields.io/conda/v/conda-forge/statista?label=conda-forge
:target: https://pypi.org/project/statista/0.1.2/


.. image:: https://img.shields.io/pypi/pyversions/statista
:target: https://pypi.org/project/statista/0.1.2/


.. image:: https://img.shields.io/github/forks/mafarrag/hapi?style=social :alt: GitHub forks
.. image:: https://img.shields.io/github/forks/mafarrag/statista?style=social :alt: GitHub forks


.. image:: https://anaconda.org/conda-forge/hapi/badges/downloads.svg
:target: https://anaconda.org/conda-forge/hapi
.. image:: https://anaconda.org/conda-forge/statista/badges/downloads.svg
:target: https://anaconda.org/conda-forge/statista


.. image:: https://img.shields.io/conda/vn/conda-forge/hapi :alt: Conda (channel only)
.. image:: https://img.shields.io/conda/vn/conda-forge/statista :alt: Conda (channel only)
:target: https://pypi.org/project/statista/0.1.2/


Expand All @@ -37,8 +37,8 @@ Current release info
:alt: PyPI


.. image:: https://anaconda.org/conda-forge/hapi/badges/platforms.svg
:target: https://anaconda.org/conda-forge/hapi
.. image:: https://anaconda.org/conda-forge/statista/badges/platforms.svg
:target: https://anaconda.org/conda-forge/statista


.. image:: https://static.pepy.tech/personalized-badge/statista?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads
Expand Down Expand Up @@ -81,6 +81,6 @@ Main Features
:hidden:
:maxdepth: 1

Installation <00Installation.rst>
Tutorial <03tutorial.rst>
GIS <05GIS.rst>
Installation <installation.rst>
Distributions <distributions.rst>
Sensitivity analysis <sensitivity_analysis.rst>
Loading

0 comments on commit e38fd6e

Please sign in to comment.