From 69586959690ee0bdafb0033654ad932cd1b77b2c Mon Sep 17 00:00:00 2001 From: yaman Date: Thu, 7 Sep 2023 09:56:10 +0200 Subject: [PATCH 1/3] fix indentation --- pod_rbf/pod_rbf.py | 82 +++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/pod_rbf/pod_rbf.py b/pod_rbf/pod_rbf.py index fbea129..7e48858 100755 --- a/pod_rbf/pod_rbf.py +++ b/pod_rbf/pod_rbf.py @@ -100,57 +100,57 @@ def _buildCollocationMatrix(self, c): r2 += ((I - J) / self.params_range[i])**2 return 1 / np.sqrt(r2 / (c**2) + 1) -def _findOptimShapeParam(self, cond_range=[1e11, 1e12], max_steps=1e5): - # find lower bound of c for bisection - c_low = 0.011 - found_c_low = False - C = self._buildCollocationMatrix(c_low) - cond = np.linalg.cond(C) - if cond <= cond_range[1]: - found_c_low = True - else: - raise ValueError("Shape factor cannot be less than 0. shape_factor={}".format(c_low)) - - # find upper bound of c for bisection - c_high = 1 - found_c_high = False - k = 0 - while found_c_high is False: - k += 1 - C = self._buildCollocationMatrix(c_high) + def _findOptimShapeParam(self, cond_range=[1e11, 1e12], max_steps=1e5): + # find lower bound of c for bisection + c_low = 0.011 + found_c_low = False + C = self._buildCollocationMatrix(c_low) cond = np.linalg.cond(C) - if cond < cond_range[0]: - c_high += 0.01 + if cond <= cond_range[1]: + found_c_low = True else: - found_c_high = True - if k > max_steps: - print("WARNING: MAX STEPS") - break - - # start bisection algorithm - if found_c_low and found_c_high: - found_optim_c = False + raise ValueError("Shape factor cannot be less than 0. shape_factor={}".format(c_low)) + + # find upper bound of c for bisection + c_high = 1 + found_c_high = False k = 0 - while found_optim_c is False: + while found_c_high is False: k += 1 - optim_c = (c_low + c_high) / 2.0 - C = self._buildCollocationMatrix(optim_c) + C = self._buildCollocationMatrix(c_high) cond = np.linalg.cond(C) - if cond <= cond_range[0]: - c_low = optim_c - elif cond > cond_range[1]: - c_high = optim_c + if cond < cond_range[0]: + c_high += 0.01 else: - found_optim_c = True - + found_c_high = True if k > max_steps: print("WARNING: MAX STEPS") break - else: - raise ValueError("Could not find c {}".format(optim_c)) - - return optim_c + # start bisection algorithm + if found_c_low and found_c_high: + found_optim_c = False + k = 0 + while found_optim_c is False: + k += 1 + optim_c = (c_low + c_high) / 2.0 + C = self._buildCollocationMatrix(optim_c) + cond = np.linalg.cond(C) + if cond <= cond_range[0]: + c_low = optim_c + elif cond > cond_range[1]: + c_high = optim_c + else: + found_optim_c = True + + if k > max_steps: + print("WARNING: MAX STEPS") + break + else: + raise ValueError("Could not find c {}".format(optim_c)) + + + return optim_c def _buildRBFInferenceMatrix(self, inf_params): """Make the Radial Basis Function (RBF) matrix using the From 4d7e473f02aad603d4e2ffdf678703a2508a7628 Mon Sep 17 00:00:00 2001 From: Kyle Beggs Date: Sat, 9 Sep 2023 10:10:07 -0400 Subject: [PATCH 2/3] Update setup.py --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 38dfdd5..82c03bb 100644 --- a/setup.py +++ b/setup.py @@ -4,8 +4,8 @@ long_description = fh.read() setuptools.setup( - name="pod_rbf", # Replace with your own username - version="1.4.0", + name="pod_rbf", + version="1.4.1", author="Kyle Beggs", author_email="beggskw@gmail.com", description="Tool to perform interpolation using the Proper Orthogonal Decomposition - Radial Basis Function (POD-RBF) method.", From 13dfd6ddcf2f6ddc766394627e794a97538a5184 Mon Sep 17 00:00:00 2001 From: Kyle Beggs Date: Sat, 9 Sep 2023 10:10:24 -0400 Subject: [PATCH 3/3] Update __init__.py --- pod_rbf/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pod_rbf/__init__.py b/pod_rbf/__init__.py index dc67d7c..f34ca95 100644 --- a/pod_rbf/__init__.py +++ b/pod_rbf/__init__.py @@ -1,3 +1,3 @@ from .pod_rbf import * -__version__ = "1.4.0" +__version__ = "1.4.1"