From 9661d65028b06747baa70058668482eec4da87de Mon Sep 17 00:00:00 2001 From: Vahid Ahmadi Date: Tue, 15 Oct 2024 12:13:08 +0100 Subject: [PATCH] remove unneeded files --- docs/streamlit/pages/Capital_Gains_Tax.py | 7 +++-- policyengine-core | 1 - .../solve_private_school_attendance_factor.py | 27 ++++++++++++------- .../contrib/labour/private_school_vat.py | 4 +-- private_school_VAT.ipynb | 0 5 files changed, 21 insertions(+), 18 deletions(-) delete mode 160000 policyengine-core delete mode 100644 private_school_VAT.ipynb diff --git a/docs/streamlit/pages/Capital_Gains_Tax.py b/docs/streamlit/pages/Capital_Gains_Tax.py index 929f3dc5f..819daa870 100644 --- a/docs/streamlit/pages/Capital_Gains_Tax.py +++ b/docs/streamlit/pages/Capital_Gains_Tax.py @@ -36,9 +36,9 @@ / "imputations" / "capital_gains_distribution_advani_summers.csv.gz" ) -capital_gains["maximum_total_income"] = ( - capital_gains.minimum_total_income.shift(-1).fillna(np.inf) -) +capital_gains[ + "maximum_total_income" +] = capital_gains.minimum_total_income.shift(-1).fillna(np.inf) # Fit a spline to each income band's percentiles from scipy.interpolate import UnivariateSpline @@ -119,7 +119,6 @@ def impute_capital_gains(total_income: float) -> float: ) with st.expander("Capital gains imputation test runner"): - income = st.slider("Total income", 0, 500000, 50000, 1000) with st.spinner("Imputing capital gains..."): diff --git a/policyengine-core b/policyengine-core deleted file mode 160000 index 3fc430816..000000000 --- a/policyengine-core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3fc4308163eeadf7648ddb117b598d145f241545 diff --git a/policyengine_uk/utils/solve_private_school_attendance_factor.py b/policyengine_uk/utils/solve_private_school_attendance_factor.py index 2421e0f32..41ce3e644 100644 --- a/policyengine_uk/utils/solve_private_school_attendance_factor.py +++ b/policyengine_uk/utils/solve_private_school_attendance_factor.py @@ -3,25 +3,30 @@ # Initialize variables to track the best private_school_factor and its result best_factor = None -smallest_difference = float('inf') +smallest_difference = float("inf") # Loop over values of private_school_factor from 0.7 to 0.8 in steps of 0.01 for factor in [round(x * 0.01, 2) for x in range(70, 81)]: # Define the reform with the current private_school_factor value - reform = Reform.from_dict({ - "gov.contrib.labour.private_school_vat": { - "2024-01-01.2100-12-31": 0.2 + reform = Reform.from_dict( + { + "gov.contrib.labour.private_school_vat": { + "2024-01-01.2100-12-31": 0.2 + }, + "gov.simulation.private_school_vat.private_school_factor": { + "2024-01-01.2100-12-31": factor + }, }, - "gov.simulation.private_school_vat.private_school_factor": { - "2024-01-01.2100-12-31": factor - } - }, country_id="uk") + country_id="uk", + ) # Run the reformed microsimulation reformed = Microsimulation(reform=reform) # Calculate the number of students attending private school in thousands - private_school_attendance = reformed.calculate("attends_private_school", period=2025).sum() / 1e3 + private_school_attendance = ( + reformed.calculate("attends_private_school", period=2025).sum() / 1e3 + ) # Compare the result with 550 and track the best value difference = abs(private_school_attendance - 550) @@ -30,5 +35,7 @@ best_factor = factor # Report the best private_school_factor -print(f"The best private_school_factor is {best_factor} with a difference of {smallest_difference}") +print( + f"The best private_school_factor is {best_factor} with a difference of {smallest_difference}" +) # The best private_school_factor is 0.77 with a difference of 1.3427231160653719 diff --git a/policyengine_uk/variables/contrib/labour/private_school_vat.py b/policyengine_uk/variables/contrib/labour/private_school_vat.py index fde3c5e9f..fae34a3fb 100644 --- a/policyengine_uk/variables/contrib/labour/private_school_vat.py +++ b/policyengine_uk/variables/contrib/labour/private_school_vat.py @@ -18,9 +18,7 @@ def formula(person, period, parameters): ps_vat_params.private_school_attendance_rate ) - population_adjustment_factor = ( - ps_vat_params.private_school_factor - ) + population_adjustment_factor = ps_vat_params.private_school_factor person = household.members diff --git a/private_school_VAT.ipynb b/private_school_VAT.ipynb deleted file mode 100644 index e69de29bb..000000000