Skip to content

Commit

Permalink
Merge pull request #11 from GeoStat-Framework/develop
Browse files Browse the repository at this point in the history
Release v1.0.3
  • Loading branch information
MuellerSeb authored Feb 18, 2021
2 parents e24d7d1 + 5bdf033 commit 294bf41
Show file tree
Hide file tree
Showing 9 changed files with 231 additions and 164 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Continuous Integration

on:
push:
branches:
- "master"
- "develop"
tags:
- "*"
pull_request:
branches:
- "develop"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
# needed by coveralls
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build_sdist:
name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Set up Python ${{ matrix.python-version }}
uses: actions\setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U wheel
pip install -r requirements_setup.txt
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install coveralls>=3.0.0
- name: Build sdist
run: |
python setup.py sdist --formats=gztar bdist_wheel -d dist
- name: Run tests
run: |
python -m pytest --cov welltestpy --cov-report term-missing -v tests/
python -m coveralls --service=github
- uses: actions/upload-artifact@v2
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
with:
path: dist

upload_to_pypi:
needs: [build_sdist]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- name: Publish to Test PyPI
# only if working on develop
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true

- name: Publish to PyPI
# only if tagged
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
85 changes: 0 additions & 85 deletions .travis.yml

This file was deleted.

14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to **welltestpy** will be documented in this file.

## [1.0.3] - 2021-02

### Enhancements
- Estimations: run method now provides `plot_style` keyword to control plotting

### Changes
- Fit plot style for transient pumping tests was updated

### Bugfixes
- Estimations: run method was throwing an Error when setting `run=False`
- Plotter: all plotting routines now respect setted font-type from matplotlib


## [1.0.2] - 2020-09-03

### Bugfixes
Expand Down Expand Up @@ -78,6 +91,7 @@ All notable changes to **welltestpy** will be documented in this file.

First alpha release of welltespy.

