From be90a3b3fa5f1370575585813c9d226c5ec131dc Mon Sep 17 00:00:00 2001 From: Jason DeBacker Date: Tue, 14 Jul 2026 14:55:10 -0400 Subject: [PATCH 1/4] reshape omega for tests --- ogcore/utils.py | 9 +++++++++ tests/test_aggregates.py | 7 +++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ogcore/utils.py b/ogcore/utils.py index fbd0c72d8..4fdbba72a 100644 --- a/ogcore/utils.py +++ b/ogcore/utils.py @@ -1006,6 +1006,15 @@ def extrapolate_array(param_in, dims=None, item="Parameter Name"): ), axis=0, ) + elif param_in.shape[0] == dims[0]: + param_in = ( + np.tile( + param_in.reshape(dims[0], dims[1], 1), + (1, 1, dims[2]), + ) + / dims[2] + ) + param_out = param_in else: print(item + " dimensions are: ", param_in.shape) print("please give an " + item + " that is either SxJ or TxS") diff --git a/tests/test_aggregates.py b/tests/test_aggregates.py index 39177cd8d..68af220cd 100644 --- a/tests/test_aggregates.py +++ b/tests/test_aggregates.py @@ -20,8 +20,8 @@ "replacement_rate_adjust": [[1.0]], "eta": (np.ones((40, 2)) / (40 * 2)), "lambdas": [0.6, 0.4], - "omega": np.ones((160, 40)) / 40, - "omega_SS": np.ones(40) / 40, + # "omega": np.tile(np.reshape(np.ones((160, 40)) / 40, (160, 40, 1)), (1, 1, 2)) * np.array([0.6, 0.4]).tolist(), + # "omega_SS": np.tile(np.reshape(np.ones(40) / 40, (40, 1)), (1, 2)) * np.array([0.6, 0.4]).tolist(), "e": np.ones((40, 2)), } # update parameters instance with new values for test @@ -32,8 +32,7 @@ for i in range(p.S): for k in range(p.J): L_loop[t, i, k] *= ( - p.omega[t, i].item() - * p.lambdas[k].item() + p.omega[t, i, k].item() * n[t, i, k].item() * p.e[t, i, k].item() ) From b909caac2cb9a79180f5c26242a0eba3d3d2949a Mon Sep 17 00:00:00 2001 From: Jason DeBacker Date: Mon, 10 Aug 2026 06:40:38 -0400 Subject: [PATCH 2/4] bump version and update changelog --- CHANGELOG.md | 20 +++++++++++++++++++- ogcore/__init__.py | 2 +- pyproject.toml | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54a1ffa17..7607aa508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.19.1] - 2026-08-10 12:00:00 ### Added @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 escalates from cycling to diverging), and a run that ends unconverged while stalled carries the diagnosis in the `RuntimeError` message, so it reaches users who only see the traceback. + - Makes default of aggregate plots to plot unstationarized model, resolving issue [#1133](https://github.com/PSLmodels/OG-Core/issues/1133). [PR #1183](https://github.com/PSLmodels/OG-Core/pull/1183). + ### Bug Fixes - Fixes Issue [#1186](https://github.com/PSLmodels/OG-Core/issues/1186): @@ -35,6 +37,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 the group's actual population (from `omega_SS` / `omega`), matching the `use_zeta = True` branch. Results are unchanged when demographics are common across groups. +- Fixes Issue [#1015](https://github.com/PSLmodels/OG-Core/issues/1015): fixes escape with special characters in parameter names that caused failures when reading from JSON files. Adds a test to prevent this in the future. [PR #1193](https://github.com/PSLmodels/OG-Core/pull/1193). +- Fixes Issue [#1169](https://github.com/PSLmodels/OG-Core/issues/1169): + the Notional Defined Contribution pension system could not run against + a real `Specifications` object because its growth-rate settings were + not parameters. `ndc_growth_rate`, `dir_growth_rate`, and + `points_growth_rate` are now parameters in `default_parameters.json` + (choices `"r"`, `"Curr GDP"`, `"LR GDP"`; default `"LR GDP"`, matching + the previous fallback behavior). `g_ndc` and `g_dir` now handle the + scalar `r` and `g_y` of the steady state, and `delta_ret` falls back + to the steady-state mortality rates implied by `rho` (averaged over + lifetime income groups) when no `mort_rates_SS` attribute is set. The + NDC system is added to the real-`Specifications` pension test. [PR #1190](https://github.com/PSLmodels/OG-Core/pull/1190). +- Resolve Issue [#1152](https://github.com/PSLmodels/OG-Core/issues/1152): expose same keys in the steady-state and time path dictionaries. [PR #1185](https://github.com/PSLmodels/OG-Core/pull/1185). +- Correct payroll tax calculations, resolving Issue [#1023](https://github.com/PSLmodels/OG-Core/issues/1023). [PR #1184](https://github.com/PSLmodels/OG-Core/pull/1184). ## [0.19.0] - 2026-07-29 12:00:00 @@ -732,6 +748,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Any earlier versions of OG-USA can be found in the [`OG-Core`](https://github.com/PSLmodels/OG-Core) repository [release history](https://github.com/PSLmodels/OG-Core/releases) from [v.0.6.4](https://github.com/PSLmodels/OG-Core/releases/tag/v0.6.4) (Jul. 20, 2021) or earlier. +[0.19.1]: https://github.com/PSLmodels/OG-Core/compare/v0.19.0...v0.19.1 +[0.19.0]: https://github.com/PSLmodels/OG-Core/compare/v0.18.1...v0.19.0 [0.18.1]: https://github.com/PSLmodels/OG-Core/compare/v0.18.0...v0.18.1 [0.18.0]: https://github.com/PSLmodels/OG-Core/compare/v0.17.0...v0.18.0 [0.17.0]: https://github.com/PSLmodels/OG-Core/compare/v0.16.4...v0.17.0 diff --git a/ogcore/__init__.py b/ogcore/__init__.py index 40b3bba0f..3165c6df1 100644 --- a/ogcore/__init__.py +++ b/ogcore/__init__.py @@ -21,4 +21,4 @@ from ogcore.txfunc import * # noqa: F403 from ogcore.utils import * # noqa: F403 -__version__ = "0.19.0" +__version__ = "0.19.1" diff --git a/pyproject.toml b/pyproject.toml index a1e6d062e..8c2ce6fa0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "ogcore" -version = "0.19.0" +version = "0.19.1" authors = [ {name = "Jason DeBacker and Richard W. Evans"}, ] From b2252db6473ebfacf752bcbc64b0f1a5240d80a6 Mon Sep 17 00:00:00 2001 From: Jason DeBacker Date: Mon, 10 Aug 2026 06:59:01 -0400 Subject: [PATCH 3/4] bring api docs up to date --- docs/book/content/api/aggregates.rst | 5 +++-- docs/book/content/api/demographics.rst | 2 +- docs/book/content/api/firm.rst | 6 +++--- docs/book/content/api/output_tables.rst | 2 +- docs/book/content/api/pensions.rst | 2 +- docs/book/content/api/public_api.rst | 3 +++ docs/book/content/api/solvers.rst | 2 +- docs/book/content/api/tax.rst | 2 +- docs/book/content/api/txfunc.rst | 2 +- docs/book/content/api/utils.rst | 4 ++-- 10 files changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/book/content/api/aggregates.rst b/docs/book/content/api/aggregates.rst index e83a73d79..35c817a4b 100644 --- a/docs/book/content/api/aggregates.rst +++ b/docs/book/content/api/aggregates.rst @@ -9,5 +9,6 @@ ogcore.aggregates ------------------------------------------ .. automodule:: ogcore.aggregates - :members: get_L, get_I, get_B, get_BQ, get_RM, get_C, revenue, get_r_p, - resource_constraint, get_K_splits, get_ptilde + :members: get_L, get_I, get_B, get_BQ, get_RM, get_C, revenue, + get_payroll_tax_revenue, get_r_p, resource_constraint, get_capital_outflows, + get_K_splits, get_ptilde diff --git a/docs/book/content/api/demographics.rst b/docs/book/content/api/demographics.rst index 8ae05304f..15dc1a1c7 100644 --- a/docs/book/content/api/demographics.rst +++ b/docs/book/content/api/demographics.rst @@ -10,4 +10,4 @@ ogcore.demographics .. automodule:: ogcore.demographics :members: get_un_data, get_fert, get_mort, get_pop, pop_rebin, get_imm_rates, - immsolve, get_pop_objs, pre_pop_solve + immsolve, expand_pop_obj_J, get_pop_objs diff --git a/docs/book/content/api/firm.rst b/docs/book/content/api/firm.rst index 6e53091ef..8b2a5e706 100644 --- a/docs/book/content/api/firm.rst +++ b/docs/book/content/api/firm.rst @@ -9,6 +9,6 @@ ogcore.firm ------------------------------------------ .. automodule:: ogcore.firm - :members: get_Y, get_r, get_w, get_KLratio, get_MPx, - get_w_from_r, get_K, get_L_from_Y, - get_pm, solve_L, get_cost_of_capital + :members: get_Y, get_r, get_w, get_KLratio_KLonly, get_KLratio, get_MPx, + get_w_from_r, get_K_KLonly, get_K, get_L_from_Y, get_cost_of_capital, + get_pm, get_KY_ratio, solve_L, adj_cost diff --git a/docs/book/content/api/output_tables.rst b/docs/book/content/api/output_tables.rst index dbb4c4d12..c863a0874 100644 --- a/docs/book/content/api/output_tables.rst +++ b/docs/book/content/api/output_tables.rst @@ -11,4 +11,4 @@ ogcore.output_tables .. automodule:: ogcore.output_tables :members: macro_table, macro_table_SS, ineq_table, gini_table, wealth_moments_table, time_series_table, - dynamic_revenue_decomposition + dynamic_revenue_decomposition, model_fit_table diff --git a/docs/book/content/api/pensions.rst b/docs/book/content/api/pensions.rst index c672e42dd..5d03efff0 100644 --- a/docs/book/content/api/pensions.rst +++ b/docs/book/content/api/pensions.rst @@ -13,4 +13,4 @@ ogcore.pensions NDC_amount, PS_amount, deriv_theta, deriv_NDC, deriv_DB, deriv_PS, delta_point, g_ndc, g_dir, delta_ret, deriv_DB_loop, deriv_PS_loop, deriv_NDC_loop, delta_ret_loop, PS_1dim_loop, PS_2dim_loop, DB_1dim_loop, - DB_2dim_loop, NDC_1dim_loop, NDC_2dim_loop + DB_2dim_loop, DB_3dim_loop, NDC_1dim_loop, NDC_2dim_loop diff --git a/docs/book/content/api/public_api.rst b/docs/book/content/api/public_api.rst index a407b1aa0..59812b70a 100644 --- a/docs/book/content/api/public_api.rst +++ b/docs/book/content/api/public_api.rst @@ -12,6 +12,7 @@ There is also a link to the source code for each documented member. :maxdepth: 1 aggregates + config demographics elliptical_u_est execute @@ -25,6 +26,8 @@ There is also a link to the source code for each documented member. parameters pensions solvers + SS tax + TPI txfunc utils diff --git a/docs/book/content/api/solvers.rst b/docs/book/content/api/solvers.rst index 0f2592c76..83592e537 100644 --- a/docs/book/content/api/solvers.rst +++ b/docs/book/content/api/solvers.rst @@ -14,4 +14,4 @@ ogcore.solvers :members: update, reset .. automodule:: ogcore.solvers - :members: make_outer_updater, pack_outer_vars, unpack_outer_vars + :members: make_outer_updater, pack_outer_vars, unpack_outer_vars, diagnose_stall diff --git a/docs/book/content/api/tax.rst b/docs/book/content/api/tax.rst index 1866139da..f7e091a92 100644 --- a/docs/book/content/api/tax.rst +++ b/docs/book/content/api/tax.rst @@ -11,4 +11,4 @@ ogcore.tax .. automodule:: ogcore.tax :members: ETR_wealth, MTR_wealth, ETR_income, MTR_income, get_biz_tax, net_taxes, income_tax_liab, - wealth_tax_liab, bequest_tax_liab + wealth_tax_liab, bequest_tax_liab, cons_tax_liab diff --git a/docs/book/content/api/txfunc.rst b/docs/book/content/api/txfunc.rst index b3b7c415b..d8cab1027 100644 --- a/docs/book/content/api/txfunc.rst +++ b/docs/book/content/api/txfunc.rst @@ -11,4 +11,4 @@ ogcore.txfunc .. automodule:: ogcore.txfunc :members: get_tax_rates, wsumsq, find_outliers, replace_outliers, txfunc_est, tax_data_sample, tax_func_loop, tax_func_estimate, - monotone_spline + avg_by_bin_multd, monotone_spline diff --git a/docs/book/content/api/utils.rst b/docs/book/content/api/utils.rst index 7292953b5..c148401e3 100644 --- a/docs/book/content/api/utils.rst +++ b/docs/book/content/api/utils.rst @@ -21,5 +21,5 @@ ogcore.utils pickle_file_compare, comp_array, comp_scalar, dict_compare, to_timepath_shape, get_initial_path, safe_read_pickle, rate_conversion, save_return_table, print_progress, fetch_files_from_web, not_connected, - avg_by_bin, extrapolate_arrays, get_legacy_session, shift_bio_clock, - unstationarize_vars, params_to_json + avg_by_bin, extrapolate_array, extrapolate_nested_list, get_legacy_session, + shift_bio_clock, unstationarize_vars, params_to_json, json_to_dict From 81ca323778722e5de6e612479828b75bff115bdb Mon Sep 17 00:00:00 2001 From: Jason DeBacker Date: Mon, 10 Aug 2026 13:24:48 -0400 Subject: [PATCH 4/4] update changelog for consistency --- CHANGELOG.md | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7607aa508..3e7eb0a39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,31 +24,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 escalates from cycling to diverging), and a run that ends unconverged while stalled carries the diagnosis in the `RuntimeError` message, so it reaches users who only see the traceback. - - Makes default of aggregate plots to plot unstationarized model, resolving issue [#1133](https://github.com/PSLmodels/OG-Core/issues/1133). [PR #1183](https://github.com/PSLmodels/OG-Core/pull/1183). + [PR #1178](https://github.com/PSLmodels/OG-Core/pull/1178). +- Changes the default of `stationarized` to `False` in `output_plots.plot_aggregates` and `output_plots.plot_industry_aggregates`, so unstationarized values are plotted by default, resolving Issue [#1133](https://github.com/PSLmodels/OG-Core/issues/1133). [PR #1183](https://github.com/PSLmodels/OG-Core/pull/1183). ### Bug Fixes - Fixes Issue [#1186](https://github.com/PSLmodels/OG-Core/issues/1186): - with demographics that vary across lifetime income groups (PR #1165), the - `use_zeta = False` branch of `household.get_bq` divided each group's - bequest pool by its birth share (`lambdas[j]`) rather than its actual - population share, so bequests received did not sum to bequests left and - the steady-state resource constraint failed. Receipts are now divided by - the group's actual population (from `omega_SS` / `omega`), matching the - `use_zeta = True` branch. Results are unchanged when demographics are - common across groups. + with demographics that vary across lifetime income groups (introduced in + PR #1165), the `use_zeta = False` branch of `household.get_bq` divided + each group's bequest pool by its birth share (`lambdas[j]`) rather than + its actual population share, so bequests received did not sum to bequests + left and the steady-state resource constraint failed. Receipts are now + divided by the group's actual population (from `omega_SS` / `omega`), + matching the `use_zeta = True` branch. Results are unchanged when + demographics are common across groups. [PR #1187](https://github.com/PSLmodels/OG-Core/pull/1187). - Fixes Issue [#1015](https://github.com/PSLmodels/OG-Core/issues/1015): fixes escape with special characters in parameter names that caused failures when reading from JSON files. Adds a test to prevent this in the future. [PR #1193](https://github.com/PSLmodels/OG-Core/pull/1193). -- Fixes Issue [#1169](https://github.com/PSLmodels/OG-Core/issues/1169): - the Notional Defined Contribution pension system could not run against - a real `Specifications` object because its growth-rate settings were - not parameters. `ndc_growth_rate`, `dir_growth_rate`, and - `points_growth_rate` are now parameters in `default_parameters.json` - (choices `"r"`, `"Curr GDP"`, `"LR GDP"`; default `"LR GDP"`, matching - the previous fallback behavior). `g_ndc` and `g_dir` now handle the - scalar `r` and `g_y` of the steady state, and `delta_ret` falls back - to the steady-state mortality rates implied by `rho` (averaged over - lifetime income groups) when no `mort_rates_SS` attribute is set. The - NDC system is added to the real-`Specifications` pension test. [PR #1190](https://github.com/PSLmodels/OG-Core/pull/1190). - Resolve Issue [#1152](https://github.com/PSLmodels/OG-Core/issues/1152): expose same keys in the steady-state and time path dictionaries. [PR #1185](https://github.com/PSLmodels/OG-Core/pull/1185). - Correct payroll tax calculations, resolving Issue [#1023](https://github.com/PSLmodels/OG-Core/issues/1023). [PR #1184](https://github.com/PSLmodels/OG-Core/pull/1184).