Closed jdebacker closed 1 month ago
Attention: Patch coverage is 52.63158%
with 18 lines
in your changes missing coverage. Please review.
Project coverage is 70.12%. Comparing base (
4b32ef3
) to head (4137152
). Report is 30 commits behind head on master.
Files with missing lines | Patch % | Lines |
---|---|---|
ogcore/SS.py | 52.63% | 9 Missing :warning: |
ogcore/TPI.py | 0.00% | 8 Missing :warning: |
ogcore/fiscal.py | 90.00% | 1 Missing :warning: |
Added [WIP] to title as still working on some local only tests. Will remove when they are satisfied.
@jdebacker. For GH Actions tests, this PR just needs the make format
command. Merging PR #971 might fix some of the local tests that are failing (see this comment).
Thanks, @jdebacker, @rickecon. Looking forward to using this parameter.
Is it in the road map to have this included in the next OG-Core release so the functionality can be invoked from inside OG-USA?
@towashington. Yes. This parameter will be able to be used in OG-USA as soon as this is incorporated into OG-Core. @jdebacker, the code looks good to me. You just need to run make format
from the ogcore-dev
conda environment. Then let me know when the local tests are passing.
I've updated docs and this PR is compete. I will run the full suite of local tests when I have power and report results back here.
@jdebacker. I have gone through the code changes and approved them. The only further updates this PR needs are:
setup.py
and /ogcore/__init__.py
CHANGELOG.md
file (top and bottom)pyproject.toml
to target-version = ["py311", "py312"]
(I noticed this in doing a search of the repo on "version")@jdebacker. I ran all the local tests using your branch, and I got one failure on the last test of test_TPI.py
, test_run_TPI_extra[Baseline, Kg>0]
. The assert at the end was false. The traceback shows that the error was in the first set of asserts, and it looks like it is the B
object (see traceback output summary below).
(ogcore-dev) richardevans@Richards-MacBook-Pro-2 OG-Core % pytest
============================= test session starts ==============================
platform darwin -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /Users/richardevans/Docs/Economics/OSE/OG/OG-Core
configfile: pytest.ini
testpaths: ./tests
plugins: cov-5.0.0, anyio-4.6.0, xdist-3.6.1
collected 583 items
tests/test_SS.py ................................... [ 6%]
tests/test_TPI.py ..........................F [ 10%]
tests/test_aggregates.py ........................................ [ 17%]
tests/test_basic.py .... [ 18%]
tests/test_demographics.py ................ [ 20%]
tests/test_elliptical_u_est.py ....... [ 22%]
tests/test_execute.py . [ 22%]
tests/test_firm.py ..................................................... [ 31%]
................ [ 34%]
tests/test_fiscal.py ...................... [ 37%]
tests/test_household.py ................................................ [ 46%]
.. [ 46%]
tests/test_output_plots.py ............................................. [ 54%]
.. [ 54%]
tests/test_output_tables.py .............. [ 56%]
tests/test_parameter_plots.py ........................................ [ 63%]
tests/test_parameter_tables.py ....... [ 65%]
tests/test_parameters.py .............. [ 67%]
tests/test_pensions.py ............................... [ 72%]
tests/test_run_example.py .. [ 73%]
tests/test_run_ogcore.py . [ 73%]
tests/test_tax.py ................................. [ 78%]
tests/test_txfunc.py ............................... [ 84%]
tests/test_user_inputs.py ......... [ 85%]
tests/test_utils.py .................................................... [ 94%]
............................... [100%]
______________________ test_run_TPI_extra[Baseline, Kg>0] ______________________
...
for k, v in expected_dict.items():
print("Checking ", k)
try:
print("Diff = ", np.absolute(test_dict[k][: p.T] - v[: p.T]).max())
> assert np.allclose(
test_dict[k][: p.T], v[: p.T], rtol=1e-04, atol=1e-04
)
E assert False
E + where False = <function allclose at 0x111a7d970>(array([1.71272101, 1.72938281, 1.73864551, 1.72746434, 1.72145683,\n 1.71792535, 1.71655697, 1.71596647, 1.715334...32, 1.70702823, 1.70733347, 1.70764059, 1.70795034,\n 1.70826377, 1.70858234, 1.70890801, 1.70924351, 1.70959245]), array([1.71272101, 1.72938489, 1.73865549, 1.72748815, 1.72148578,\n 1.71794852, 1.71656468, 1.71595132, 1.715292...2 , 1.7070529 , 1.70735795, 1.70766489, 1.70797448,\n 1.70828778, 1.70860625, 1.70893187, 1.70926737, 1.70961641]), rtol=0.0001, atol=0.0001)
E + where <function allclose at 0x111a7d970> = np.allclose
----------------------------- Captured stdout call -----------------------------
...
Iteration: 2
Distance: 0.4542793707203373
Max absolute value resource constraint error: 0.023755596502261347
Checking time path for violations of constraints.
Max Euler error, savings: 2.3789858971667854e-12
Max Euler error labor supply: 1.7177370637000422e-12
Checking Y
Diff = 1.2723227424960015e-05
Checking B
Diff = 0.00030070629741585364
=========================== short test summary info ============================
FAILED tests/test_TPI.py::test_run_TPI_extra[Baseline, Kg>0] - assert False
========= 1 failed, 582 passed, 16753 warnings in 44007.79s (12:13:27) =========
@rickecon All local tests are now passing. The failure in tests/test_TPI.py::test_run_TPI_extra[Baseline, Kg>0]
was due to a change in the initial value of I_g
going into the transition path. Since this tests only runs TPI for two iterations, changes in the initial value can still be having an effect. The test tests/test_TPI.py::test_run_TPI_full_run[Baseline, Kg>0]
uses the same parameterization, but fully solves for the equilibrium transition path and this test was unaffected by the changes in the code.
To make sure tests/test_TPI.py::test_run_TPI_extra[Baseline, Kg>0]
passes, I saved a new pickle file representing the expected results given the new initial guess for I_g
.
@jdebacker. All local tests pass on my machine (I only checked test_tpy.py::test_run_TPI_extra
). I am now just waiting to get all the CI tests to pass. I am doing them one-by-one. This is frustrating when the CI tests don't just run automatically. But I will merge this as soon as I get all the tests to pass on GH Actions.
@jdebacker. Thanks for this. All is good. Merging now.
This PR adds three new parameters to apply a proportional change to the baseline spending levels for non-pension transfers, government consumption expenditures, and infrastructure spending. These parameters are
alpha_bs_T
,alpha_bs_G
, andalpha_bs_I
, respectively.Note that government consumption expenditures are only held at a level relative to the baseline level up until the time period the long run budget closure rule kicks in. At that point onward, government consumption expenditures are determined by the closure rule.
Addresses Issue #983.