Skip to content

Commit

Permalink
Merge pull request #51 from mvdh7/develop
Browse files Browse the repository at this point in the history
Merge for v0.5.3
  • Loading branch information
mvdh7 authored Oct 24, 2023
2 parents c7d107a + 43500f4 commit aeeb546
Show file tree
Hide file tree
Showing 86 changed files with 4,685 additions and 733 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: docs
on:
push:
branches:
- develop
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
16 changes: 5 additions & 11 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
pip install pytest pandas openpyxl
pip install .
- name: Test with pytest
run: |
pytest
Expand Down
4 changes: 2 additions & 2 deletions .misc/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 32 additions & 16 deletions .misc/coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,56 @@ Name Stmts Miss Cover
----------------------------------------------------------------
pytzer/__init__.py 15 0 100%
pytzer/constants.py 14 0 100%
pytzer/convert.py 30 6 80%
pytzer/convert.py 30 19 37%
pytzer/debyehueckel.py 69 9 87%
pytzer/dissociation.py 152 70 54%
pytzer/dissociation.py 175 54 69%
pytzer/equilibrate/__init__.py 41 15 63%
pytzer/equilibrate/components.py 352 140 60%
pytzer/equilibrate/components.py 364 86 76%
pytzer/equilibrate/stoichiometric.py 118 1 99%
pytzer/equilibrate/thermodynamic.py 83 17 80%
pytzer/io.py 37 5 86%
pytzer/equilibrate/thermodynamic.py 83 10 88%
pytzer/get.py 37 5 86%
pytzer/libraries/Clegg22.py 88 0 100%
pytzer/libraries/Clegg23.py 158 0 100%
pytzer/libraries/Clegg94.py 11 0 100%
pytzer/libraries/Greenberg89.py 25 0 100%
pytzer/libraries/Harvie84.py 259 0 100%
pytzer/libraries/MarChemSpec.py 111 0 100%
pytzer/libraries/HeMorse93.py 274 0 100%
pytzer/libraries/Humphreys22.py 77 0 100%
pytzer/libraries/MarChemSpec25.py 107 0 100%
pytzer/libraries/MarChemSpec.py 111 0 100%
pytzer/libraries/Millero98.py 255 0 100%
pytzer/libraries/Moller88.py 17 0 100%
pytzer/libraries/ParameterLibrary.py 247 13 95%
pytzer/libraries/MyMarChemSpecCO2.py 43 0 100%
pytzer/libraries/ParameterLibrary.py 333 96 71%
pytzer/libraries/Seawater.py 257 0 100%
pytzer/libraries/Waters13.py 95 0 100%
pytzer/libraries/Waters13.py 98 0 100%
pytzer/libraries/Waters13_Clegg22.py 110 0 100%
pytzer/libraries/Waters13_Humphreys22.py 99 0 100%
pytzer/libraries/Waters13_MarChemSpec25.py 95 0 100%
pytzer/libraries/__init__.py 21 0 100%
pytzer/libraries/__init__.py 35 0 100%
pytzer/matrix.py 48 36 25%
pytzer/meta.py 12 1 92%
pytzer/model.py 111 2 98%
pytzer/parameters.py 6323 5012 21%
pytzer/prepare.py 113 98 13%
pytzer/model.py 117 6 95%
pytzer/parameters/__init__.py 6382 4403 31%
pytzer/parameters/heMorse1993.py 165 70 58%
pytzer/parameters/holmesMesmer1992.py 33 26 21%
pytzer/parameters/pabalanPitzer1987.py 57 33 42%
pytzer/parameters/spencer1990.py 33 26 21%
pytzer/prepare.py 113 94 17%
pytzer/properties.py 5 0 100%
pytzer/teos10.py 41 10 76%
pytzer/unsymmetrical.py 46 1 98%
tests/__init__.py 0 0 100%
tests/test_CRP94.py 11 0 100%
tests/test_M88.py 16 0 100%
tests/test_convert.py 25 0 100%
tests/test_CRP94.py 34 0 100%
tests/test_CWTD23_params.py 238 2 99%
tests/test_CWTD23_solver.py 51 1 98%
tests/test_HWT22_params.py 125 9 93%
tests/test_HWT22_solver.py 104 0 100%
tests/test_M88.py 14 0 100%
tests/test_jax_settings.py 4 0 100%
tests/test_model.py 41 0 100%
tests/test_pKs.py 13 0 100%
tests/test_stoichiometric.py 130 0 100%
tests/test_unsymmetrical.py 33 0 100%
----------------------------------------------------------------
TOTAL 9322 5400 42%
TOTAL 11237 5013 55%
19 changes: 0 additions & 19 deletions .readthedocs.yml

