Skip to content

Commit

Permalink
Merged dev-4-1-1 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
vyrjana committed Mar 14, 2024
1 parent 8a0ee85 commit 477f0c1
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 54 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand All @@ -29,7 +29,7 @@ jobs:
python -m pip install flake8
python -m pip install jinja2
python -m pip install -e .
python -m pip install kvxopt
python -m pip install cvxopt
- name: Lint with flake8
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 4.1.1 (2024/03/14)

- Maintenance release that updates the version requirements for dependencies.
- Support for Python 3.8 has been dropped due to minimum requirements set by one or more dependencies.
- Support for Python 3.11 and 3.12 has been added.
- Added Jinja2 as an explicit dependency.
- Updated the automated determination of how many parallel processes to use.


# 4.1.0 (2023/04/03)

- Added the L-curve corner search algorithm described in DOI:10.1088/2633-1357/abad0d as an approach for automatically finding the optimal regularization parameter in DRT methods that use Tikhonov regularization.
Expand Down
28 changes: 28 additions & 0 deletions LICENSES/LICENSE-Jinja.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Copyright 2007 Pallets

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5 changes: 5 additions & 0 deletions LICENSES/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
- License: MIT
- Copied code to implement linear Kramers-Kronig tests using matrix solvers.

# Jinja
- https://github.com/pallets/jinja/
- License: BSD 3-clause
- Optional dependency of _pandas_ for generating formatted strings (e.g., LaTeX).

# kvxopt
- https://github.com/sanurielf/kvxopt
- License: GPLv3 or later
Expand Down
8 changes: 4 additions & 4 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build~=0.10
build~=1.1
flake8~=6.0
setuptools~=67.2
sphinx~=5.3
sphinx-rtd-theme~=1.2
setuptools~=69.2
sphinx~=7.2
sphinx-rtd-theme~=2.0
1 change: 1 addition & 0 deletions docs/source/guide_installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Requirements
- `Python <https://www.python.org>`_ (3.8, 3.9, or 3.10)
- The following Python packages

- `Jinja <https://jinja.palletsprojects.com/>`_
- `lmfit <https://lmfit.github.io/lmfit-py/>`_
- matplotlib_
- `numdifftools <https://numdifftools.readthedocs.io/en/latest/>`_
Expand Down
19 changes: 10 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
lmfit~=1.0
matplotlib~=3.6
Jinja2~=3.1
lmfit~=1.2
matplotlib~=3.8
numdifftools~=0.9
numpy~=1.24
numpy~=1.26
odfpy~=1.4
openpyxl~=3.1
pandas~=1.5
schemdraw~=0.15
scipy~=1.10
statsmodels~=0.13
sympy~=1.11
pandas~=2.2
schemdraw~=0.18
scipy~=1.12
statsmodels~=0.14
sympy~=1.12
tabulate~=0.9
xdg~=6.0
xdg~=6.0
34 changes: 18 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,40 @@
}

dependencies = [
"lmfit~=1.0", # Needed for performing non-linear fitting.
"matplotlib~=3.6", # Needed for the plotting module.
"Jinja2~=3.1", # Needed when turning pandas.DataFrames instances into, e.g., LaTeX strings.
"lmfit~=1.2", # Needed for performing non-linear fitting.
"matplotlib~=3.8", # Needed for the plotting module.
"numdifftools~=0.9", # Needed for estimating uncertainties during circuit fitting
"numpy~=1.24",
"numpy~=1.26",
"odfpy~=1.4", # Needed by pandas for parsing OpenDocument spreadsheet formats.
"openpyxl~=3.1", # Needed by pandas for parsing newer Excel files (.xlsx).
"pandas~=1.5", # Needed for dealing with various file formats.
"schemdraw~=0.15", # Needed to draw circuit diagrams
"scipy~=1.10", # Used in the DRT calculations
"statsmodels~=0.13", # Used for smoothing (LOWESS) in Z-HIT
"sympy~=1.11", # Used to generate expressions for circuits
"pandas~=2.2", # Needed for dealing with various file formats.
"schemdraw~=0.18", # Needed to draw circuit diagrams
"scipy~=1.12", # Used in the DRT calculations
"statsmodels~=0.14", # Used for smoothing (LOWESS) in Z-HIT
"sympy~=1.12", # Used to generate expressions for circuits
"tabulate~=0.9", # Required by pandas to generate Markdown tables.
# TODO: The 'xdg' package has been renamed to 'xdg-base-dirs' and changed
# to only support Python >=3.10. Update at some point in the future.
"xdg~=6.0",
]

dev_dependencies = [
"build~=0.10",
"build~=1.1",
"flake8~=6.0",
"setuptools~=67.2",
"sphinx~=5.3",
"sphinx-rtd-theme~=1.2",
"setuptools~=69.2",
"sphinx~=7.2",
"sphinx-rtd-theme~=2.0",
]

