diff --git a/.github/workflows/build-and-deploy-docs.yml b/.github/workflows/build-and-deploy-docs.yml index 2a67e6ea..760b9b68 100644 --- a/.github/workflows/build-and-deploy-docs.yml +++ b/.github/workflows/build-and-deploy-docs.yml @@ -1,28 +1,24 @@ +--- # Simple workflow for deploying static content to GitHub Pages name: Deploy static content to Pages - on: # Runs on pushes targeting the default branch push: - branches: ["main"] - + branches: [main] pull_request: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: - # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: id-token: write pages: write contents: read - # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: - group: "pages" + group: pages cancel-in-progress: false - jobs: build_docs_and_deploy: runs-on: ubuntu-latest @@ -54,7 +50,7 @@ jobs: uses: actions/upload-pages-artifact@v3 with: # Upload entire repository - path: "./docs/build/html" + path: ./docs/build/html - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 51b1017a..e5d30ed0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,14 +1,12 @@ +--- # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Python package - on: push: - branches: ["main"] + branches: [main] pull_request: - branches: ["main"] - + branches: [main] jobs: build: runs-on: ubuntu-latest @@ -16,8 +14,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 35081d4e..17c3177c 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,3 +1,4 @@ +--- # This workflow will upload a Python Package using Twine when a release is created # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries @@ -5,26 +6,21 @@ # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support # documentation. - name: Upload Python Package - on: release: types: [published] - permissions: contents: read - jobs: deploy: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v3 with: - python-version: "3.x" + python-version: 3.x - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/CHANGELOG.md b/CHANGELOG.md index 3139d225..f96dbbe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] -## [0.6.3] - 2025-08-17 +## [0.6.3] - 2025-10-15 ### Added @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - Updated docstrings throughout the codebase - Auto-formatted code for consistency - Migrated from setup.cfg to pyproject.toml +- Removed 760m/s boundary on mu estimation formula when generating G/Gmax + curve parameters for the hybrid hyperbolic model ### Removed diff --git a/PySeismoSoil/helper_hh_calibration.py b/PySeismoSoil/helper_hh_calibration.py index 24e1927d..b9eef298 100644 --- a/PySeismoSoil/helper_hh_calibration.py +++ b/PySeismoSoil/helper_hh_calibration.py @@ -476,21 +476,17 @@ def produce_HH_G_param( mu = np.zeros_like(OCR) for j in range(n_layer): - if Vs[j] <= 760: # softer soil: use Vardanega & Bolton (2011) CGJ formula - mu[j] = 1.0 / ( - 0.000872 * Gmax[j] / Tmax[j] * OCR[j] ** 0.47 * p0[j] ** 0.28 - ) # noqa: E226 - if mu[j] <= 0.02: # mu too small --> too low tau_FKZ --> sharply decreasing tau_HH - # 0.236 is the standard error suggested in Vardanega & Bolton (2011) - mu[j] = mu[j] * 10.0 ** (0.236 * 3) - elif mu[j] <= 0.03: - mu[j] = mu[j] * 10.0 ** (0.236 * 2) - elif mu[j] <= 0.04: - mu[j] = mu[j] * 10.0 ** (0.236 * 1) - # END IF - else: # stiffer soils: set mu to 1 for lack of better information - mu[j] = 1.0 - # END IF + # softer soil: use Vardanega & Bolton (2011) CGJ formula + mu[j] = 1.0 / ( + 0.000872 * Gmax[j] / Tmax[j] * OCR[j] ** 0.47 * p0[j] ** 0.28 + ) # noqa: E226 + if mu[j] <= 0.02: # mu too small --> too low tau_FKZ --> sharply decreasing tau_HH + # 0.236 is the standard error suggested in Vardanega & Bolton (2011) + mu[j] = mu[j] * 10.0 ** (0.236 * 3) + elif mu[j] <= 0.03: + mu[j] = mu[j] * 10.0 ** (0.236 * 2) + elif mu[j] <= 0.04: + mu[j] = mu[j] * 10.0 ** (0.236 * 1) # END FOR # ========== Start FKZ optimization ======================================= diff --git a/README.md b/README.md index 23e26ab7..688a6d1d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ If you already have an older version installed and want to upgrade to the newest PySeismoSoil currently support these Python versions: -- 3.9 - 3.10 - 3.11 - 3.12 diff --git a/pyproject.toml b/pyproject.toml index a8a8677b..9c883084 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "matplotlib>=2.0.0", "numba>=0.38.0", diff --git a/tests/files/HH_G_FKSH14.txt b/tests/files/HH_G_FKSH14.txt index ec3c6e3a..69dd493f 100644 --- a/tests/files/HH_G_FKSH14.txt +++ b/tests/files/HH_G_FKSH14.txt @@ -1,9 +1,9 @@ -0.00076244 0.00139754 0.000110308 0.000104122 0.00010717 +0.00076244 0.00139754 0.000110308 0.000104122 0.00010116 100 100 100 100 100 0.000314063 0.000448739 0.000608263 0.000837192 0.000940767 1 1 1 1 1 0.919 0.919 0.919 0.919 0.919 2.69257e+07 6.70011e+07 1.46383e+08 2.41314e+09 3.37484e+09 -0.206245 0.211334 0.257876 1 1 +0.206245 0.211334 0.257876 0.0686843 0.0662230 27822.5 65841.5 148710 815621 1.13262e+06 -0.908794 0.89794 0.861759 0.981156 0.977538 +0.908794 0.897940 0.861759 0.688091 0.684472 diff --git a/tests/test_class_hh_calibration.py b/tests/test_class_hh_calibration.py index 39ef36d4..d193f16b 100644 --- a/tests/test_class_hh_calibration.py +++ b/tests/test_class_hh_calibration.py @@ -90,21 +90,69 @@ def test_fit__case_2_with_both_Vs_profile_and_GGmax_curves(self): HH_G_param = hh_c.fit(verbose=False) HH_G_benchmark_data = np.array( [ - [0.0003, 0.0001, 0.0001, 0.0001, 0.0001], - [100, 100, 100, 100, 100], [ - 0.000285072, - 0.000516205, - 0.000944545, - 0.00129825, - 0.00144835, + 3.0000000e-04, + 1.0000000e-04, + 1.0000000e-04, + 1.0000000e-05, + 1.0000000e-04, + ], + [ + 1.0000000e02, + 1.0000000e02, + 1.0000000e02, + 1.0000000e02, + 1.0000000e02, + ], + [ + 2.8507234e-04, + 5.1624545e-04, + 9.4453471e-04, + 1.2979909e-03, + 1.4497853e-03, + ], + [ + 1.7522706e00, + 1.7145687e00, + 1.6405793e00, + 1.5863492e00, + 1.5645630e00, + ], + [ + 9.1900098e-01, + 9.1900268e-01, + 9.1899964e-01, + 9.1900711e-01, + 9.1899869e-01, + ], + [ + 2.1110400e07, + 6.8590000e07, + 1.4896000e08, + 2.2544125e09, + 3.2839763e09, + ], + [ + 2.3335679e-01, + 1.9914917e-01, + 2.5378449e-01, + 4.1906791e-02, + 6.5981061e-02, + ], + [ + 2.6500966e04, + 6.4856617e04, + 1.4880507e05, + 8.0485491e05, + 1.1078508e06, + ], + [ + 9.3773869e-01, + 8.5090452e-01, + 8.6175879e-01, + 1.0300000e00, + 6.8809045e-01, ], - [1.75224, 1.71444, 1.64057, 1.58664, 1.56314], - [0.918975, 0.919001, 0.918973, 0.919007, 0.918999], - [2.11104e07, 6.859e07, 1.4896e08, 2.25441e09, 3.28398e09], - [0.233357, 0.199149, 0.253784, 1, 1], - [26501, 64856.6, 148805, 804855, 1.10785e06], - [0.937739, 0.850905, 0.861759, 0.984774, 0.981156], ], ) HH_G_param_benchmark = HH_Param_Multi_Layer(HH_G_benchmark_data) diff --git a/tests/test_helper_generic.py b/tests/test_helper_generic.py index f6785932..0dd8721c 100644 --- a/tests/test_helper_generic.py +++ b/tests/test_helper_generic.py @@ -132,9 +132,7 @@ def test_extend_scalar(self): hlp.extend_scalar(np.ones(3), 2) # Case #2: `length` is something strange - self.assertTrue( - np.allclose(hlp.extend_scalar(2.5, None), np.array(2.5)) - ) + self.assertTrue(np.allclose(hlp.extend_scalar(2.5, ()), np.array(2.5))) # Case #3: `length` is an integer self.assertTrue( diff --git a/tests/test_helper_hh_calibration.py b/tests/test_helper_hh_calibration.py index 341b9c4f..0859c6db 100644 --- a/tests/test_helper_hh_calibration.py +++ b/tests/test_helper_hh_calibration.py @@ -230,21 +230,69 @@ def test_hh_param_from_curves__case_1(self): ) HH_G_benchmark = np.array( [ - [0.0003, 0.0001, 0.0001, 0.0001, 0.0001], - [100, 100, 100, 100, 100], [ - 0.000285072, - 0.000516205, - 0.000944545, - 0.00129825, - 0.00144835, + 3.000000e-04, + 1.000000e-04, + 1.000000e-04, + 1.000000e-05, + 1.000000e-04, + ], + [ + 1.000000e02, + 1.000000e02, + 1.000000e02, + 1.000000e02, + 1.000000e02, + ], + [ + 2.850723e-04, + 5.162455e-04, + 9.445347e-04, + 1.297991e-03, + 1.449785e-03, + ], + [ + 1.752271e00, + 1.714569e00, + 1.640579e00, + 1.586349e00, + 1.564563e00, + ], + [ + 9.190010e-01, + 9.190027e-01, + 9.189996e-01, + 9.190071e-01, + 9.189987e-01, + ], + [ + 2.111040e07, + 6.859000e07, + 1.489600e08, + 2.254412e09, + 3.283976e09, + ], + [ + 2.333568e-01, + 1.991492e-01, + 2.537845e-01, + 4.190679e-02, + 6.598106e-02, + ], + [ + 2.650097e04, + 6.485662e04, + 1.488051e05, + 8.048549e05, + 1.107851e06, + ], + [ + 9.377387e-01, + 8.509045e-01, + 8.617588e-01, + 1.030000e00, + 6.880905e-01, ], - [1.75224, 1.71444, 1.64057, 1.58664, 1.56314], - [0.918975, 0.919001, 0.918973, 0.919007, 0.918999], - [2.11104e07, 6.859e07, 1.4896e08, 2.25441e09, 3.28398e09], - [0.233357, 0.199149, 0.253784, 1, 1], - [26501, 64856.6, 148805, 804855, 1.10785e06], - [0.937739, 0.850905, 0.861759, 0.984774, 0.981156], ], ) # use higher tolerance because MKZ curve fitting has room for small errors diff --git a/tox.ini b/tox.ini index 37e8da81..f3aa941f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,5 @@ [tox] envlist = - py39 py310 py311 py312 @@ -15,7 +14,6 @@ envlist = [gh-actions] python = - 3.9: py39, cercis, check-self, flake8-basic, flake8-misc, flake8-docstrings, pre-commit 3.10: py310, cercis, check-self, flake8-basic, flake8-misc, flake8-docstrings, pre-commit 3.11: py311, cercis, check-self, flake8-basic, flake8-misc, flake8-docstrings, pre-commit 3.12: py312, cercis, check-self, flake8-basic, flake8-misc, flake8-docstrings, pre-commit