[1.0.3]: https://github.com/GeoStat-Framework/welltestpy/compare/v1.0.2...v1.0.3
[1.0.2]: https://github.com/GeoStat-Framework/welltestpy/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/GeoStat-Framework/welltestpy/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/GeoStat-Framework/welltestpy/compare/v0.3.2...v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Sebastian Mueller
Copyright (c) 2021 Sebastian Mueller

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1229051.svg)](https://doi.org/10.5281/zenodo.1229051)
[![PyPI version](https://badge.fury.io/py/welltestpy.svg)](https://badge.fury.io/py/welltestpy)
[![Build Status](https://travis-ci.com/GeoStat-Framework/welltestpy.svg?branch=master)](https://travis-ci.com/GeoStat-Framework/welltestpy)
[![Coverage Status](https://coveralls.io/repos/github/GeoStat-Framework/welltestpy/badge.svg?branch=master)](https://coveralls.io/github/GeoStat-Framework/welltestpy?branch=master)
[![Documentation Status](https://readthedocs.org/projects/welltestpy/badge/?version=stable)](https://geostat-framework.readthedocs.io/projects/welltestpy/en/stable/?badge=stable)
[![Build Status](https://github.com/GeoStat-Framework/welltestpy/workflows/Continuous%20Integration/badge.svg?branch=develop)](https://github.com/GeoStat-Framework/welltestpy/actions)
[![Coverage Status](https://coveralls.io/repos/github/GeoStat-Framework/welltestpy/badge.svg?branch=develop)](https://coveralls.io/github/GeoStat-Framework/welltestpy?branch=develop)
[![Documentation Status](https://readthedocs.org/projects/welltestpy/badge/?version=latest)](https://geostat-framework.readthedocs.io/projects/welltestpy/en/latest/?badge=latest)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

<p align="center">
Expand All @@ -25,7 +25,7 @@ You can install the latest version with the following command:

## Documentation for welltestpy

You can find the documentation under [geostat-framework.readthedocs.io][doc_link].
You can find the documentation under [https://welltestpy.readthedocs.io][doc_link].


### Example 1: A campaign containing a pumping test
Expand Down Expand Up @@ -121,7 +121,7 @@ You can contact us via <[email protected]>.

## License

[MIT][license_link] © 2018-2020
[MIT][license_link] © 2018-2021

[license_link]: https://github.com/GeoStat-Framework/welltestpy/blob/master/LICENSE
[doc_link]: https://welltestpy.readthedocs.io
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ def setup(app):
# only show "print" output as output
"capture_repr": (),
# path to your examples scripts
"examples_dirs": ["../../examples",],
"examples_dirs": ["../../examples"],
# path where to save gallery generated examples
"gallery_dirs": ["examples",],
"gallery_dirs": ["examples"],
# Pattern to search for example files
"filename_pattern": "/.*.py",
"ignore_pattern": r"03_estimate_hetero\.py",
Expand Down
71 changes: 43 additions & 28 deletions welltestpy/estimate/steady_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ def run(
fittingplotname=None,
interactplotname=None,
estname=None,
plot_style="WTP",
):
"""Run the estimation.
Expand Down Expand Up @@ -348,11 +349,13 @@ def run(
If ``None``, it will be the current time +
``"_estimate"``.
Default: ``None``
plot_style : str, optional
Plot stlye. The default is "WTP".
"""
if self.setup.dummy:
raise ValueError(
"Estimate: for parameter estimation"
+ " you can't use a dummy paramter."
" you can't use a dummy paramter."
)
act_time = timemodule.strftime("%Y-%m-%d_%H-%M-%S")

Expand Down Expand Up @@ -405,42 +408,45 @@ def run(
else:
rank = 0

# initialize the sampler
sampler = spotpy.algorithms.sceua(
self.setup,
dbname=dbname,
dbformat="csv",
parallel=parallel,
save_sim=True,
db_precision=np.float64,
)
# start the estimation with the sce-ua algorithm
if run:
# initialize the sampler
sampler = spotpy.algorithms.sceua(
self.setup,
dbname=dbname,
dbformat="csv",
parallel=parallel,
save_sim=True,
db_precision=np.float64,
)
# start the estimation with the sce-ua algorithm
sampler.sample(rep, ngs=10, kstop=100, pcento=1e-4, peps=1e-3)

if rank == 0:
# save best parameter-set
if rank == 0:
if run:
self.result = sampler.getdata()
para_opt = spotpy.analyser.get_best_parameterset(
self.result, maximize=False
else:
self.result = np.genfromtxt(
dbname + ".csv", delimiter=",", names=True
)
void_names = para_opt.dtype.names
para = []
header = []
for name in void_names:
para.append(para_opt[0][name])
header.append(name[3:])
self.estimated_para[header[-1]] = para[-1]
np.savetxt(paraname, para, header=" ".join(header))

if rank == 0:
para_opt = spotpy.analyser.get_best_parameterset(
self.result, maximize=False
)
void_names = para_opt.dtype.names
para = []
header = []
for name in void_names:
para.append(para_opt[0][name])
header.append(name[3:])
self.estimated_para[header[-1]] = para[-1]
np.savetxt(paraname, para, header=" ".join(header))
# plot the estimation-results
plotter.plotparatrace(
result=self.result,
parameternames=paranames,
parameterlabels=paralabels,
stdvalues=self.estimated_para,
plotname=traceplotname,
style=plot_style,
)
plotter.plotfit_steady(
setup=self.setup,
Expand All @@ -450,8 +456,11 @@ def run(
radnames=self.radnames,
extra=self.extra_kw_names,
plotname=fittingplotname,
style=plot_style,
)
plotter.plotparainteract(
self.result, paralabels, interactplotname, style=plot_style
)
plotter.plotparainteract(self.result, paralabels, interactplotname)

def sensitivity(
self,
Expand All @@ -462,6 +471,7 @@ def sensitivity(
plotname=None,
traceplotname=None,
sensname=None,
plot_style="WTP",
):
"""Run the sensitivity analysis.
Expand Down Expand Up @@ -501,11 +511,13 @@ def sensitivity(
If ``None``, it will be the current time +
``"_estimate"``.
Default: ``None``
plot_style : str, optional
Plot stlye. The default is "WTP".
"""
if len(self.setup.para_names) == 1 and not self.setup.dummy:
raise ValueError(
"Sensitivity: for estimation with only one parameter"
+ " you have to use a dummy paramter."
" you have to use a dummy paramter."
)
if rep is None:
rep = spotpylib.fast_rep(
Expand Down Expand Up @@ -592,11 +604,14 @@ def sensitivity(
header = " ".join(paranames)
np.savetxt(sensname, sens_est["ST"], header=header)
np.savetxt(sensname1, sens_est["S1"], header=header)
plotter.plotsensitivity(paralabels, sens_est, plotname)
plotter.plotsensitivity(
paralabels, sens_est, plotname, style=plot_style
)
plotter.plotparatrace(
data,
parameternames=paranames,
parameterlabels=paralabels,
stdvalues=None,
plotname=traceplotname,
style=plot_style,
)
Loading

0 comments on commit 294bf41

Please sign in to comment.