Skip to content

Commit

Permalink
Merged dev-4-0-1 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
vyrjana committed Mar 22, 2023
1 parent b03e84d commit 1742097
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 4.0.1 (2023/03/22)

- Updated how `perform_exploratory_tests` handles cases where all mu values are greater than the mu-criterion.


# 4.0.0 (2023/03/20)

**THIS UPDATE CONTAINS SEVERAL CHANGES THAT ARE NOT BACKWARDS COMPATIBLE WITH CODE WRITTEN USING VERSION 3.x!**
Expand Down
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ validate_wheel
# Update documentation
# - The contents of './docs/build/html' should be committed to the gh-pages branch
# - ./docs/build/latex/latex/pyimpspec.pdf should be uploaded as an attachment to a release
# Update documentation
# - The contents of ./dist/html should be committed to the gh-pages branch
# - Run the reset.sh script found in gh-pages
# - Copy the files from ./dist/html
# - Commit
# - Force push
# - ./dist/pyimpspec-X-Y-Z.pdf should be uploaded as an attachment to a release
echo
echo "Generating documentation..."
# Generate HTML, run tests, and finally generate PDF
Expand Down
4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Documentation

The documentation is generated via `build.sh` from the repository root.
Images are stored in the wiki repository: https://github.com/vyrjana/pyimpspec.wiki.git
14 changes: 11 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,31 @@ Welcome to pyimpspec's documentation!
:alt: PyPI
:target: https://pypi.org/project/pyimpspec/


Pyimpspec is a Python package for processing, analyzing, and visualizing impedance spectra.

.. figure:: https://raw.githubusercontent.com/wiki/vyrjana/pyimpspec/images/kramers-kronig.png
:alt: Kramers-Kronig test results


The primary interface for using pyimpspec is the application programming interface (API).

.. doctest::

>>> import pyimpspec


A command-line interface (CLI) is also included to provide a way to, e.g., quickly plot some experimental data via a terminal.

.. code:: bash
# The CLI should be accessible in the terminal in the following ways
pyimpspec --version
python -m pyimpspec --version
pyimpspec
python -m pyimpspec
If you would prefer to use a graphical user interface (GUI), then check out `DearEIS <https://vyrjana.github.io/DearEIS>`_.

The source code for pyimpspec can be found `here <https://github.com/vyrjana/pyimpspec>`_.
The changelog can be found `here <https://github.com/vyrjana/pyimpspec/blob/main/CHANGELOG.md>`_.
If you encounter bugs or wish to request a feature, then please open an `issue on GitHub <https://github.com/vyrjana/pyimpspec/issues>`_.
If you wish to contribute to the project, then please read the `readme <https://github.com/vyrjana/pyimpspec/blob/main/README.md>`_ before submitting a `pull request via GitHub <https://github.com/vyrjana/pyimpspec/pulls>`_.
Expand Down
12 changes: 5 additions & 7 deletions post-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
walk,
)
from os.path import (
basename,
exists,
isdir,
join,
Expand Down Expand Up @@ -38,7 +37,7 @@ def copy_html(src: str, dst: str):
".pdf",
)
]
dirs: List[str] = ["_images", "_static"]
dirs: List[str] = ["_images", "_static", "_sources"]
if not isdir(dst):
makedirs(dst)
name: str
Expand All @@ -48,15 +47,13 @@ def copy_html(src: str, dst: str):
copytree(join(src, name), join(dst, name))


def copy_pdf(src: str, dst: str, version_path: str):
def copy_pdf(src: str, dst: str, name: str, version_path: str):
version: str = ""
with open(version_path, "r") as fp:
version = fp.read().strip().replace(".", "-")
assert version != ""
name: str
ext: str
name, ext = splitext(basename(src))
dst = join(dst, f"{name} - {version}{ext}")
ext: str = splitext(src)[1]
dst = join(dst, f"{name}-{version}{ext}")
if exists(dst):
remove(dst)
copy(src, dst)
Expand All @@ -70,5 +67,6 @@ def copy_pdf(src: str, dst: str, version_path: str):
copy_pdf(
src="./docs/build/latex/latex/pyimpspec.pdf",
dst="./dist",
name="pyimpspec",
version_path="./version.txt",
)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dev": dev_dependencies,
}

version = "4.0.0"
version = "4.0.1"

if __name__ == "__main__":
with open("requirements.txt", "w") as fp:
Expand Down
13 changes: 9 additions & 4 deletions src/pyimpspec/analysis/kramers_kronig.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
floating,
inf,
integer,
isinf,
issubdtype,
log10 as log,
min,
Expand Down Expand Up @@ -1448,8 +1449,12 @@ def perform_exploratory_tests(
residuals=_calculate_residuals(Z_exp, Z_fit),
)
)
results.sort(
key=lambda _: _.calculate_score(mu_criterion),
reverse=True,
)
scores: List[float] = [_.calculate_score(mu_criterion) for _ in results]
if all(map(isinf, scores)):
results.sort(key=lambda _: abs(-6 - log(_.pseudo_chisqr)))
else:
results.sort(
key=lambda _: _.calculate_score(mu_criterion),
reverse=True,
)
return results
2 changes: 1 addition & 1 deletion src/pyimpspec/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
# The licenses of pyimpspec's dependencies and/or sources of portions of code are included in
# the LICENSES folder.

PACKAGE_VERSION: str = "4.0.0"
PACKAGE_VERSION: str = "4.0.1"
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0
4.0.1

0 comments on commit 1742097

Please sign in to comment.