Skip to content

Commit

Permalink
Revise TMD code to use new taxcalc Policy and Records tmd_ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholmer committed Dec 15, 2024
1 parent 6f3479a commit 849b6dd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/test_area_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def test_area_xx(tests_folder):
# compare actual vs expected results for faux area xx
# ... instantiate Tax-Calculator object for area
pol = tc.Policy.tmd_constructor(
growfactors_path=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
growfactors=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
)
rec = tc.Records.tmd_constructor(
data_path=(STORAGE_FOLDER / "output" / "tmd.csv.gz"),
weights_path=(AREAS_FOLDER / "weights" / "xx_tmd_weights.csv.gz"),
growfactors_path=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
growfactors=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
exact_calculations=True,
)
sim = tc.Calculator(policy=pol, records=rec)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ def compare(name, act, exp, tol):

# use national tmd files to compute various 2021 income tax statistics
pol = tc.Policy.tmd_constructor(
growfactors_path=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
growfactors=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
)
rec = tc.Records.tmd_constructor(
data_path=(STORAGE_FOLDER / "output" / "tmd.csv.gz"),
weights_path=(STORAGE_FOLDER / "output" / "tmd_weights.csv.gz"),
growfactors_path=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
growfactors=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
exact_calculations=True,
)
sim = tc.Calculator(policy=pol, records=rec)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tax_revenue.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_tax_revenue(
exp_ptax[year] = round(fy2cy(fy_ptax[year], fy_ptax[year + 1]), 3)
# calculate actual tax revenues for each calendar year
pol = tc.Policy.tmd_constructor(
growfactors_path=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
growfactors=(STORAGE_FOLDER / "output" / "tmd_growfactors.csv"),
)
wghts = str(tmd_weights_path)
growf = tc.GrowFactors(growfactors_filename=str(tmd_growfactors_path))
Expand Down
4 changes: 2 additions & 2 deletions tmd/create_taxcalc_cached_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ def create_cached_files():
for each variable in the CACHED_TAXCALC_VARIABLES list.
"""
# calculate all Tax-Calculator variables for TAX_YEAR
pol = tc.Policy.tmd_constructor(growfactors_path=GFFILE_PATH)
pol = tc.Policy.tmd_constructor(growfactors=GFFILE_PATH)
rec = tc.Records.tmd_constructor(
data_path=INFILE_PATH,
weights_path=WTFILE_PATH,
growfactors_path=GFFILE_PATH,
growfactors=GFFILE_PATH,
exact_calculations=True,
)
calc = tc.Calculator(policy=pol, records=rec)
Expand Down
2 changes: 1 addition & 1 deletion tmd/utils/taxcalc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def add_taxcalc_outputs(
weights_scale=1.0,
)
if isinstance(growfactors, pathlib.PosixPath):
policy = tc.Policy.tmd_constructor(growfactors_path=growfactors)
policy = tc.Policy.tmd_constructor(growfactors=growfactors)
else:
policy = tc.Policy()
if reform:
Expand Down

0 comments on commit 849b6dd

Please sign in to comment.