Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove incorrect use of GrowFactors() in Policy and Parameters classes #2852

Merged
merged 12 commits into from
Dec 16, 2024
Prev Previous commit
Next Next commit
Simplify Policy.set_rates logic
  • Loading branch information
martinholmer committed Dec 15, 2024
commit 8cf5ba56e9735077944bcef9dfa1476e168b77d4
29 changes: 6 additions & 23 deletions taxcalc/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os
import json
from pathlib import Path
import numpy as np
from taxcalc.parameters import Parameters
from taxcalc.growfactors import GrowFactors

Expand Down Expand Up @@ -151,33 +150,17 @@ def set_rates(self):
"""
Initialize policy parameter indexing rates.
"""
syr = max(self.start_year, self._gfactors.first_year)
cpi_vals = [
vo["value"] for
vo in self._data["parameter_indexing_CPI_offset"]["value"]
]
# extend parameter_indexing_CPI_offset values through budget window
# if they have not been extended already.
cpi_vals = cpi_vals + cpi_vals[-1:] * (
self.end_year - syr + 1 - len(cpi_vals)
# policy_current_law.json should not specify any non-zero values
# for the parameter_indexing_CPI_offset parameter, so check this
assert any(cpi_vals) is False
syr = max(self.start_year, self._gfactors.first_year)
self._inflation_rates = self._gfactors.price_inflation_rates(
syr, self.end_year
)
if any(cpi_vals): # pragma: no cover
cpi_offset = {
(self.start_year + ix): val
for ix, val in enumerate(cpi_vals)
}
self._inflation_rates = [
np.round(rate + cpi_offset[self.start_year + ix], 4)
for ix, rate in enumerate(
self._gfactors.price_inflation_rates(
syr, self.end_year
)
)
]
else: # all cpi_vals are zero
self._inflation_rates = self._gfactors.price_inflation_rates(
syr, self.end_year
)
self._wage_growth_rates = self._gfactors.wage_growth_rates(
syr, self.end_year
)
Loading