diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4959101..f0ab999 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,4 +1,4 @@ -name: Build and test [Python 3.10, 3.11] +name: Build and test [Python 3.10] on: [push, pull_request] @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10"] steps: - name: Checkout diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 7929be5..f6be657 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -18,7 +18,7 @@ jobs: with: activate-environment: iot-dev environment-file: environment.yml - python-version: 3.11 + python-version: "3.10" auto-activate-base: false - name: Build # Build Jupyter Book diff --git a/.github/workflows/docs_check.yml b/.github/workflows/docs_check.yml index 8d3366f..f54b70f 100644 --- a/.github/workflows/docs_check.yml +++ b/.github/workflows/docs_check.yml @@ -15,7 +15,7 @@ jobs: with: activate-environment: iot-dev environment-file: environment.yml - python-version: 3.11 + python-version: "3.10" auto-activate-base: false - name: Build # Build Jupyter Book diff --git a/environment.yml b/environment.yml index c72202d..b455050 100644 --- a/environment.yml +++ b/environment.yml @@ -2,8 +2,8 @@ name: iot-dev channels: - conda-forge dependencies: -- python -- "taxcalc>=4.0.0" +- python<3.11 +- "taxcalc==4.4.0" - pandas - numpy - scipy @@ -15,7 +15,7 @@ dependencies: - pylint - coverage - pip: - - jupyter-book>=0.9.1 + - jupyter-book<2.0.0 - black - plotly-express - kaleido diff --git a/iot/inverse_optimal_tax.py b/iot/inverse_optimal_tax.py index 632358e..ae49d03 100644 --- a/iot/inverse_optimal_tax.py +++ b/iot/inverse_optimal_tax.py @@ -288,9 +288,7 @@ def mills_ratio(t): # tails, which can zero out the fitted density and # poison downstream calculations (theta_z, g_z) with # infs/NaNs. - return np.sqrt(np.pi / 2) * scipy.special.erfcx( - t / np.sqrt(2) - ) + return np.sqrt(np.pi / 2) * scipy.special.erfcx(t / np.sqrt(2)) def pln_pdf(y, mu, sigma, alpha): x1 = alpha * sigma - (np.log(y) - mu) / sigma @@ -336,11 +334,9 @@ def fit_pln(data, weights, initial_guess): def pln_cdf(y, mu, sigma, alpha): x1 = alpha * sigma - (np.log(y) - mu) / sigma - CDF = ( - st.norm.cdf((np.log(y) - mu) / sigma) - - st.norm.pdf((np.log(y) - mu) / sigma) - * mills_ratio(x1) - ) + CDF = st.norm.cdf((np.log(y) - mu) / sigma) - st.norm.pdf( + (np.log(y) - mu) / sigma + ) * mills_ratio(x1) return CDF def pln_dpdf(y, mu, sigma, alpha): @@ -480,14 +476,10 @@ def find_eti(iot, g_z=None, eti_0=0.25, boundary="z0"): tail_integral = np.append(rev_cumsum, 0.0) eti_beliefs = ( - ((1 - iot.mtr) / iot.mtr) - * (1 / (iot.z * iot.f)) - * tail_integral + ((1 - iot.mtr) / iot.mtr) * (1 / (iot.z * iot.f)) * tail_integral ) else: - raise ValueError( - f"boundary must be 'z0' or 'inf', got '{boundary}'" - ) + raise ValueError(f"boundary must be 'z0' or 'inf', got '{boundary}'") return eti_beliefs