From a86e60e2c11126744b658c78460a6c5c9039ee6a Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:48:43 -0700 Subject: [PATCH 01/20] Update helper_hh_calibration.py We remove the 760m/s Vs limit which was resulting in occasional instabilities for smooth Vs profiles that cross the 760m/s boundary. (correct this time) --- PySeismoSoil/helper_hh_calibration.py | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/PySeismoSoil/helper_hh_calibration.py b/PySeismoSoil/helper_hh_calibration.py index 24e1927d..d35d76be 100644 --- a/PySeismoSoil/helper_hh_calibration.py +++ b/PySeismoSoil/helper_hh_calibration.py @@ -476,21 +476,21 @@ 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 + # fx (251012): we remove the 760m/s limitation on applying the + # formula, where mu was being set to 1.0 for Vs higher than 760m/s, + # which caused occasional instabilities for Vs profiles that cross + # 760m/s in a smooth manner + 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 ======================================= From 9667afe77ce2b08cd94629cba1fc7d3f3836d7b3 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 00:34:13 -0700 Subject: [PATCH 02/20] Minor comment edit Removed the initials and date on the explanatory comment in the code --- PySeismoSoil/helper_hh_calibration.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PySeismoSoil/helper_hh_calibration.py b/PySeismoSoil/helper_hh_calibration.py index d35d76be..f389d0e4 100644 --- a/PySeismoSoil/helper_hh_calibration.py +++ b/PySeismoSoil/helper_hh_calibration.py @@ -477,10 +477,11 @@ def produce_HH_G_param( mu = np.zeros_like(OCR) for j in range(n_layer): # softer soil: use Vardanega & Bolton (2011) CGJ formula - # fx (251012): we remove the 760m/s limitation on applying the + # We remove the former 760m/s limitation on applying the # formula, where mu was being set to 1.0 for Vs higher than 760m/s, # which caused occasional instabilities for Vs profiles that cross - # 760m/s in a smooth manner + # 760m/s in a smooth manner. We allow the CGJ formula to apply + # to stiffer soils as well. mu[j] = 1.0 / ( 0.000872 * Gmax[j] / Tmax[j] * OCR[j] ** 0.47 * p0[j] ** 0.28 ) # noqa: E226 From 4164ef9ff82792f162fb9d7d8d715535dee60ce2 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 21:20:25 -0700 Subject: [PATCH 03/20] Adjusting test corresponding to hh calibration From 95708e6eee4cbe96631ce352dd85939937aabfab Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 21:23:02 -0700 Subject: [PATCH 04/20] Fixing hh calibration test --- tests/test_helper_hh_calibration.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/tests/test_helper_hh_calibration.py b/tests/test_helper_hh_calibration.py index 341b9c4f..348499ed 100644 --- a/tests/test_helper_hh_calibration.py +++ b/tests/test_helper_hh_calibration.py @@ -230,21 +230,15 @@ 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, - ], - [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], + [3.000000e-04, 1.000000e-04, 1.000000e-04, 1.000000e-05, 1.000000e-04], + [1.000000e+02, 1.000000e+02, 1.000000e+02, 1.000000e+02, 1.000000e+02], + [2.850723e-04, 5.162455e-04, 9.445347e-04, 1.297991e-03, 1.449785e-03], + [1.752271e+00, 1.714569e+00, 1.640579e+00, 1.586349e+00, 1.564563e+00], + [9.190010e-01, 9.190027e-01, 9.189996e-01, 9.190071e-01, 9.189987e-01], + [2.111040e+07, 6.859000e+07, 1.489600e+08, 2.254412e+09, 3.283976e+09], + [2.333568e-01, 1.991492e-01, 2.537845e-01, 4.190679e-02, 6.598106e-02], + [2.650097e+04, 6.485662e+04, 1.488051e+05, 8.048549e+05, 1.107851e+06], + [9.377387e-01, 8.509045e-01, 8.617588e-01, 1.030000e+00, 6.880905e-01], ], ) # use higher tolerance because MKZ curve fitting has room for small errors From 8eb0fb8c67d890fcb7e3c6fea88268f32ad3e83d Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 21:23:52 -0700 Subject: [PATCH 05/20] Modified test file for param from profile --- tests/files/HH_G_FKSH14.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 From 4772d423292ba7eb3e14faa5fdc558ddd6975394 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 21:36:42 -0700 Subject: [PATCH 06/20] Minor formatting edit --- tests/test_helper_hh_calibration.py | 72 +++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 9 deletions(-) diff --git a/tests/test_helper_hh_calibration.py b/tests/test_helper_hh_calibration.py index 348499ed..cb1a94b7 100644 --- a/tests/test_helper_hh_calibration.py +++ b/tests/test_helper_hh_calibration.py @@ -230,15 +230,69 @@ def test_hh_param_from_curves__case_1(self): ) HH_G_benchmark = np.array( [ - [3.000000e-04, 1.000000e-04, 1.000000e-04, 1.000000e-05, 1.000000e-04], - [1.000000e+02, 1.000000e+02, 1.000000e+02, 1.000000e+02, 1.000000e+02], - [2.850723e-04, 5.162455e-04, 9.445347e-04, 1.297991e-03, 1.449785e-03], - [1.752271e+00, 1.714569e+00, 1.640579e+00, 1.586349e+00, 1.564563e+00], - [9.190010e-01, 9.190027e-01, 9.189996e-01, 9.190071e-01, 9.189987e-01], - [2.111040e+07, 6.859000e+07, 1.489600e+08, 2.254412e+09, 3.283976e+09], - [2.333568e-01, 1.991492e-01, 2.537845e-01, 4.190679e-02, 6.598106e-02], - [2.650097e+04, 6.485662e+04, 1.488051e+05, 8.048549e+05, 1.107851e+06], - [9.377387e-01, 8.509045e-01, 8.617588e-01, 1.030000e+00, 6.880905e-01], + [ + 3.000000e-04, + 1.000000e-04, + 1.000000e-04, + 1.000000e-05, + 1.000000e-04 + ], + [ + 1.000000e+02, + 1.000000e+02, + 1.000000e+02, + 1.000000e+02, + 1.000000e+02 + ], + [ + 2.850723e-04, + 5.162455e-04, + 9.445347e-04, + 1.297991e-03, + 1.449785e-03 + ], + [ + 1.752271e+00, + 1.714569e+00, + 1.640579e+00, + 1.586349e+00, + 1.564563e+00 + ], + [ + 9.190010e-01, + 9.190027e-01, + 9.189996e-01, + 9.190071e-01, + 9.189987e-01 + ], + [ + 2.111040e+07, + 6.859000e+07, + 1.489600e+08, + 2.254412e+09, + 3.283976e+09 + ], + [ + 2.333568e-01, + 1.991492e-01, + 2.537845e-01, + 4.190679e-02, + 6.598106e-02 + ], + [ + 2.650097e+04, + 6.485662e+04, + 1.488051e+05, + 8.048549e+05, + 1.107851e+06 + ], + [ + 9.377387e-01, + 8.509045e-01, + 8.617588e-01, + 1.030000e+00, + 6.880905e-01 + ], ], ) # use higher tolerance because MKZ curve fitting has room for small errors From 540c5a56a2c1ae2035621fa5384bf077f41a7e80 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 21:37:52 -0700 Subject: [PATCH 07/20] Update test_class_hh_calibration.py benchmarks Modified the benchmark in case_2_with_both_Vs_profile_and_GGmax_curves() --- tests/test_class_hh_calibration.py | 74 ++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/tests/test_class_hh_calibration.py b/tests/test_class_hh_calibration.py index 39ef36d4..72f5db9c 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.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], + [ + 1.0000000e+02, + 1.0000000e+02, + 1.0000000e+02, + 1.0000000e+02, + 1.0000000e+02 + ], + [ + 2.8507234e-04, + 5.1624545e-04, + 9.4453471e-04, + 1.2979909e-03, + 1.4497853e-03 + ], + [ + 1.7522706e+00, + 1.7145687e+00, + 1.6405793e+00, + 1.5863492e+00, + 1.5645630e+00 + ], + [ + 9.1900098e-01, + 9.1900268e-01, + 9.1899964e-01, + 9.1900711e-01, + 9.1899869e-01 + ], + [ + 2.1110400e+07, + 6.8590000e+07, + 1.4896000e+08, + 2.2544125e+09, + 3.2839763e+09 + ], + [ + 2.3335679e-01, + 1.9914917e-01, + 2.5378449e-01, + 4.1906791e-02, + 6.5981061e-02 + ], + [ + 2.6500966e+04, + 6.4856617e+04, + 1.4880507e+05, + 8.0485491e+05, + 1.1078508e+06 + ], + [ + 9.3773869e-01, + 8.5090452e-01, + 8.6175879e-01, + 1.0300000e+00, + 6.8809045e-01 + ] ], ) HH_G_param_benchmark = HH_Param_Multi_Layer(HH_G_benchmark_data) From 73c13fe5da99db3b293c8b14a02342e834ce8ab7 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 21:51:22 -0700 Subject: [PATCH 08/20] Minor formatting edits --- tests/test_class_hh_calibration.py | 52 ++++++++++++++--------------- tests/test_helper_hh_calibration.py | 52 ++++++++++++++--------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/tests/test_class_hh_calibration.py b/tests/test_class_hh_calibration.py index 72f5db9c..01724824 100644 --- a/tests/test_class_hh_calibration.py +++ b/tests/test_class_hh_calibration.py @@ -95,63 +95,63 @@ def test_fit__case_2_with_both_Vs_profile_and_GGmax_curves(self): 1.0000000e-04, 1.0000000e-04, 1.0000000e-05, - 1.0000000e-04 + 1.0000000e-04, ], [ - 1.0000000e+02, - 1.0000000e+02, - 1.0000000e+02, - 1.0000000e+02, - 1.0000000e+02 + 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.4497853e-03, ], [ - 1.7522706e+00, - 1.7145687e+00, - 1.6405793e+00, - 1.5863492e+00, - 1.5645630e+00 + 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 + 9.1899869e-01, ], [ - 2.1110400e+07, - 6.8590000e+07, - 1.4896000e+08, - 2.2544125e+09, - 3.2839763e+09 + 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 + 6.5981061e-02, ], [ - 2.6500966e+04, - 6.4856617e+04, - 1.4880507e+05, - 8.0485491e+05, - 1.1078508e+06 + 2.6500966e04, + 6.4856617e04, + 1.4880507e05, + 8.0485491e05, + 1.1078508e06, ], [ 9.3773869e-01, 8.5090452e-01, 8.6175879e-01, - 1.0300000e+00, - 6.8809045e-01 + 1.0300000e00, + 6.8809045e-01, ] ], ) diff --git a/tests/test_helper_hh_calibration.py b/tests/test_helper_hh_calibration.py index cb1a94b7..36d5f8de 100644 --- a/tests/test_helper_hh_calibration.py +++ b/tests/test_helper_hh_calibration.py @@ -235,63 +235,63 @@ def test_hh_param_from_curves__case_1(self): 1.000000e-04, 1.000000e-04, 1.000000e-05, - 1.000000e-04 + 1.000000e-04, ], [ - 1.000000e+02, - 1.000000e+02, - 1.000000e+02, - 1.000000e+02, - 1.000000e+02 + 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.449785e-03, ], [ - 1.752271e+00, - 1.714569e+00, - 1.640579e+00, - 1.586349e+00, - 1.564563e+00 + 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 + 9.189987e-01, ], [ - 2.111040e+07, - 6.859000e+07, - 1.489600e+08, - 2.254412e+09, - 3.283976e+09 + 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 + 6.598106e-02, ], [ - 2.650097e+04, - 6.485662e+04, - 1.488051e+05, - 8.048549e+05, - 1.107851e+06 + 2.650097e04, + 6.485662e04, + 1.488051e05, + 8.048549e05, + 1.107851e06, ], [ 9.377387e-01, 8.509045e-01, 8.617588e-01, - 1.030000e+00, - 6.880905e-01 + 1.030000e00, + 6.880905e-01, ], ], ) From db10016facb01a45905e9a73bc611a1ace73cd27 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 21:56:34 -0700 Subject: [PATCH 09/20] Commas formatting --- tests/test_class_hh_calibration.py | 2 +- tests/test_helper_hh_calibration.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_class_hh_calibration.py b/tests/test_class_hh_calibration.py index 01724824..d193f16b 100644 --- a/tests/test_class_hh_calibration.py +++ b/tests/test_class_hh_calibration.py @@ -152,7 +152,7 @@ def test_fit__case_2_with_both_Vs_profile_and_GGmax_curves(self): 8.6175879e-01, 1.0300000e00, 6.8809045e-01, - ] + ], ], ) HH_G_param_benchmark = HH_Param_Multi_Layer(HH_G_benchmark_data) diff --git a/tests/test_helper_hh_calibration.py b/tests/test_helper_hh_calibration.py index 36d5f8de..0859c6db 100644 --- a/tests/test_helper_hh_calibration.py +++ b/tests/test_helper_hh_calibration.py @@ -242,7 +242,7 @@ def test_hh_param_from_curves__case_1(self): 1.000000e02, 1.000000e02, 1.000000e02, - 1.000000e02 + 1.000000e02, ], [ 2.850723e-04, From 47576d7505df509ba5a54b0435bf37cf7e4a425f Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 22:55:34 -0700 Subject: [PATCH 10/20] Update test for deprecation warning Addressing DeprecationWarning: Passing None into shape arguments as an alias for () is deprecated. --- tests/test_helper_generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_helper_generic.py b/tests/test_helper_generic.py index f6785932..1aaa808b 100644 --- a/tests/test_helper_generic.py +++ b/tests/test_helper_generic.py @@ -133,7 +133,7 @@ def test_extend_scalar(self): # Case #2: `length` is something strange self.assertTrue( - np.allclose(hlp.extend_scalar(2.5, None), np.array(2.5)) + np.allclose(hlp.extend_scalar(2.5, ()), np.array(2.5)) ) # Case #3: `length` is an integer From 7c7878cdb20f5c1cc045988185443fa85b62ae5b Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Mon, 13 Oct 2025 23:10:16 -0700 Subject: [PATCH 11/20] Formatting fix --- tests/test_helper_generic.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_helper_generic.py b/tests/test_helper_generic.py index 1aaa808b..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, ()), 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( From 662fe8fd995d87b645ed1942e188f162cf9c16b2 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Wed, 15 Oct 2025 19:01:24 -0700 Subject: [PATCH 12/20] Python version and changelog edits --- CHANGELOG.md | 2 ++ PySeismoSoil/helper_hh_calibration.py | 5 ----- pyproject.toml | 2 +- tox.ini | 2 -- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3139d225..ba14d18b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 f389d0e4..b9eef298 100644 --- a/PySeismoSoil/helper_hh_calibration.py +++ b/PySeismoSoil/helper_hh_calibration.py @@ -477,11 +477,6 @@ def produce_HH_G_param( mu = np.zeros_like(OCR) for j in range(n_layer): # softer soil: use Vardanega & Bolton (2011) CGJ formula - # We remove the former 760m/s limitation on applying the - # formula, where mu was being set to 1.0 for Vs higher than 760m/s, - # which caused occasional instabilities for Vs profiles that cross - # 760m/s in a smooth manner. We allow the CGJ formula to apply - # to stiffer soils as well. mu[j] = 1.0 / ( 0.000872 * Gmax[j] / Tmax[j] * OCR[j] ** 0.47 * p0[j] ** 0.28 ) # noqa: E226 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/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 From 0807f4f4311dc11577de5e6f2534e8460c2f368f Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Wed, 15 Oct 2025 19:07:34 -0700 Subject: [PATCH 13/20] Workflow edit --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 51b1017a..5abe9673 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -16,7 +16,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 From b92276d7b1dce3f72797f9361ddf5d2c3400b344 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Wed, 15 Oct 2025 19:20:57 -0700 Subject: [PATCH 14/20] Reverting test change --- tests/test_helper_generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_helper_generic.py b/tests/test_helper_generic.py index 0dd8721c..6a225155 100644 --- a/tests/test_helper_generic.py +++ b/tests/test_helper_generic.py @@ -132,7 +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, ()), np.array(2.5))) + self.assertTrue(np.allclose(hlp.extend_scalar(2.5, None), np.array(2.5))) # Case #3: `length` is an integer self.assertTrue( From 60b2cd01d7da140a8637f9333d9e48dc68584d90 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Wed, 15 Oct 2025 19:41:05 -0700 Subject: [PATCH 15/20] More workflow changes --- .github/workflows/build-and-deploy-docs.yml | 16 ++-- .github/workflows/python-package.yml | 13 ++- .github/workflows/python-publish.yml | 10 +-- .gitignore | 2 +- .pre-commit-config.yaml | 64 +++++++++------ muff.toml | 48 +++++++++++ pyproject.toml | 2 +- run_linting.sh | 2 +- tox.ini | 88 +++++---------------- 9 files changed, 124 insertions(+), 121 deletions(-) create mode 100644 muff.toml diff --git a/.github/workflows/build-and-deploy-docs.yml b/.github/workflows/build-and-deploy-docs.yml index 2a67e6ea..16080074 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 @@ -34,7 +30,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: '3.11' - name: Install dependencies run: | pip install . @@ -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 + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 5abe9673..72b7045c 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.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 }} @@ -29,4 +26,4 @@ jobs: python -m pip install --upgrade pip python -m pip install tox tox-gh-actions - name: Test with tox - run: tox + run: tox \ No newline at end of file diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 35081d4e..83e633b0 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 @@ -35,4 +31,4 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 97d728a7..14b0e3f8 100644 --- a/.gitignore +++ b/.gitignore @@ -107,4 +107,4 @@ venv.bak/ # IDE .idea -.vscode +.vscode \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ca9f7079..04912ac3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,32 +1,48 @@ +--- repos: - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - - - repo: https://github.com/jsh9/cercis - rev: 0.2.3 - hooks: - - id: cercis - - id: cercis-jupyter - - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 - hooks: - - id: prettier - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v6.0.0 hooks: - - id: end-of-file-fixer - id: trailing-whitespace - - - repo: https://github.com/pre-commit/pre-commit - rev: v3.5.0 + - id: end-of-file-fixer + - id: debug-statements + - id: double-quote-string-fixer + - id: requirements-txt-fixer + - id: pretty-format-json + args: [--no-ensure-ascii, --indent=4, --no-sort-keys] + exclude: \.ipynb$ + - repo: https://github.com/asottile/pyupgrade + rev: v3.21.0 + hooks: + - id: pyupgrade + args: [--py310-plus] + - repo: https://github.com/jsh9/muff-pre-commit + rev: 0.13.2 + hooks: + - id: muff-format + args: [--config, muff.toml] + - repo: https://github.com/jsh9/blank-line-after-blocks + rev: 0.1.4 hooks: - - id: validate_manifest - + - id: blank-line-after-blocks + - id: blank-line-after-blocks-jupyter + - repo: https://github.com/lyz-code/yamlfix + rev: 1.18.0 + hooks: + - id: yamlfix + - repo: https://github.com/hukkin/mdformat + rev: 0.7.22 + hooks: + - id: mdformat + args: [--wrap, '79', --number] + additional_dependencies: [mdformat-tables] - repo: https://github.com/jsh9/markdown-toc-creator - rev: 0.0.6 + rev: 0.0.11 hooks: - id: markdown-toc-creator + - repo: https://github.com/jsh9/format-docstring + rev: 0.1.4 + hooks: + - id: format-docstring + name: Format docstrings in .py files + args: [--line-length=79] \ No newline at end of file diff --git a/muff.toml b/muff.toml new file mode 100644 index 00000000..6e1d75cd --- /dev/null +++ b/muff.toml @@ -0,0 +1,48 @@ +# Docs: https://docs.astral.sh/ruff/configuration + +line-length = 79 +exclude = ["tests/test_data"] + +target-version = "py310" + +[format] +quote-style = "single" +docstring-code-format = true +preview = true + +[lint] +extend-select = [ + "F", # pyflakes + "E", + "I", # isort + "UP", # pyupgrade + "D", # pydocstyle + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "ERA", # flake8-eradicate + "Q", # flake8-quotes + "T10", # flake8-debugger + "ISC", # flake8-implicit-str-concat + "W505", +] +ignore = [ + "E501", + "D100", + "D104", + "D105", + "D107", + "D200", + "D205", + "D400", +] +preview = true + +[lint.flake8-quotes] +docstring-quotes = "double" +inline-quotes = "single" + +[lint.per-file-ignores] +"tests/*" = ["D101", "D102", "D103"] # No need for docstrings in tests + +[lint.pydocstyle] +convention = "numpy" \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 9c883084..494c078f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,4 +44,4 @@ wrap-line-with-long-string = true [tool.pydoclint] style = 'numpy' -exclude = '\.git|.?venv|\.tox' +exclude = '\.git|.?venv|\.tox|\.ipynb_checkpoints' \ No newline at end of file diff --git a/run_linting.sh b/run_linting.sh index c3c3c6e9..ada3cb60 100755 --- a/run_linting.sh +++ b/run_linting.sh @@ -1,2 +1,2 @@ pip install flake8 -flake8 ./PySeismoSoil --count --statistics --ignore=C901,E203,E741,E221,W605,E502,E116,W504,E266,E114,E222 --max-line-length=99 --max-complexity=10 +flake8 ./PySeismoSoil --count --statistics --ignore=C901,E203,E741,E221,W605,E502,E116,W504,E266,E114,E222 --max-line-length=99 --max-complexity=10 \ No newline at end of file diff --git a/tox.ini b/tox.ini index f3aa941f..f8c2efef 100644 --- a/tox.ini +++ b/tox.ini @@ -4,65 +4,41 @@ envlist = py311 py312 py313 - cercis - flake8-basic - flake8-misc - flake8-docstrings + muff-lint + muff-format pydoclint pre-commit [gh-actions] python = - 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 - 3.13: py313, cercis, check-self, flake8-basic, flake8-misc, flake8-docstrings, pre-commit + 3.10: py310, muff-lint, muff-format, pydoclint, pre-commit + 3.11: py311, muff-lint, muff-format, pydoclint, pre-commit + 3.12: py312, muff-lint, muff-format, pydoclint, pre-commit + 3.13: py313, muff-lint, muff-format, pydoclint, pre-commit -[testenv:cercis] -deps = - cercis==0.2.3 -skip_install = true +[testenv] +deps = pytest commands = - cercis --version - # use the '--check' flag to avoid accidentally formatting code - cercis --wrap-line-with-long-string=True --check --diff PySeismoSoil tests + pytest --tb=long . -[testenv:flake8-basic] +[testenv:muff-lint] +deps = + muff skip_install = true -deps = flake8>=5.0 commands = - flake8 . + muff check --fix --config=muff.toml PySeismoSoil tests -[testenv:flake8-misc] -skip_install = true +[testenv:muff-format] deps = - flake8-bugbear - flake8-comprehensions - flake8-eradicate - flake8-broken-line - flake8-quotes - flake8-debugger - flake8-length - flake8-clean-block - flake8-indent-in-def - flake8-picky-parentheses - flake8-implicit-str-concat - flake8-return - flake8-broken-line -commands = - flake8 --select B,C,D,E800,N4,Q,T,LN,CLB,IND,PAR,ISC,R,N400 . - - -[testenv:flake8-docstrings] + muff skip_install = true -deps = - flake8-docstrings commands = - flake8 --ignore D100,D104,D105,D107,D400,D205 --select D ./PySeismoSoil + # use the '--diff' flag to avoid accidentally formatting code + muff format --diff --config=muff.toml PySeismoSoil tests [testenv:pydoclint] @@ -73,38 +49,12 @@ commands = pydoclint ./PySeismoSoil -[testenv] -deps = pytest -commands = - pytest --tb=long . - - [testenv:pre-commit] skip_install = true deps = pre-commit set_env = # Skipping auto-formatter here to avoid accidentally formatting code - SKIP = cercis + SKIP = muff-format commands = - pre-commit run -a - - -[flake8] -max-line-length = 79 -extend-ignore = - # E501: line length - E501, - # LN002: doc/comment line too long - LN002, - # W503 and W504 are mutually exclusive; we choose to follow W504 - W503, - E203, - C901, - R504, -count = true -statistics = true -max-complexity = 10 -exclude = - .*, - venv/*, + pre-commit run -a \ No newline at end of file From 7eec1accbc364ebbc3295962d8bcf3fcb01bf49e Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:00:18 -0700 Subject: [PATCH 16/20] Reverting some changes + pytest adjustment --- muff.toml | 48 ------------------------------- tox.ini | 86 +++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 71 insertions(+), 63 deletions(-) delete mode 100644 muff.toml diff --git a/muff.toml b/muff.toml deleted file mode 100644 index 6e1d75cd..00000000 --- a/muff.toml +++ /dev/null @@ -1,48 +0,0 @@ -# Docs: https://docs.astral.sh/ruff/configuration - -line-length = 79 -exclude = ["tests/test_data"] - -target-version = "py310" - -[format] -quote-style = "single" -docstring-code-format = true -preview = true - -[lint] -extend-select = [ - "F", # pyflakes - "E", - "I", # isort - "UP", # pyupgrade - "D", # pydocstyle - "B", # flake8-bugbear - "C4", # flake8-comprehensions - "ERA", # flake8-eradicate - "Q", # flake8-quotes - "T10", # flake8-debugger - "ISC", # flake8-implicit-str-concat - "W505", -] -ignore = [ - "E501", - "D100", - "D104", - "D105", - "D107", - "D200", - "D205", - "D400", -] -preview = true - -[lint.flake8-quotes] -docstring-quotes = "double" -inline-quotes = "single" - -[lint.per-file-ignores] -"tests/*" = ["D101", "D102", "D103"] # No need for docstrings in tests - -[lint.pydocstyle] -convention = "numpy" \ No newline at end of file diff --git a/tox.ini b/tox.ini index f8c2efef..3b6dc640 100644 --- a/tox.ini +++ b/tox.ini @@ -4,18 +4,20 @@ envlist = py311 py312 py313 - muff-lint - muff-format + cercis + flake8-basic + flake8-misc + flake8-docstrings pydoclint pre-commit [gh-actions] python = - 3.10: py310, muff-lint, muff-format, pydoclint, pre-commit - 3.11: py311, muff-lint, muff-format, pydoclint, pre-commit - 3.12: py312, muff-lint, muff-format, pydoclint, pre-commit - 3.13: py313, muff-lint, muff-format, pydoclint, 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 + 3.13: py313, cercis, check-self, flake8-basic, flake8-misc, flake8-docstrings, pre-commit [testenv] @@ -24,21 +26,49 @@ commands = pytest --tb=long . -[testenv:muff-lint] +[testenv:cercis] deps = - muff + cercis==0.2.3 skip_install = true commands = - muff check --fix --config=muff.toml PySeismoSoil tests + cercis --version + # use the '--check' flag to avoid accidentally formatting code + cercis --wrap-line-with-long-string=True --check --diff PySeismoSoil tests -[testenv:muff-format] +[testenv:flake8-basic] +skip_install = true +deps = flake8>=5.0 +commands = + flake8 . + + +[testenv:flake8-misc] +skip_install = true deps = - muff + flake8-bugbear + flake8-comprehensions + flake8-eradicate + flake8-broken-line + flake8-quotes + flake8-debugger + flake8-length + flake8-clean-block + flake8-indent-in-def + flake8-picky-parentheses + flake8-implicit-str-concat + flake8-return + flake8-broken-line +commands = + flake8 --select B,C,D,E800,N4,Q,T,LN,CLB,IND,PAR,ISC,R,N400 . + + +[testenv:flake8-docstrings] skip_install = true +deps = + flake8-docstrings commands = - # use the '--diff' flag to avoid accidentally formatting code - muff format --diff --config=muff.toml PySeismoSoil tests + flake8 --ignore D100,D104,D105,D107,D400,D205 --select D ./PySeismoSoil [testenv:pydoclint] @@ -49,12 +79,38 @@ commands = pydoclint ./PySeismoSoil +[testenv] +deps = pytest +commands = + pytest --tb=long . + + [testenv:pre-commit] skip_install = true deps = pre-commit set_env = # Skipping auto-formatter here to avoid accidentally formatting code - SKIP = muff-format + SKIP = cercis commands = - pre-commit run -a \ No newline at end of file + pre-commit run -a + + +[flake8] +max-line-length = 79 +extend-ignore = + # E501: line length + E501, + # LN002: doc/comment line too long + LN002, + # W503 and W504 are mutually exclusive; we choose to follow W504 + W503, + E203, + C901, + R504, +count = true +statistics = true +max-complexity = 10 +exclude = + .*, + venv/*, From 66e592cbf4b1cca4c979c737c262ec5fe6c3c94d Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:08:59 -0700 Subject: [PATCH 17/20] Fix testenv --- tox.ini | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tox.ini b/tox.ini index 3b6dc640..f3aa941f 100644 --- a/tox.ini +++ b/tox.ini @@ -20,12 +20,6 @@ python = 3.13: py313, cercis, check-self, flake8-basic, flake8-misc, flake8-docstrings, pre-commit -[testenv] -deps = pytest -commands = - pytest --tb=long . - - [testenv:cercis] deps = cercis==0.2.3 From 1dbd3a0253504bda421ba82c1b0333b776923ace Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:02:28 -0700 Subject: [PATCH 18/20] Changelog and readme edits --- CHANGELOG.md | 2 +- README.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba14d18b..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 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 From d209c024dcc65dc3a005c9c878bbe0720f857e49 Mon Sep 17 00:00:00 2001 From: Flora Xia <45961129+xia-fr@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:08:29 -0700 Subject: [PATCH 19/20] Reverting some changes --- .pre-commit-config.yaml | 64 ++++++++++++++++------------------------- pyproject.toml | 2 +- 2 files changed, 25 insertions(+), 41 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04912ac3..ca9f7079 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,48 +1,32 @@ ---- repos: + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + + - repo: https://github.com/jsh9/cercis + rev: 0.2.3 + hooks: + - id: cercis + - id: cercis-jupyter + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.3 + hooks: + - id: prettier + - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 + rev: v4.5.0 hooks: - - id: trailing-whitespace - id: end-of-file-fixer - - id: debug-statements - - id: double-quote-string-fixer - - id: requirements-txt-fixer - - id: pretty-format-json - args: [--no-ensure-ascii, --indent=4, --no-sort-keys] - exclude: \.ipynb$ - - repo: https://github.com/asottile/pyupgrade - rev: v3.21.0 - hooks: - - id: pyupgrade - args: [--py310-plus] - - repo: https://github.com/jsh9/muff-pre-commit - rev: 0.13.2 - hooks: - - id: muff-format - args: [--config, muff.toml] - - repo: https://github.com/jsh9/blank-line-after-blocks - rev: 0.1.4 - hooks: - - id: blank-line-after-blocks - - id: blank-line-after-blocks-jupyter - - repo: https://github.com/lyz-code/yamlfix - rev: 1.18.0 - hooks: - - id: yamlfix - - repo: https://github.com/hukkin/mdformat - rev: 0.7.22 + - id: trailing-whitespace + + - repo: https://github.com/pre-commit/pre-commit + rev: v3.5.0 hooks: - - id: mdformat - args: [--wrap, '79', --number] - additional_dependencies: [mdformat-tables] + - id: validate_manifest + - repo: https://github.com/jsh9/markdown-toc-creator - rev: 0.0.11 + rev: 0.0.6 hooks: - id: markdown-toc-creator - - repo: https://github.com/jsh9/format-docstring - rev: 0.1.4 - hooks: - - id: format-docstring - name: Format docstrings in .py files - args: [--line-length=79] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 494c078f..9c883084 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,4 +44,4 @@ wrap-line-with-long-string = true [tool.pydoclint] style = 'numpy' -exclude = '\.git|.?venv|\.tox|\.ipynb_checkpoints' \ No newline at end of file +exclude = '\.git|.?venv|\.tox' From 76e501c752dd2fba317492546ae79b99b8056a74 Mon Sep 17 00:00:00 2001 From: xia-fr <45961129+xia-fr@users.noreply.github.com> Date: Fri, 17 Oct 2025 00:28:19 -0700 Subject: [PATCH 20/20] Formatting and test_helper_generic edit --- .github/workflows/build-and-deploy-docs.yml | 4 ++-- .github/workflows/python-package.yml | 4 ++-- .github/workflows/python-publish.yml | 2 +- .gitignore | 2 +- run_linting.sh | 2 +- tests/test_helper_generic.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-deploy-docs.yml b/.github/workflows/build-and-deploy-docs.yml index 16080074..760b9b68 100644 --- a/.github/workflows/build-and-deploy-docs.yml +++ b/.github/workflows/build-and-deploy-docs.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: "3.11" - name: Install dependencies run: | pip install . @@ -53,4 +53,4 @@ jobs: path: ./docs/build/html - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 72b7045c..e5d30ed0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - python-version: ['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 }} @@ -26,4 +26,4 @@ jobs: python -m pip install --upgrade pip python -m pip install tox tox-gh-actions - name: Test with tox - run: tox \ No newline at end of file + run: tox diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 83e633b0..17c3177c 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -31,4 +31,4 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index 14b0e3f8..97d728a7 100644 --- a/.gitignore +++ b/.gitignore @@ -107,4 +107,4 @@ venv.bak/ # IDE .idea -.vscode \ No newline at end of file +.vscode diff --git a/run_linting.sh b/run_linting.sh index ada3cb60..c3c3c6e9 100755 --- a/run_linting.sh +++ b/run_linting.sh @@ -1,2 +1,2 @@ pip install flake8 -flake8 ./PySeismoSoil --count --statistics --ignore=C901,E203,E741,E221,W605,E502,E116,W504,E266,E114,E222 --max-line-length=99 --max-complexity=10 \ No newline at end of file +flake8 ./PySeismoSoil --count --statistics --ignore=C901,E203,E741,E221,W605,E502,E116,W504,E266,E114,E222 --max-line-length=99 --max-complexity=10 diff --git a/tests/test_helper_generic.py b/tests/test_helper_generic.py index 6a225155..0dd8721c 100644 --- a/tests/test_helper_generic.py +++ b/tests/test_helper_generic.py @@ -132,7 +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(