Skip to content

Commit

Permalink
Merge pull request #246 from iacopoff/NSGA2
Browse files Browse the repository at this point in the history
[WIP] added functionality to test current implementation of nsgaii algorithm and new version of nsgaii
  • Loading branch information
thouska authored Oct 9, 2020
2 parents b4024bd + d49d521 commit 401d200
Show file tree
Hide file tree
Showing 172 changed files with 36,655 additions and 5,331 deletions.
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ __pycache__/

#other files
*.out
*.in
docs/*

*.png
*.csv
site/*
#mkdocs.yml

# Distribution / packaging
.Python
Expand All @@ -30,6 +33,9 @@ wheels/
.installed.cfg
*.egg

# Python Unittest tool `py.test`
.pytest_cache/*

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
Expand Down Expand Up @@ -112,3 +118,6 @@ spotpy/hymod/likelihood_test/*

# a doc folder for some notices
_doc

# spacemacs projects
.projectile
31 changes: 21 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
language: python
python:
- "2.7"
- "3.5"
- "3.6"
#- "2.7"
#- "3.5"
- "3.7"
# - "3.8" #Errors on Travis, build times out because no output was received...

# command to install dependencies
# this ubuntu distribution has sure the libopenmpi-dev packages available
dist: bionic

# command to install dependencies
install:
#- pip install pandas
- sudo apt-get update
- sudo apt install libopenmpi-dev openmpi-bin
- pip install mpi4py
- python setup.py install
- pip install coveralls
- pip install pathos
- pip install numpy
- pip install matplotlib
- pip install scipy
- pip install pandas
- pip install pytest pytest-pep8 pytest-cov
- pip install scipy
- pip install click
- pip install deap
# Need to force pytest-cov to v2.6 as current version (2.6.1) is deprecated and pytest:3.10.1
- pip install pytest==3.10.1 pytest-pep8 pytest-cov==2.6
# Use docutils to generate html describe
- pip install docutils
#- pip install matplotlib
#- travis_wait pip install scipy
- pip install numba
- pip install tables


script:
- py.test tests/test_* --cov spotpy --cov-report term-missing -v
# - mpirun -c 4 python spotpy/examples/tutorial_parallel_computing_hymod.py 100
- pip uninstall spotpy -y
- py.test spotpy/unittests/test_* spotpy/examples/tutorial_rosenbrock.py spotpy/examples/tutorial_nsgaii.py --cov spotpy --cov-report term-missing -v

after_success:
- coveralls
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include README.md
include MANIFEST.in
include setup.py
include setup.cfg
recursive-include spotpy/examples/cmf_data *
recursive-include spotpy/examples/hymod_exe *
recursive-include spotpy/examples/hymod_unix *
recursive-include spotpy/examples/hymod_python *
include LICENSE
86 changes: 39 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ A Statistical Parameter Optimization Tool for Python
[![Build Status][travis-image]][travis-link]
[![License][license-image]][license-link]
[![Coverage Status](https://coveralls.io/repos/github/thouska/spotpy/badge.svg?branch=master)](https://coveralls.io/github/thouska/spotpy?branch=master)
[![Documentation Status](https://readthedocs.org/projects/spotpy/badge/?version=latest)](https://readthedocs.org/projects/spotpy/badge/?version=latest)

[pypi-v-image]: https://img.shields.io/pypi/v/spotpy.png
[pypi-v-link]: https://pypi.python.org/pypi/spotpy
Expand Down Expand Up @@ -61,13 +62,15 @@ Some features you can use with the SPOTPY package are:
* Fourier Amplitude Sensitivity Test (`FAST`)
* Artificial Bee Colony (`ABC`)
* Fitness Scaled Chaotic Artificial Bee Colony (`FSCABC`)
* Dynamically Dimensioned Search algorithm (`DDS`)
* Pareto Archived - Dynamicallly Dimensioned Search algorithm (`PA-DDS`)

* Wide range of objective functions (also known as loss function, fitness function or energy function) to validate the sampled results. Available functions are

* Bias
* PBias
* Nash-Sutcliff (`NSE`)
* logarithmic Nash-Sutcliff (`logNSE`)
* Nash-Sutcliffe (`NSE`)
* logarithmic Nash-Sutcliffe (`logNSE`)
* logarithmic probability (`logp`)
* Correlation Coefficient (`r`)
* Coefficient of Determination (`r^2`)
Expand All @@ -77,7 +80,20 @@ Some features you can use with the SPOTPY package are:
* Relative Root Mean Squared Error (`RRMSE`)
* Agreement Index (`AI`)
* Covariance, Decomposed MSE (`dMSE`)
* Kling-Gupta Efficiency (`KGE`).
* Kling-Gupta Efficiency (`KGE`)
* Non parametric Kling-Gupta Efficiency (`KGE_non_parametric`)

* Wide range of hydrological signatures functions to validate the sampled results:

* Slope
* Flooding/Drought events
* Flood/Drought frequency
* Flood/Drought duration
* Flood/Drought variance
* Mean flow
* Median flow
* Skewness
* compare percentiles of discharge

* Prebuild parameter distribution functions:

Expand All @@ -90,48 +106,6 @@ Some features you can use with the SPOTPY package are:
* Wald
* Weilbull

* A toolbox of hydrological signatures, to see a hydrological fit of modeled data to the measured one.

To use this signatures, you call the _get_**HydrologicalSignature** function and entering the measured and the modeled data.
Setting `mode='calc_Dev'` performs our desired calculation. Sometimes additional parameters are needed, as for example
a timestamp list (in a pandas object) or threshold values. The closer the return value is to zero, the more fits the simulated
data with measured one.


spotpy.signatures.getSlopeFDC(measured_data,results,mode='calc_Dev')

By changing the value of `mode` to `'get_signature'`, we get the signature value _only_ for the parameter `data`.

By changing the value of `mode` to `'get_raw_data'`, we get a raw calculation of flood-signatures, belonging to each signature calculation.

**tutorial_signatures.py** contains al available functions and it's mode settings.

* List of available hydrological signatures, additional required parameters are in brackets
* getMeanFlow
* getMedianFlow
* getSkewness
* getCoeffVariation
* getQ001
* getQ01
* getQ1
* getQ5
* getQ10
* getQ20
* getQ85
* getQ95
* getQ99
* getSlopeFDC
* getAverageFloodOverflowPerSection(datetime_series, threshold_value)
* getAverageFloodFrequencyPerSection(datetime_series, threshold_value)
* getAverageFloodDuration(datetime_series, threshold_value)
* getAverageBaseflowUnderflowPerSection(datetime_series, threshold_value)
* getAverageBaseflowFrequencyPerSection(datetime_series, threshold_value)
* getFloodFrequency(datetime_series, threshold_value)
* getBaseflowFrequency (datetime_series, threshold_value)
* getLowFlowVar(datetime_series)
* getHighFlowVar(datetime_series)
* getBaseflowIndex(datetime_series)

* Wide range to adapt algorithms to perform uncertainty-, sensitivity analysis or calibration
of a model.

Expand Down Expand Up @@ -174,7 +148,7 @@ Or, after downloading the [source code](https://pypi.python.org/pypi/spotpy "sou
Support
=================

* Documentation: http://www.uni-giessen.de/cms/faculties/f09/institutes/ilr/hydro/download/spotpy
* Documentation: https://spotpy.readthedocs.io/en/latest/

* Feel free to contact the authors of this tool for any support questions.

Expand All @@ -187,4 +161,22 @@ Support

Getting started
=================
Have a look at https://github.com/thouska/spotpy/tree/master/spotpy/examples and http://fb09-pasig.umwelt.uni-giessen.de/spotpy/Tutorial/2-Rosenbrock/
Have a look at https://github.com/thouska/spotpy/tree/master/spotpy/examples and https://spotpy.readthedocs.io/en/latest/getting_started/


Contributing
=================
Patches/enhancements/new algorithms and any other contributions to this package are very welcome!

1. Fork it ( http://github.com/thouska/spotpy/fork )
2. Create your feature branch (``git checkout -b my-new-feature``)
3. Add your modifications
4. Add short summary of your modifications on ``CHANGELOG.rst``
5. Commit your changes (``git commit -m "Add some feature"``)
6. Push to the branch (``git push origin my-new-feature``)
7. Create new Pull Request

Papers citing SPOTPY
=====================
See [Google Scholar](https://scholar.google.de/scholar?cites=17155001516727704728&as_sdt=2005&sciodt=0,5&hl=de) for a continuously updated list.

32 changes: 13 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
.. image:: https://img.shields.io/pypi/v/spotpy.png
:target: https://pypi.python.org/pypi/spotpy
.. image:: https://img.shields.io/travis/thouska/spotpy/master.png
:target: https://travis-ci.org/thouska/spotpy
.. image:: https://img.shields.io/badge/license-MIT-blue.png
:target: http://opensource.org/licenses/MIT
.. image:: https://coveralls.io/repos/github/thouska/spotpy/badge.svg?branch=master
:target: https://coveralls.io/github/thouska/spotpy?branch=master



Purpose
-------
SPOTPY
========
**A Statistical Parameter Optimization Tool for Python**

SPOTPY is a Python tool that enables the use of Computational optimization techniques for calibration, uncertainty
and sensitivity analysis techniques of almost every (environmental-) model. The package is puplished in the open source journal PLoS One
Expand Down Expand Up @@ -47,13 +37,15 @@ We want to make this task as easy as possible. Some features you can use with th
* Fourier Amplitude Sensitivity Test (`FAST`)
* Artificial Bee Colony (`ABC`)
* Fitness Scaled Chaotic Artificial Bee Colony (`FSCABC`)

* Dynamically Dimensioned Search algorithm (`DDS`)
* Pareto Archived - Dynamicallly Dimensioned Search algorithm (`PA-DDS`)

* Wide range of objective functions (also known as loss function, fitness function or energy function) to validate the sampled results. Available functions are

* Bias
* Procentual Bias (`PBias`)
* Nash-Sutcliff (`NSE`)
* logarithmic Nash-Sutcliff (`logNSE`)
* Nash-Sutcliffe (`NSE`)
* logarithmic Nash-Sutcliffe (`logNSE`)
* logarithmic probability (`logp`)
* Correlation Coefficient (`r`)
* Coefficient of Determination (`r^2`)
Expand All @@ -64,6 +56,7 @@ We want to make this task as easy as possible. Some features you can use with th
* Agreement Index (`AI`)
* Covariance, Decomposed MSE (`dMSE`)
* Kling-Gupta Efficiency (`KGE`)
* Non parametric Kling-Gupta Efficiency (`KGE_non_parametric`)

* Wide range of likelihood functions to validate the sampled results:

Expand Down Expand Up @@ -137,7 +130,7 @@ We want to make this task as easy as possible. Some features you can use with th
Documentation
-------------

Documentation is available at `<http://fb09-pasig.umwelt.uni-giessen.de/spotpy>`__
Documentation is available at `<https://spotpy.readthedocs.io/en/latest>`__


Install
Expand All @@ -151,8 +144,9 @@ Or, after downloading the source code and making sure python is in your path:

python setup.py install


Papers citing SPOTPY
-------
--------------------
See `Google Scholar <https://scholar.google.de/scholar?cites=17155001516727704728&as_sdt=2005&sciodt=0,5&hl=de>`__ for a continuously updated list.


Expand Down Expand Up @@ -184,4 +178,4 @@ Patches/enhancements/new algorithms and any other contributions to this package
Getting started
---------------

Have a look at https://github.com/thouska/spotpy/tree/master/spotpy/examples and http://fb09-pasig.umwelt.uni-giessen.de/spotpy/Tutorial/2-Rosenbrock/
Have a look at https://github.com/thouska/spotpy/tree/master/spotpy/examples and https://spotpy.readthedocs.io/en/latest/getting_started/
Loading

0 comments on commit 401d200

Please sign in to comment.