optional_dependencies = {
"cvxopt": "cvxopt~=1.3", # Used in the DRT calculations (TR-RBF method)
"kvxopt": "kvxopt~=1.3", # Fork of cvxopt that may provide wheels for additional platforms
"cvxpy": "cvxpy~=1.3", # Used in the DRT calculations (TR-RBF method)
"cvxpy": "cvxpy~=1.4", # Used in the DRT calculations (TR-RBF method)
"dev": dev_dependencies,
}

version = "4.1.0"
version = "4.1.1"

if __name__ == "__main__":
with open("requirements.txt", "w") as fp:
Expand Down Expand Up @@ -77,16 +78,17 @@
entry_points=entry_points,
install_requires=dependencies,
extras_require=optional_dependencies,
python_requires=">=3.8",
python_requires=">=3.9",
classifiers=[
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering :: Chemistry",
"Topic :: Scientific/Engineering :: Physics",
Expand Down
29 changes: 18 additions & 11 deletions src/pyimpspec/analysis/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,25 @@ def _get_default_num_procs() -> int:
"mkl": "MKL_NUM_THREADS",
}
libraries: Set[str] = set()
key: str
for key in [_ for _ in map(str.lower, dir(numpy_config)) if "_info" in _]:
obj: Any = getattr(numpy_config, key)
if not isinstance(obj, dict):
continue
elif "libraries" not in obj:
continue
elif len(obj["libraries"]) == 0:
continue
libraries.update(set(obj["libraries"]))

if hasattr(numpy_config, "CONFIG"):
key: str
obj: Any
for key, obj in numpy_config.CONFIG.items():
if not isinstance(obj, dict):
continue

blas_config: dict = obj.get("blas", {})
if not blas_config or not blas_config.get("found", False):
continue

lib: str
for lib in multithreaded:
if lib in blas_config.get("name", ""):
libraries.add(lib)

name: str
for name in libraries:
lib: str
env: str
for lib, env in multithreaded.items():
if lib in name:
Expand All @@ -184,4 +190,5 @@ def _get_default_num_procs() -> int:
else:
num_procs: int = num_cores // num_threads
return num_procs if num_procs > 1 else 1

return num_cores
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.1.0"
PACKAGE_VERSION: str = "4.1.1"
8 changes: 4 additions & 4 deletions tests/test_kramers_kronig.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ class KramersKronigImaginaryManualWithCapacitanceInductance(
class KramersKronigCNLS(KramersKronigComplex):
arg_test: str = "cnls"
cmp_cdc: str = "[RKKKKKKKKKKKKKK]"
cmp_mu: float = 0.8309531383631978
cmp_mu: float = 0.8320354036592371
cmp_num_RC: int = 14
cmp_pseudo_chisqr: float = 0.0013382040618625823

Expand Down Expand Up @@ -515,7 +515,7 @@ class KramersKronigCNLSWithCapacitanceInductance(KramersKronigCNLS):
class KramersKronigCNLSManual(KramersKronigCNLS):
arg_num_RC: int = 16
cmp_cdc: str = "[RKKKKKKKKKKKKKKKK]"
cmp_mu: float = 0.5071129711073297
cmp_mu: float = 0.5273614432492131
cmp_num_RC: int = 16
cmp_pseudo_chisqr: float = 0.00147272884582866392

Expand Down Expand Up @@ -810,7 +810,7 @@ class ExploratoryImaginaryManualWithCapacitanceInductance(ExploratoryImaginaryMa
class ExploratoryCNLS(ExploratoryComplex):
arg_test: str = "cnls"
cmp_cdc: str = "[RKKKKKKKKKKKKKK]"
cmp_mu: float = 0.830916902923411
cmp_mu: float = 0.8320354036592371
cmp_num_RC: int = 14
cmp_pseudo_chisqr: float = 0.0013382191152589255

Expand Down Expand Up @@ -846,7 +846,7 @@ class ExploratoryCNLSWithCapacitanceInductance(ExploratoryCNLS):
class ExploratoryCNLSManual(ExploratoryCNLS):
arg_num_RCs: List[int] = list(range(2, DATA.get_num_points()))
cmp_cdc: str = "[RKKKKKKKKKKKKKK]"
cmp_mu: float = 0.830916902923411
cmp_mu: float = 0.8320354036592371
cmp_num_RC: int = 14
cmp_pseudo_chisqr: float = 0.0013382191152589255

Expand Down
2 changes: 1 addition & 1 deletion tests/test_zhit.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_auto_smoothing(self):
window="boxcar",
)
self.assertIsInstance(zhit, ZHITResult)
self.assertNotEqual(zhit.smoothing, "lowess")
self.assertNotEqual(zhit.smoothing, "auto")
self.assertEqual(zhit.interpolation, "cubic")
self.assertEqual(zhit.window, "boxcar")

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.0
4.1.1

0 comments on commit 477f0c1

Please sign in to comment.