This file was deleted.

19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Pytzer

![Tests](https://github.com/mvdh7/pytzer/workflows/Tests/badge.svg)
[![Coverage](https://github.com/mvdh7/pytzer/blob/master/.misc/coverage.svg)](https://github.com/mvdh7/pytzer/blob/master/.misc/coverage.txt)
[![Coverage](https://github.com/mvdh7/pytzer/blob/main/.misc/coverage.svg)](https://github.com/mvdh7/pytzer/blob/main/.misc/coverage.txt)
[![pypi badge](https://img.shields.io/pypi/v/pytzer.svg?style=popout)](https://pypi.org/project/pytzer/)
[![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.2637914-informational)](https://doi.org/10.5281/zenodo.2637914)
[![Docs](https://readthedocs.org/projects/pytzer/badge/?version=latest&style=flat)](https://pytzer.readthedocs.io/en/latest/)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Pytzer is a Python implementation of the Pitzer model for chemical activities in aqueous solutions [[P91](https://pytzer.readthedocs.io/en/jax/refs/#p)] plus solvers to determine the equilibrium state of the system.
Pytzer is a Python implementation of the Pitzer model for chemical activities in aqueous solutions [[P91](https://mvdh.xyz/pytzer/refs/#p)] plus solvers to determine the equilibrium state of the system.

**Pytzer is in beta! Use at your own peril.**

Expand All @@ -35,25 +34,17 @@ Once installed, you will need to set the environment variable `JAX_ENABLE_X64=Tr

conda env config vars set JAX_ENABLE_X64=True

### For development

Use the [environment.yml](https://github.com/mvdh7/pytzer/blob/master/environment.yml) file to create a new environment with Conda:

conda env create -f environment.yml

Then, fork and/or clone this repo to somewhere that your Python can see it.

## Documentation

A work in progress at [pytzer.readthedocs.io](https://pytzer.readthedocs.io/en/latest/).
A work in progress at [mvdh.xyz/pytzer](https://mvdh.xyz/pytzer).

## Citation

Pytzer is maintained by [Dr Matthew P. Humphreys](https://humphreys.science) at the [NIOZ Royal Netherlands Institute for Sea Research](https://www.nioz.nl/en) (Texel, the Netherlands).
Pytzer is maintained by [Dr Matthew P. Humphreys](https://seaco2.group) at the [NIOZ Royal Netherlands Institute for Sea Research](https://www.nioz.nl/en) (Texel, the Netherlands).

For now, the appropriate citation is:

> Humphreys, Matthew P. and Schiller, Abigail J. (2021). Pytzer: the Pitzer model for chemical activities and equilibria in aqueous solutions in Python (beta). *Zenodo.* [doi:10.5281/zenodo.2637914](https://doi.org/10.5281/zenodo.2637914).
> Humphreys, Matthew P. and Schiller, Abigail J. (2023). Pytzer: the Pitzer model for chemical activities and equilibria in aqueous solutions in Python (beta). *Zenodo.* [doi:10.5281/zenodo.2637914](https://doi.org/10.5281/zenodo.2637914).
Please report which version of Pytzer you are using. You can find this in Python with:

Expand Down
4 changes: 3 additions & 1 deletion docs/equilibrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ There are two 'layers' of solver in Pytzer: stoichiometric and thermodynamic.

The stoichiometric solver determines the molality of each solute given a set of total molalities and fixed stoichiometric equilibrium constants. It uses a Newton-Raphson iterative method that is fully compatible with JAX.

The thermodynamic solver wraps the stoichiometric solver and adjusts the stoichiometric equilibrium constants to agree with thermodynamic constraints. Because it uses [`scipy.optimize.root`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.root.html), it cannot be differentiated or compiled with JAX.
The thermodynamic solver wraps the stoichiometric solver and adjusts the stoichiometric equilibrium constants to agree with thermodynamic constraints. Because it uses [`scipy.optimize.root`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.root.html), it cannot be yet[^1] differentiated or compiled with JAX.

[^1]: We are planning to merge the two solvers together, making the entire program grad-able and jit-able by JAX, in a future release.

You can solve equilibria using the following functions. Lower-level approaches with more fine control are possible, but not yet documented.

Expand Down
15 changes: 7 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Pytzer

![Tests](https://github.com/mvdh7/pytzer/workflows/Tests/badge.svg)
[![Coverage](img/coverage.svg)](https://github.com/mvdh7/pytzer/blob/master/.misc/coverage.txt)
<!-- ![Tests](https://github.com/mvdh7/pytzer/workflows/Tests/badge.svg)
[![Coverage](img/coverage.svg)](https://github.com/mvdh7/pytzer/blob/main/.misc/coverage.txt)
[![pypi badge](https://img.shields.io/pypi/v/pytzer.svg?style=popout)](https://pypi.org/project/pytzer/)
[![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.2637914-informational)](https://doi.org/10.5281/zenodo.2637914)
[![Docs](https://readthedocs.org/projects/pytzer/badge/?version=latest&style=flat)](https://pytzer.readthedocs.io/en/latest/)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -->

Pytzer is a Python implementation of the Pitzer model for chemical activities in aqueous solutions [[P91](refs/#p)] plus solvers to determine the equilibrium state of the system.
Pytzer is a Python implementation of the Pitzer model for chemical activities in aqueous solutions ([P91](refs/#p)) plus an equilibrium solver.

## Installation

Consult the [README.md on GitHub](https://github.com/mvdh7/pytzer/tree/master#pytzer) for up-to-date installation instructions.
Consult the [README.md on GitHub](https://github.com/mvdh7/pytzer/tree/main#pytzer) for up-to-date installation instructions.

## Development status

Expand All @@ -22,7 +21,7 @@ Pytzer is in beta. Tests of the accuracy of its parameters and equations are un

A manuscript describing Pytzer is in preparation. In the meantime, please cite:

> Humphreys, Matthew P. and Schiller, Abigail J. (2021). Pytzer: the Pitzer model for chemical activities and equilibria in aqueous solutions in Python (beta). *Zenodo.* [doi:10.5281/zenodo.2637914](https://doi.org/10.5281/zenodo.2637914).
> Humphreys, Matthew P. and Schiller, Abigail J. (2023). Pytzer: the Pitzer model for chemical activities and equilibria in aqueous solutions in Python (beta). *Zenodo.* [doi:10.5281/zenodo.2637914](https://doi.org/10.5281/zenodo.2637914).
Please report the version you are using. You can find this in Python with:

Expand All @@ -33,7 +32,7 @@ pz.hello()

## Acknowledgements

Pytzer is maintained by [Dr Matthew P. Humphreys](https://humphreys.science) at the NIOZ Royal Netherlands Institute for Sea Research (Texel, the Netherlands). Its initial development at the University of East Anglia was funded indirectly by the Natural Environment Research Council (NERC, UK).
Pytzer is maintained by [Dr Matthew P. Humphreys](https://seaco2.group) at the NIOZ Royal Netherlands Institute for Sea Research (Texel, the Netherlands). Its initial development at the University of East Anglia was funded indirectly by the Natural Environment Research Council (NERC, UK).

Pytzer contains many functions and coefficients representing the effects of different solute interactions on solution properties that have been empirically determined from painstaking experiments and data compilations by hundreds of researchers over the course at least a century. We have done our best to list the small selection of this enormous body of work brought together here in the [references](refs).

Expand Down
2 changes: 2 additions & 0 deletions docs/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ from pytzer.libraries import Seawater

The options are:

* `Clegg22`: [CHW22](../refs/#c)
* `Clegg94`: [CRP94](../refs/#c)
* `Greenberg89`: [GM89](../refs/#m)
* `Harvie84`: [HMW84](../refs/#h)
* `Humphreys22`: [HWT22](../refs/#h)
* `MarChemSpec`
* `MarChemSpec25`
* `Millero98`: [MP98](../refs/#m), a.k.a. MIAMI
Expand Down
Loading

0 comments on commit aeeb546

Please sign in to comment.