Skip to content

Commit

Permalink
Simplify Policy.set_rates logic
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholmer committed Dec 15, 2024
1 parent b60499e commit 8cf5ba5
Showing 1 changed file with 6 additions and 23 deletions.
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
)

0 comments on commit 8cf5ba5

Please sign in to comment.