From 19534329bab74dbbb85b4e12cda46f6645ee71f8 Mon Sep 17 00:00:00 2001 From: Aaron Date: Sun, 8 Dec 2024 10:39:57 -0800 Subject: [PATCH 1/7] update ci python versions --- .github/workflows/ci_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 9197fe92..a8d4ada9 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - python-version: [3.7, 3.8, 3.9, '3.10'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout repository From 270215723923356c35a068d38ae0a687496cfe3d Mon Sep 17 00:00:00 2001 From: Aaron Date: Sun, 8 Dec 2024 10:40:36 -0800 Subject: [PATCH 2/7] change to x86 runners for Mac OS --- .github/workflows/ci_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index a8d4ada9..51257989 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-13] python-version: ['3.9', '3.10', '3.11', '3.12'] steps: From a69c8d0f5e2d8d3dab9eeec061eb2bbe5cbfbadc Mon Sep 17 00:00:00 2001 From: Aaron Date: Sun, 8 Dec 2024 10:59:39 -0800 Subject: [PATCH 3/7] replace interp2d with RegularGridInterpolator --- enterprise_extensions/empirical_distr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/enterprise_extensions/empirical_distr.py b/enterprise_extensions/empirical_distr.py index d8d14030..b208e143 100644 --- a/enterprise_extensions/empirical_distr.py +++ b/enterprise_extensions/empirical_distr.py @@ -10,7 +10,7 @@ sklearn_available=True except ModuleNotFoundError: sklearn_available=False -from scipy.interpolate import interp1d, interp2d +from scipy.interpolate import interp1d, interp2d, RegularGridInterpolator logger = logging.getLogger(__name__) @@ -175,7 +175,8 @@ def __init__(self, param_names, samples, minvals=None, maxvals=None, bandwidth=0 self._Nbins = [yvals.size for ii in range(xvals.size)] scores = np.array([self.kde.score(np.array([xvals[ii], yvals[jj]]).reshape((1, 2))) for ii in range(xvals.size) for jj in range(yvals.size)]) # interpolate within prior - self._logpdf = interp2d(xvals, yvals, scores, kind='linear', fill_value=-1000) + self._logpdf = RegularGridInterpolator((xvals, yvals), scores, method='linear', bounds_error=False, fill_value=-1000) + def draw(self): params = self.kde.sample(1).T From 97c4b7db586f4713a154e1f54d6d7a2247043aeb Mon Sep 17 00:00:00 2001 From: Aaron Date: Sun, 8 Dec 2024 11:16:43 -0800 Subject: [PATCH 4/7] fix linting issues --- enterprise_extensions/empirical_distr.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/enterprise_extensions/empirical_distr.py b/enterprise_extensions/empirical_distr.py index b208e143..b0c83472 100644 --- a/enterprise_extensions/empirical_distr.py +++ b/enterprise_extensions/empirical_distr.py @@ -10,7 +10,7 @@ sklearn_available=True except ModuleNotFoundError: sklearn_available=False -from scipy.interpolate import interp1d, interp2d, RegularGridInterpolator +from scipy.interpolate import interp1d, RegularGridInterpolator logger = logging.getLogger(__name__) @@ -177,7 +177,6 @@ def __init__(self, param_names, samples, minvals=None, maxvals=None, bandwidth=0 # interpolate within prior self._logpdf = RegularGridInterpolator((xvals, yvals), scores, method='linear', bounds_error=False, fill_value=-1000) - def draw(self): params = self.kde.sample(1).T return params.squeeze() From 4efde0a3beba38b9cc17f5e6a3d459527285485a Mon Sep 17 00:00:00 2001 From: Aaron Date: Sun, 8 Dec 2024 17:14:48 -0800 Subject: [PATCH 5/7] fix shape of scores for RegularGridInterpolator --- enterprise_extensions/empirical_distr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enterprise_extensions/empirical_distr.py b/enterprise_extensions/empirical_distr.py index b0c83472..d3d4f5e3 100644 --- a/enterprise_extensions/empirical_distr.py +++ b/enterprise_extensions/empirical_distr.py @@ -173,7 +173,7 @@ def __init__(self, param_names, samples, minvals=None, maxvals=None, bandwidth=0 xvals = np.linspace(minvals[0], maxvals[0], num=nbins) yvals = np.linspace(minvals[1], maxvals[1], num=nbins) self._Nbins = [yvals.size for ii in range(xvals.size)] - scores = np.array([self.kde.score(np.array([xvals[ii], yvals[jj]]).reshape((1, 2))) for ii in range(xvals.size) for jj in range(yvals.size)]) + scores = np.array([self.kde.score(np.array([xvals[ii], yvals[jj]]).reshape((1, 2))) for ii in range(xvals.size) for jj in range(yvals.size)]).reshape(len(xvals), len(yvals)) # interpolate within prior self._logpdf = RegularGridInterpolator((xvals, yvals), scores, method='linear', bounds_error=False, fill_value=-1000) From d4033f5eef83962fba5f65496c422fce092a2c7e Mon Sep 17 00:00:00 2001 From: Aaron Date: Sun, 8 Dec 2024 22:12:54 -0800 Subject: [PATCH 6/7] downgrade codecov to try to get it to work on mac --- .github/workflows/ci_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 51257989..07da3119 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -53,7 +53,7 @@ jobs: - name: Test with pytest run: make test - name: Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v2 #with: # fail_ci_if_error: true From bc3d9181a3f643f1386888d6d5971ff72e42c124 Mon Sep 17 00:00:00 2001 From: Aaron Date: Sun, 8 Dec 2024 22:27:09 -0800 Subject: [PATCH 7/7] remove codecov from macos --- .github/workflows/ci_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 07da3119..aee0f6cf 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -53,7 +53,8 @@ jobs: - name: Test with pytest run: make test - name: Codecov - uses: codecov/codecov-action@v2 + if: runner.os != 'macOS' + uses: codecov/codecov-action@v3 #with: # fail_ci_if_error: true