From 3beface7d1b0d18380bb6b7e987f30da29a66228 Mon Sep 17 00:00:00 2001 From: jdebacker Date: Tue, 7 Feb 2023 08:59:49 -0500 Subject: [PATCH 1/2] fix to param dim in test_basic --- tests/test_basic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_basic.py b/tests/test_basic.py index b419d4b57..838f2c166 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -68,7 +68,7 @@ def test_constant_demographics_TPI(tmpdir, dask_client): "budget_balance": True, "zero_taxes": True, "maxiter": 2, - "r_gov_shift": 0.0, + "r_gov_shift": [0.0], "zeta_D": [0.0, 0.0], "zeta_K": [0.0, 0.0], "debt_ratio_ss": 1.0, @@ -125,7 +125,7 @@ def test_constant_demographics_TPI_small_open(tmpdir, dask_client): "budget_balance": True, "zero_taxes": True, "maxiter": 2, - "r_gov_shift": 0.0, + "r_gov_shift": [0.0], "zeta_D": [0.0, 0.0], "zeta_K": [1.0], "debt_ratio_ss": 1.0, From 784e02e84a779b00299aee9f0293f261b69e08a1 Mon Sep 17 00:00:00 2001 From: jdebacker Date: Tue, 14 Feb 2023 09:21:56 -0500 Subject: [PATCH 2/2] fix dim comparison for use of baseline solutions --- ogcore/SS.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ogcore/SS.py b/ogcore/SS.py index 4aeb88a08..45bc46603 100644 --- a/ogcore/SS.py +++ b/ogcore/SS.py @@ -1237,10 +1237,17 @@ def run_SS(p, client=None): if p.reform_use_baseline_solution: # use baseline solution as starting values if dimensions match try: + print( + "Shape HH = ", + ss_solutions["bssmat_splus1"].shape, + p.S, + p.J, + ) + print("Shape firm = ", ss_solutions["Y_vec_ss"].shape, p.M) if ss_solutions["bssmat_splus1"].shape == ( p.S, p.J, - ) and ss_solutions["Y_vec_ss"].shape == (p.M): + ) and np.squeeze(ss_solutions["Y_vec_ss"].shape) == (p.M): print("Using previous solutions for SS") ( b_guess, @@ -1269,10 +1276,15 @@ def run_SS(p, client=None): ) use_new_guesses = False else: + print( + "Dimensions of previous solutions for SS do not match" + ) use_new_guesses = True except KeyError: + print("KeyError: previous solutions for SS not found") use_new_guesses = True else: + print("Using new guesses for SS") use_new_guesses = True if use_new_guesses: if p.use_zeta: