diff --git a/CHANGELOG.md b/CHANGELOG.md index bece42349..e4407f4eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ 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). +## [0.16.3] - 2026-06-25 15:00:00 + +### Added + +- Better functionality and more country repositories with the OG installer. See PR [#1162](https://github.com/PSLmodels/OG-Core/pull/1162) + +### Bug Fix +- Fixes an inconsistency with the pre-time path population distribution and growth rates. Note that the `demographics.get_pop` function has been changed and now only returns one object: the population distribution (not also the distribution prior to the start year). In addition, the `get_pop` and `get_pop_objs` functions no longer have the `pre_pop_dist` kwarg. See PR [#1073](https://github.com/PSLmodels/OG-Core/pull/1073). + ## [0.16.2] - 2026-06-15 12:00:00 ### Added @@ -17,9 +26,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixes math notation for plot labels. ([PR #1148](https://github.com/PSLmodels/OG-Core/pull/1148)) - Fixes reshaping issues with `J=1` parameterization. ([PR #1145](https://github.com/PSLmodels/OG-Core/pull/1145)) -### Bug Fix - -- Fixed math notion for tilde variables in plot labels in `output_plots.py` to be consistent with the documentation and the code. See PR [#1148](https://github.com/PSLmodels/OG-Core/pull/1148). ## [0.16.1] - 2026-06-04 12:00:00 @@ -603,6 +609,7 @@ 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.16.3]: https://github.com/PSLmodels/OG-Core/compare/v0.16.2...v0.16.3 [0.16.2]: https://github.com/PSLmodels/OG-Core/compare/v0.16.1...v0.16.2 [0.16.1]: https://github.com/PSLmodels/OG-Core/compare/v0.16.0...v0.16.1 [0.16.0]: https://github.com/PSLmodels/OG-Core/compare/v0.15.13...v0.16.0 diff --git a/ogcore/__init__.py b/ogcore/__init__.py index 062ae23be..322557a0d 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.16.2" +__version__ = "0.16.3" diff --git a/ogcore/aggregates.py b/ogcore/aggregates.py index aecda7fe1..6d0d69542 100644 --- a/ogcore/aggregates.py +++ b/ogcore/aggregates.py @@ -95,16 +95,14 @@ def get_I(b_splus1, K_p1, K, p, method): ) .sum(1) .sum(1) - ) / (1 + np.squeeze(np.hstack((p.g_n[1 : p.T], p.g_n_ss)))) + ) / (1 + np.squeeze(np.hstack((p.g_n[: p.T - 1], p.g_n_ss)))) aggI = ( - 1 + np.squeeze(np.hstack((p.g_n[1 : p.T], p.g_n_ss))) + 1 + np.squeeze(np.hstack((p.g_n[: p.T - 1], p.g_n_ss))) ) * np.exp(p.g_y) * (K_p1 - part2) - (1.0 - p.delta) * K elif method == "total_ss": aggI = ((1 + p.g_n_ss) * np.exp(p.g_y) - 1 + p.delta) * K elif method == "total_tpi": - aggI = (1 + p.g_n[1 : p.T + 1]) * np.exp(p.g_y) * K_p1 - ( - 1.0 - p.delta - ) * K + aggI = (1 + p.g_n[: p.T]) * np.exp(p.g_y) * K_p1 - (1.0 - p.delta) * K return aggI @@ -133,8 +131,8 @@ def get_B(b, p, method, preTP): if preTP: part1 = b * np.transpose(p.omega_S_preTP * p.lambdas) omega_extended = np.append(p.omega_S_preTP[1:], [0.0]) - imm_extended = np.append(p.imm_rates[0, 1:], [0.0]) - pop_growth_rate = p.g_n[0] + imm_extended = np.append(p.imm_rates_preTP[1:], [0.0]) + pop_growth_rate = p.g_n_preTP else: part1 = b * np.transpose(p.omega_SS * p.lambdas) omega_extended = np.append(p.omega_SS[1:], [0.0]) @@ -157,7 +155,7 @@ def get_B(b, p, method, preTP): ) B_presum = part1 + part2 B = B_presum.sum(1).sum(1) - B /= 1.0 + np.hstack((p.g_n[1 : p.T], p.g_n_ss)) + B /= 1.0 + np.hstack((p.g_n[: p.T - 1], p.g_n_ss)) return B @@ -189,8 +187,8 @@ def get_BQ(r, b_splus1, j, p, method, preTP): if method == "SS": if preTP: omega = p.omega_S_preTP - pop_growth_rate = p.g_n[0] - rho = p.rho[0, :] + pop_growth_rate = p.g_n_preTP + rho = p.rho_preTP else: omega = p.omega_SS pop_growth_rate = p.g_n_ss @@ -206,20 +204,24 @@ def get_BQ(r, b_splus1, j, p, method, preTP): p.omega_S_preTP.reshape(1, p.S), p.omega[: p.T - 1, :], axis=0 ) rho = np.append( - p.rho[0, :].reshape(1, p.S), p.rho[: p.T - 1, :], axis=0 + p.rho_preTP.reshape(1, p.S), p.rho[: p.T - 1, :], axis=0 ) if j is not None: BQ_presum = (b_splus1 * p.lambdas[j]) * (pop * rho) BQ = BQ_presum.sum(1) - BQ *= (1.0 + r) / (1.0 + p.g_n[: p.T]) + BQ *= (1.0 + r) / (1.0 + np.append(p.g_n_preTP, p.g_n[: p.T - 1])) else: BQ_presum = (b_splus1 * np.squeeze(p.lambdas)) * np.tile( np.reshape(pop * rho, (p.T, p.S, 1)), (1, 1, p.J) ) BQ = BQ_presum.sum(1) BQ *= np.tile( - np.reshape((1.0 + r) / (1.0 + p.g_n[: p.T]), (p.T, 1)), + np.reshape( + (1.0 + r) + / (1.0 + np.append(p.g_n_preTP, p.g_n[: p.T - 1])), + (p.T, 1), + ), (1, p.J), ) if p.use_zeta: @@ -261,15 +263,15 @@ def get_RM(Y, p, method): RM = np.zeros_like(Y) RM[0] = p.alpha_RM_1 * Y[0] for t in range(1, p.tG1): - RM[t] = ((1 + p.g_RM[t]) / (np.exp(p.g_y) * (1 + p.g_n[t]))) * RM[ - t - 1 - ] + RM[t] = ( + (1 + p.g_RM[t]) / (np.exp(p.g_y) * (1 + p.g_n[t - 1])) + ) * RM[t - 1] rho_vec = np.linspace(0, 1, p.tG2 - p.tG1) for t in range(p.tG1, p.tG2 - 1): RM[t] = ( rho_vec[t - p.tG1] * p.alpha_RM_T * Y[t] + (1 - rho_vec[t - p.tG1]) - * ((1 + p.g_RM[t]) / (np.exp(p.g_y) * (1 + p.g_n[t]))) + * ((1 + p.g_RM[t]) / (np.exp(p.g_y) * (1 + p.g_n[t - 1]))) * RM[t - 1] ) RM[p.tG2 - 1 :] = p.alpha_RM_T * Y[p.tG2 - 1 :] diff --git a/ogcore/default_parameters.json b/ogcore/default_parameters.json index e77049501..80f26c8ef 100644 --- a/ogcore/default_parameters.json +++ b/ogcore/default_parameters.json @@ -4426,7 +4426,7 @@ "validators": { "range": { "min": 2013, - "max": 2100 + "max": 2101 } } }, @@ -4865,8 +4865,7 @@ "value": [ { "value": [0.017479913702712725, 0.017252673721361574, 0.017313468985451712, 0.01741734467720022, 0.017610836147653894, 0.018037326972746067, 0.018428614504312973, 0.018731212768297128, 0.019223877430412158, 0.019533665622202632, 0.019434917008899554, 0.018636460788059497, 0.018161740350649384, 0.017819885884360336, 0.017856106761386912, 0.017939064896242172, 0.0173584158450137, 0.01759326731381578, 0.017556092457882918, 0.017348831455567988, 0.01763610875892841, 0.016521134511611055, 0.01616493583053726, 0.015964729480990054, 0.015477015195103342, 0.01591654299984056, 0.01539650128360123, 0.01561223197188071, 0.016292741432876165, 0.017193018202081137, 0.01736681745887612, 0.016428597852015135, 0.01605376707200027, 0.016036840400303197, 0.016306172531601798, 0.017250621809611313, 0.017536449193224023, 0.017487907335860874, 0.017416472477538542, 0.017590642752769312, 0.01769271828193883, 0.017056672755048446, 0.016903326974848074, 0.016655018441783655, 0.01601349080436947, 0.015817814264164037, 0.015095305117520927, 0.014438237313875455, 0.013801453267642878, 0.013298311958716617, 0.012889796775514745, 0.012405992316545383, 0.012171305937986552, 0.012537090181191982, 0.009140572473656714, 0.008895104621663985, 0.00854997250414294, 0.008604276207804186, 0.007359240011714394, 0.0065857742259522725, 0.00608824742682594, 0.005584969530483296, 0.005194883294310685, 0.00463722646525393, 0.004268302269151332, 0.003921275687879491, 0.003360617443596329, 0.00307989603033834, 0.0027689270722019797, 0.002464564334019259, 0.002189389475001142, 0.001817465282607566, 0.0015516186002795162, 0.001280287314428285, 0.0010211214995148833, 0.0008163607706652746, 0.0006238227539144882, 0.0004616610853196622, 0.0003378106654761438, 0.00023711271717107317] - } - ], + } ], "validators": { "range": { "min": 0.0, @@ -4885,7 +4884,7 @@ "number_dims": 1, "value": [ { - "value": [0.0074789353843102225, 0.006834993542621297, 0.006653225001690326, 0.00652784348280738, 0.006252158866942088, 0.0060519663092557, 0.005927348800090981, 0.005594875465009387, 0.004835288606445161, 0.004534289096571055, 0.004274806326227125, 0.003900582926257704, 0.0035998428189011624, 0.0035833953522265076, 0.0034267236614059127, 0.003270850438143563, 0.0031169430165415846, 0.002961078474714527, 0.0028177261982753354, 0.002677495218470328, 0.002541547314627544, 0.0024045915000439596, 0.0022665897130737054, 0.0021732295634988366, 0.00207873901027865, 0.0019900216129545407, 0.0018395212252497047, 0.0017890413022192567, 0.0017406921350626252, 0.0016932562282798336, 0.0016569352537327802, 0.0016304972412628034, 0.0016144963906685854, 0.0016114323926074408, 0.0016186971546927015, 0.0016434366980985925, 0.0016640421457020651, 0.0016944104790968955, 0.0017273966398703468, 0.0017488640289605084, 0.0017789274813895762, 0.0018046885457893567, 0.001818389810772507, 0.0018248322233003508, 0.0018296423265007616, 0.0018367753092532824, 0.001821799467515826, 0.0017928561543487048, 0.001752500476254632, 0.0016986754030037005, 0.0016605234748884568, 0.0016312063741564567, 0.0015922348469128227, 0.0015392545549185843, 0.0014719951498731473, 0.0014222730923393588, 0.0013611008933590942, 0.0013078544843738585, 0.0012589546766055702, 0.001205567770904814, 0.0011829778739189157, 0.0011611732667875956, 0.0011480343590222503, 0.0011459931814593008, 0.0011371876800398203, 0.0011444855746834146, 0.0011574756884658534, 0.0011683772821057892, 0.0011804805841238088, 0.0011910486088919261, 0.0012149381570408183, 0.001246337444431704, 0.0012783187352835563, 0.0013035224499606277, 0.0013258549569985809, 0.001345376285625385, 0.0013580694648621721, 0.001366132659251471, 0.0013711268838134448, 0.0013696159033951146, 0.0013733898902582502, 0.0013778190844015877, 0.0013715269368511313, 0.001360014901026005, 0.001348706020629292, 0.0013350486191730055, 0.0013187914620439829, 0.0013052006148473814, 0.001298587953182279, 0.0012850091782763441, 0.0012701861326048411, 0.0012590560875103214, 0.0012495339749562758, 0.0012382152409781792, 0.0012319571018879906, 0.0012299562625215966, 0.0012312026810140416, 0.001235153721389576, 0.0012413611421874537, 0.0012493548164265115, 0.0012586261162422863, 0.0012686516826805208, 0.0012789288563902492, 0.00128899920210946, 0.0012984607957862535, 0.0013069760464742466, 0.0013142686369984596, 0.0013201170575894143, 0.00132436125530748, 0.0013269163230820308, 0.0013277739460508468, 0.0013269988545954675, 0.0013247256106492325, 0.0013211490055036505, 0.0013165077235253876, 0.0013110693841997623, 0.0013051164591361462, 0.001298932625954003, 0.001292791018898726, 0.0012869434491480742, 0.0012816107961396257, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872] + "value": [0.006834993542621297, 0.006653225001690326, 0.00652784348280738, 0.006252158866942088, 0.0060519663092557, 0.005927348800090981, 0.005594875465009387, 0.004835288606445161, 0.004534289096571055, 0.004274806326227125, 0.003900582926257704, 0.0035998428189011624, 0.0035833953522265076, 0.0034267236614059127, 0.003270850438143563, 0.0031169430165415846, 0.002961078474714527, 0.0028177261982753354, 0.002677495218470328, 0.002541547314627544, 0.0024045915000439596, 0.0022665897130737054, 0.0021732295634988366, 0.00207873901027865, 0.0019900216129545407, 0.0018395212252497047, 0.0017890413022192567, 0.0017406921350626252, 0.0016932562282798336, 0.0016569352537327802, 0.0016304972412628034, 0.0016144963906685854, 0.0016114323926074408, 0.0016186971546927015, 0.0016434366980985925, 0.0016640421457020651, 0.0016944104790968955, 0.0017273966398703468, 0.0017488640289605084, 0.0017789274813895762, 0.0018046885457893567, 0.001818389810772507, 0.0018248322233003508, 0.0018296423265007616, 0.0018367753092532824, 0.001821799467515826, 0.0017928561543487048, 0.001752500476254632, 0.0016986754030037005, 0.0016605234748884568, 0.0016312063741564567, 0.0015922348469128227, 0.0015392545549185843, 0.0014719951498731473, 0.0014222730923393588, 0.0013611008933590942, 0.0013078544843738585, 0.0012589546766055702, 0.001205567770904814, 0.0011829778739189157, 0.0011611732667875956, 0.0011480343590222503, 0.0011459931814593008, 0.0011371876800398203, 0.0011444855746834146, 0.0011574756884658534, 0.0011683772821057892, 0.0011804805841238088, 0.0011910486088919261, 0.0012149381570408183, 0.001246337444431704, 0.0012783187352835563, 0.0013035224499606277, 0.0013258549569985809, 0.001345376285625385, 0.0013580694648621721, 0.001366132659251471, 0.0013711268838134448, 0.0013696159033951146, 0.0013733898902582502, 0.0013778190844015877, 0.0013715269368511313, 0.001360014901026005, 0.001348706020629292, 0.0013350486191730055, 0.0013187914620439829, 0.0013052006148473814, 0.001298587953182279, 0.0012850091782763441, 0.0012701861326048411, 0.0012590560875103214, 0.0012495339749562758, 0.0012382152409781792, 0.0012319571018879906, 0.0012299562625215966, 0.0012312026810140416, 0.001235153721389576, 0.0012413611421874537, 0.0012493548164265115, 0.0012586261162422863, 0.0012686516826805208, 0.0012789288563902492, 0.00128899920210946, 0.0012984607957862535, 0.0013069760464742466, 0.0013142686369984596, 0.0013201170575894143, 0.00132436125530748, 0.0013269163230820308, 0.0013277739460508468, 0.0013269988545954675, 0.0013247256106492325, 0.0013211490055036505, 0.0013165077235253876, 0.0013110693841997623, 0.0013051164591361462, 0.001298932625954003, 0.001292791018898726, 0.0012869434491480742, 0.0012816107961396257, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872, 0.0012907765315350872] } ], "validators": { @@ -4915,6 +4914,24 @@ } } }, + "g_n_preTP": { + "title": "Population growth rate from year before model start to start year", + "description": "Population growth rate from year before model start to start year.", + "section_1": "Demographic Parameters", + "notes": "", + "type": "float", + "value": [ + { + "value": 0.0074789353843102225 + } + ], + "validators": { + "range": { + "min": -1.0, + "max": 1.0 + } + } + }, "imm_rates": { "title": "Immigration rates over the time path.", "description": "Immigration rates over the time path.", @@ -4938,6 +4955,45 @@ } } }, + "imm_rates_preTP": { + "title": "Immigration rates in period before model start year", + "description": "Immigration rates in period before model start year.", + "section_1": "Demographic Parameters", + "notes": "", + "type": "float", + "number_dims": 1, + "value": [ + { + "value": + [6.21124324e-03, 6.69539127e-03, 7.24160599e-03, 7.59057707e-03, + 7.64614775e-03, 7.51951110e-03, 7.06681489e-03, 6.56429771e-03, + 6.07319754e-03, 5.50700033e-03, 4.94732741e-03, 4.54958259e-03, + 4.23425001e-03, 3.97403995e-03, 3.67752183e-03, 3.38021287e-03, + 3.00514338e-03, 2.71916344e-03, 2.41686669e-03, 2.13548533e-03, + 1.86850952e-03, 1.63930855e-03, 1.45713458e-03, 1.34212247e-03, + 1.27164811e-03, 9.88138261e-04, 8.42267890e-04, 7.97801211e-04, + 6.63231805e-04, 4.87948389e-04, 4.32979019e-04, 5.60040782e-04, + 4.55369916e-04, 4.13717216e-04, 4.55029226e-04, 4.52104109e-04, + 5.58645176e-04, 6.14631276e-04, 5.66684121e-04, 5.11408015e-04, + 4.68968748e-04, 4.86541731e-04, 1.87084644e-04, -2.33525940e-05, + 1.21315737e-03, 1.05324177e-03, 8.29011129e-07, -1.80456466e-04, + 6.44696838e-04, 1.08838720e-03, 6.18137660e-04, 4.41473826e-04, + 6.10186803e-04, 6.58633423e-04, 5.63207404e-04, 5.34295717e-04, + 6.00114993e-04, 6.29050763e-04, 8.43098879e-04, 9.20493620e-04, + 9.68908696e-04, 1.26374022e-03, 1.60616956e-03, 1.72840304e-03, + 1.50429547e-03, 1.03459297e-03, 8.01449649e-04, 9.28625040e-04, + 1.60993336e-03, 2.23227102e-03, 3.53451125e-03, 5.32480275e-03, + 7.84622608e-03, 1.08220386e-02, 1.30810434e-02, 1.64519720e-02, + 1.88010017e-02, 2.12725905e-02, 2.17955114e-02, 1.92400972e-02] + } + ], + "validators": { + "range": { + "min": -1.0, + "max": 1.0 + } + } + }, "rho": { "title": "Age-specific mortality rates.", "description": "Age-specific mortality rates.", @@ -4959,6 +5015,44 @@ } } }, + "rho_preTP": { + "title": "Age-specific mortality rates.", + "description": "Age-specific mortality rates.", + "section_1": "Demographic Parameters", + "notes": "", + "type": "float", + "number_dims": 1, + "value": [ + { + "value": [7.32853396e-04, 8.17119742e-04, 8.78872967e-04, 9.11652521e-04, + 9.22980233e-04, 9.27340681e-04, 9.35710239e-04, 9.50095370e-04, + 9.75973557e-04, 1.01035546e-03, 1.04974597e-03, 1.08965056e-03, + 1.12905646e-03, 1.16544560e-03, 1.20432393e-03, 1.25117739e-03, + 1.31100453e-03, 1.38282557e-03, 1.46963538e-03, 1.57292023e-03, + 1.69015991e-03, 1.82531513e-03, 1.98785868e-03, 2.18224842e-03, + 2.40545835e-03, 2.64949570e-03, 2.91235990e-03, 3.19652189e-03, + 3.50144041e-03, 3.82658531e-03, 4.17597720e-03, 4.54600008e-03, + 4.92938669e-03, 5.32344068e-03, 5.73216261e-03, 6.18294920e-03, + 6.66506301e-03, 7.14289275e-03, 7.60533472e-03, 8.07929361e-03, + 8.60718380e-03, 9.21954043e-03, 9.91697732e-03, 1.07137947e-02, + 1.16186807e-02, 1.26511756e-02, 1.38062007e-02, 1.50692314e-02, + 1.64399087e-02, 1.79462854e-02, 1.96828400e-02, 2.16430913e-02, + 2.37466335e-02, 2.59837193e-02, 2.84282734e-02, 3.12585980e-02, + 3.45111290e-02, 3.80870625e-02, 4.19924732e-02, 4.63268386e-02, + 5.13310180e-02, 5.70418578e-02, 6.33201548e-02, 7.01769632e-02, + 7.77688358e-02, 8.62903314e-02, 9.59061899e-02, 1.06724255e-01, + 1.18798575e-01, 1.32125256e-01, 1.46682823e-01, 1.62432478e-01, + 1.79326966e-01, 1.97313414e-01, 2.16339448e-01, 2.35357633e-01, + 2.54059844e-01, 2.72119171e-01, 2.89195180e-01, 1.00000000e+00] + } + ], + "validators": { + "range": { + "min": 0.0, + "max": 1.0 + } + } + }, "etr_params": { "title": "Effective tax rate function parameters.", "description": "Effective tax rate function parameters.", diff --git a/ogcore/demographics.py b/ogcore/demographics.py index 580885475..40c37174a 100644 --- a/ogcore/demographics.py +++ b/ogcore/demographics.py @@ -353,7 +353,6 @@ def get_pop( infmort_rates=None, imm_rates=None, initial_pop=None, - pre_pop_dist=None, country_id=UN_COUNTRY_CODE, start_year=START_YEAR, end_year=END_YEAR, @@ -382,8 +381,6 @@ def get_pop( and model age initial_pop_data (Pandas DataFrame): initial population data for the first year of model calibration (start_year) - pre_pop_dist (Numpy array): population distribution for the year - before the initial year for calibration country_id (str): country id for UN data start_year (int): start year data end_year (int): end year for data @@ -391,33 +388,11 @@ def get_pop( Returns: pop_2D (Numpy array): population distribution over T0 periods - pre_pop (Numpy array): population distribution one year before - initial year for calibration of omega_S_preTP """ # Generate time path of the nonstationary population distribution # Get path up to end of data year pop_2D = np.zeros((end_year + 2 - start_year, E + S)) if infer_pop: - if pre_pop_dist is None: - pre_pop_data = get_un_data( - "47", - country_id=country_id, - start_year=start_year - 1, - end_year=start_year - 1, - ) - if download_path: - pre_pop_data.to_csv( - os.path.join(download_path, "raw_pre_pop_data_UN.csv"), - index=False, - ) - pre_pop_sample = pre_pop_data[ - (pre_pop_data["age"] >= min_age) - & (pre_pop_data["age"] <= max_age) - ] - pre_pop = pre_pop_sample.value.values - pre_pop_dist = pop_rebin(pre_pop, E + S) - else: - pre_pop = pre_pop_dist if initial_pop is None: initial_pop_data = get_un_data( "47", @@ -473,38 +448,17 @@ def get_pop( pop = pop_data_sample.value.values # Generate the current population distribution given that E+S might # be less than max_age-min_age+1 - # age_per_EpS = np.arange(1, E + S + 1) pop_EpS = pop_rebin(pop, E + S) pop_2D[y - start_year, :] = pop_EpS - # get population distribution one year before initial year for - # calibration of omega_S_preTP - pre_pop_data = get_un_data( - "47", - country_id=country_id, - start_year=start_year - 1, - end_year=start_year - 1, - ) - pre_pop_sample = pre_pop_data[ - (pre_pop_data["age"] >= min_age) & (pre_pop_data["age"] <= max_age) - ] - pre_pop = pre_pop_sample.value.values - if download_path: np.savetxt( os.path.join(download_path, "population_distribution.csv"), pop_2D, delimiter=",", ) - np.savetxt( - os.path.join( - download_path, "pre_period_population_distribution.csv" - ), - pre_pop, - delimiter=",", - ) - return pop_2D, pre_pop + return pop_2D def pop_rebin(curr_pop_dist, totpers_new): @@ -730,7 +684,6 @@ def get_pop_objs( imm_rates=None, infer_pop=False, pop_dist=None, - pre_pop_dist=None, country_id=UN_COUNTRY_CODE, initial_data_year=START_YEAR - 1, final_data_year=START_YEAR + 2, @@ -761,9 +714,6 @@ def get_pop_objs( infer_pop (bool): =True if want to infer the population pop_dist (array_like): user provided population distribution, dimensions are T0+1 x E+S - pre_pop_dist (array_like): user provided population distribution - for the year before the initial year for calibration, - length E+S country_id (str): country id for UN data initial_data_year (int): initial year of data to use (not relevant if have user provided data) @@ -790,9 +740,12 @@ def get_pop_objs( path, length T + S """ + start_data_year = initial_data_year - 1 # grab data from one year + T = T + 1 # add one period to T to account for period -1 pop + # before initial so have pre-start year population distribution # TODO: this function does not generalize with T. # It assumes one model period is equal to one calendar year in the - # time dimesion (it does adjust for S, however) + # time dimension (it does adjust for S, however) T0 = ( final_data_year - initial_data_year + 1 ) # number of periods until constant fertility and mortality rates @@ -803,8 +756,8 @@ def get_pop_objs( final_data_year, ) assert E + S <= max_age - min_age + 1 - assert initial_data_year >= 2011 and initial_data_year <= 2100 - 1 - assert final_data_year >= 2011 and final_data_year <= 2100 - 1 + assert initial_data_year >= 2012 and initial_data_year <= 2100 - 1 + assert final_data_year >= 2012 and final_data_year <= 2100 - 1 # Ensure that the last year of data used is before SS transition assumed # Really, it will need to be well before this assert final_data_year > initial_data_year @@ -825,7 +778,7 @@ def get_pop_objs( min_age, max_age, country_id, - initial_data_year, + start_data_year, final_data_year, download_path=download_path, ) @@ -854,7 +807,7 @@ def get_pop_objs( min_age, max_age, country_id, - initial_data_year, + start_data_year, final_data_year, download_path=download_path, ) @@ -892,7 +845,7 @@ def get_pop_objs( initial_pop = pop_dist[0, :].reshape(1, pop_dist.shape[-1]) else: initial_pop = None - pop_2D, pre_pop = get_pop( + pop_2D = get_pop( E, S, min_age, @@ -903,40 +856,32 @@ def get_pop_objs( infmort_rates, imm_rates, initial_pop, - pre_pop_dist, country_id, - initial_data_year, + start_data_year, final_data_year, download_path=download_path, ) else: - pop_2D, pre_pop = get_pop( + pop_2D = get_pop( E, S, min_age, max_age, country_id=country_id, - start_year=initial_data_year, + start_year=start_data_year, end_year=final_data_year, download_path=download_path, ) else: # Check first dims of pop_dist as input by user - print("T0 = ", T0) assert pop_dist.shape[0] == T0 + 1 # population needs to be # one year longer in order to find immigration rates assert pop_dist.shape[-1] == E + S - # Check that pre_pop specified - assert pre_pop_dist is not None - assert pre_pop_dist.shape[0] == pop_dist.shape[1] - pre_pop = pre_pop_dist # Create 2D array of population distribution pop_2D = np.zeros((T0 + 1, E + S)) for t in range(T0 + 1): pop_EpS = pop_rebin(pop_dist[t, :], E + S) pop_2D[t, :] = pop_EpS - # Get percentage distribution for S periods for pre-TP period - pre_pop_EpS = pop_rebin(pre_pop, E + S) # Get immigration rates if not provided if imm_rates is None: imm_rates_orig = get_imm_rates( @@ -948,7 +893,7 @@ def get_pop_objs( infmort_rates, pop_2D, country_id, - initial_data_year, + start_data_year, final_data_year, download_path=download_path, ) @@ -972,26 +917,13 @@ def get_pop_objs( ) # If the population distribution was given, check it for consistency # with the fertility, mortality, and immigration rates - # if pop_dist is not None and not infer_pop: - # len_pop_dist = pop_dist.shape[0] - # pop_counter_2D = np.zeros((len_pop_dist, E + S)) len_pop_dist = pop_2D.shape[0] pop_counter_2D = np.zeros((len_pop_dist, E + S)) # set initial population distribution in the counterfactual to # the first year of the user provided distribution - # pop_counter_2D[0, :] = pop_dist[0, :] pop_counter_2D[0, :] = pop_2D[0, :] for t in range(1, len_pop_dist): # find newborns next period - # newborns = np.dot(fert_rates[t - 1, :], pop_counter_2D[t - 1, :]) - - # pop_counter_2D[t, 0] = ( - # 1 - infmort_rates[t - 1] - # ) * newborns + imm_rates[t - 1, 0] * pop_counter_2D[t - 1, 0] - # pop_counter_2D[t, 1:] = ( - # pop_counter_2D[t - 1, :-1] * (1 - mort_rates[t - 1, :-1]) - # + pop_counter_2D[t - 1, 1:] * imm_rates_orig[t - 1, 1:] - # ) newborns = np.dot(fert_rates[t - 1, :], pop_counter_2D[t - 1, :]) pop_counter_2D[t, 0] = ( @@ -1002,99 +934,8 @@ def get_pop_objs( + pop_counter_2D[t - 1, 1:] * imm_rates_orig[t - 1, 1:] ) # Check that counterfactual pop dist is close to pop dist given - # assert np.allclose(pop_counter_2D, pop_dist) assert np.allclose(pop_counter_2D, pop_2D) - # """" - # CHANGE - in OG-Core, we are implicitly assuming pre-TP rates of - # mortality, - # fertility, and immigration are the same as the period 0 rates. - - # So let's just infer the pre-pop_dist from those. - # """ - # pop1 = pop_2D[0, :] - # fert0 = fert_rates[0, :] - # mort0 = mort_rates[0, :] - # infmort0 = infmort_rates[0] - # imm0 = imm_rates_orig[0, :] - # pre_pop_guess = pop1.copy() - - # # I can't solve this analytically, so set up a system of equation - # # to solve - # def pre_pop_solve(pre_pop_guess, pop1, fert0, mort0, infmort0, imm0): - # pre_pop = pre_pop_guess - # errors = np.zeros(E + S) - # errors[0] = pop1[0] - ( - # (1 - infmort0) * (fert0 * pre_pop).sum() + imm0[0] * pre_pop[0] - # ) - # errors[1:] = pop1[1:] - ( - # pre_pop[:-1] * (1 - mort0[:-1]) + pre_pop[1:] * imm0[1:] - # ) - # # print("Max error = ", np.abs(errors).max()) - # return errors - - # opt_res = opt.root( - # pre_pop_solve, - # pre_pop_guess, - # args=(pop1, fert0, mort0, infmort0, imm0), - # method="lm", - # ) - # pre_pop = opt_res.x - # print( - # "Success? ", - # opt_res.success, - # ", Max diff = ", - # np.abs(opt_res.fun).max(), - # ) - # pre_pop_EpS = pop_rebin(pre_pop, E + S) - - # # Check result - # initial_pop_counter = np.zeros(E + S) - # newborns = (fert_rates[0, :] * pre_pop[:]).sum() - # initial_pop_counter[0] = ( - # 1 - infmort_rates[0] - # ) * newborns + imm_rates_orig[0, 0] * pre_pop[0] - # initial_pop_counter[1:] = ( - # pre_pop[:-1] * (1 - mort_rates[0, :-1]) - # + pre_pop[1:] * imm_rates_orig[0, 1:] - # ) - # # Test that using pre pop get to pop in period 1 - # print("Max diff = ", np.abs(pop_2D[0, :] - initial_pop_counter).max()) - # # assert np.allclose(initial_pop_counter, pop_2D[0, :]) - - """ - NEW CODE - use the actual UN historical data instead of solving backwards - """ - # Get percentage distribution for S periods for pre-TP period - # Use the actual UN historical data instead of solving backwards - # pre_pop_EpS = pop_rebin(pre_pop, E + S) -- this assignment is - # above on line 924, but keep for clarity - - # Check result - # Verify that the UN pre-period data is reasonably consistent - # with the period 0 population using the demographic transition equations - initial_pop_counter = np.zeros(E + S) - newborns = (fert_rates[0, :] * pre_pop_EpS[:]).sum() - initial_pop_counter[0] = ( - 1 - infmort_rates[0] - ) * newborns + imm_rates_orig[0, 0] * pre_pop_EpS[0] - initial_pop_counter[1:] = ( - pre_pop_EpS[:-1] * (1 - mort_rates[0, :-1]) - + pre_pop_EpS[1:] * imm_rates_orig[0, 1:] - ) - - max_diff = np.abs(pop_2D[0, :] - initial_pop_counter).max() - print("Pre-period population verification: Max diff = ", max_diff) - - if max_diff > 100_000: - print( - "WARNING: Large difference between UN pre-period population " - + "and period 0 population ({:.2f}). ".format(max_diff) - + "This may indicate inconsistencies in the data or " - + "immigration rate calculations, but using UN historical " - + "data as it is more reliable than backward-solved estimates." - ) - # Create the transition matrix for the population distribution # from T0 going forward (i.e., past when we have data on forecasts) OMEGA_orig = np.zeros((E + S, E + S)) @@ -1128,7 +969,8 @@ def get_pop_objs( # steady-state distribution by adjusting immigration rates, holding # constant mortality, fertility, and SS growth rates imm_tol = 1e-14 - fixper = int(1.5 * S + T0) + fixper = int(1.5 * S) + assert fixper > T0 # ensure that we are fixing period after data omega_SSfx = omega_path_lev[fixper, :] / omega_path_lev[fixper, :].sum() imm_objs = ( fert_rates[fixper, :], @@ -1153,15 +995,11 @@ def get_pop_objs( omega_path_S[fixper, :].reshape((1, S)), (T + S - fixper, 1) ) g_n_path = np.zeros(T + S) - g_n_path[1:] = ( + g_n_path[:-1] = ( omega_path_lev[1:, -S:].sum(axis=1) - omega_path_lev[:-1, -S:].sum(axis=1) ) / omega_path_lev[:-1, -S:].sum(axis=1) - g_n_path[0] = ( - omega_path_lev[0, -S:].sum() - pre_pop_EpS[-S:].sum() - ) / pre_pop_EpS[-S:].sum() g_n_path[fixper + 1 :] = g_n_SS - omega_S_preTP = pre_pop_EpS[-S:] / pre_pop_EpS[-S:].sum() imm_rates_mat = np.concatenate( ( imm_rates_orig[:fixper, E:], @@ -1320,13 +1158,16 @@ def get_pop_objs( # Return objects in a dictionary pop_dict = { - "omega": omega_path_S, + "omega": omega_path_S[1:, :], "g_n_ss": g_n_SS, "omega_SS": omega_SSfx[-S:] / omega_SSfx[-S:].sum(), - "rho": mort_rates_S, - "g_n": g_n_path, - "imm_rates": imm_rates_mat, - "omega_S_preTP": omega_S_preTP, + "rho": mort_rates_S[1:, :], + "g_n": g_n_path[1:], + "imm_rates": imm_rates_mat[1:, :], + "omega_S_preTP": omega_path_S[0, :], + "imm_rates_preTP": imm_rates_mat[0, :], + "rho_preTP": mort_rates_S[0, :], + "g_n_preTP": g_n_path[0], } return pop_dict diff --git a/ogcore/fiscal.py b/ogcore/fiscal.py index ae14f4bae..675a89961 100644 --- a/ogcore/fiscal.py +++ b/ogcore/fiscal.py @@ -81,7 +81,7 @@ def D_G_path(r, dg_fixed_values, p): D0_baseline, ) = dg_fixed_values - growth = (1 + p.g_n) * np.exp(p.g_y) + growth = (1 + np.append(p.g_n_preTP, p.g_n[: p.T])) * np.exp(p.g_y) D = np.zeros(p.T + 1) if p.baseline: @@ -194,13 +194,11 @@ def D_G_path(r, dg_fixed_values, p): ) D_d = D[: p.T] - D_f[: p.T] new_borrowing = ( - D[1 : p.T + 1] * np.exp(p.g_y) * (1 + p.g_n[1 : p.T + 1]) - - D[: p.T] + D[1 : p.T + 1] * np.exp(p.g_y) * (1 + p.g_n[: p.T]) - D[: p.T] ) debt_service = r_gov[: p.T] * D[: p.T] new_borrowing_f = ( - D_f[1 : p.T + 1] * np.exp(p.g_y) * (1 + p.g_n[1 : p.T + 1]) - - D_f[: p.T] + D_f[1 : p.T + 1] * np.exp(p.g_y) * (1 + p.g_n[: p.T]) - D_f[: p.T] ) return ( @@ -490,7 +488,7 @@ def get_K_g(K_g0, I_g, p, method): K_g = np.zeros(p.T) K_g[0] = K_g0 for t in range(p.T - 1): # TODO: numba jit this - growth = (1 + p.g_n[t + 1]) * np.exp(p.g_y) + growth = (1 + p.g_n[t]) * np.exp(p.g_y) K_g[t + 1] = ( (1 - p.delta_g) * K_g[t] + (1 - phi_g) * I_g[t] ) / growth diff --git a/ogcore/output_tables.py b/ogcore/output_tables.py index 66ea06cd1..d719caa64 100644 --- a/ogcore/output_tables.py +++ b/ogcore/output_tables.py @@ -1139,7 +1139,11 @@ def model_fit_table( omega_t = params.omega[t] model_val = omega_t[idx_65:].sum() / omega_t.sum() elif target_desc == r"Pop growth rate": - model_val = params.g_n[t] + # g_n[t] is now growth from period t to t+1; the boundary + # growth into period 0 lives in g_n_preTP. Report the growth + # into period t so this stays calendar-aligned with the + # omega[t]-based moments above. + model_val = params.g_n_preTP if t == 0 else params.g_n[t - 1] else: model_val = np.nan diff --git a/ogcore/parameter_plots.py b/ogcore/parameter_plots.py index 5184dead6..6b79db1e8 100644 --- a/ogcore/parameter_plots.py +++ b/ogcore/parameter_plots.py @@ -147,7 +147,13 @@ def plot_pop_growth( year_vec = np.arange(start_year, start_year + num_years_to_plot) start_index = start_year - p.start_year fig, ax = plt.subplots() - plt.plot(year_vec, p.g_n[start_index : start_index + num_years_to_plot]) + # g_n stores the pre-time-path boundary growth separately in + # g_n_preTP; prepend it to recover the year-aligned growth path. + g_n_full = np.append(p.g_n_preTP, p.g_n) + plt.plot( + year_vec, + g_n_full[start_index : start_index + num_years_to_plot], + ) plt.xlabel(r"Year $t$") plt.ylabel(r"Population Growth Rate $g_{n, t}$") ticks_loc = ax.get_yticks().tolist() @@ -500,7 +506,11 @@ def plot_g_n(p_list, label_list=[""], include_title=False, path=None): years = np.arange(p0.start_year, p0.start_year + p0.T) fig, ax = plt.subplots() for i, p in enumerate(p_list): - plt.plot(years, p.g_n[: p.T], label=label_list[i]) + plt.plot( + years, + np.append(p.g_n_preTP, p.g_n[: p.T - 1]), + label=label_list[i], + ) plt.xlabel(r"Year $s$ (model periods)") plt.ylabel(r"Population Growth Rate $g_{n,t}$") if label_list[0] != "": diff --git a/ogcore/parameters.py b/ogcore/parameters.py index 5e09480b4..127cae2ac 100644 --- a/ogcore/parameters.py +++ b/ogcore/parameters.py @@ -341,6 +341,7 @@ def compute_default_params(self): # for constant demographics if self.constant_demographics: self.g_n_ss = 0.0 + self.g_n_preTP = 0.0 self.g_n = np.zeros(self.T + self.S) surv_rate = np.ones_like(self.rho) - self.rho surv_rate1 = np.ones((self.S,)) # prob start at age S @@ -353,6 +354,8 @@ def compute_default_params(self): np.reshape(self.omega_SS, (1, self.S)), (self.T + self.S, 1) ) self.omega_S_preTP = self.omega_SS + self.imm_rates_preTP = np.zeros(self.S) + self.rho_preTP = self.rho[0, :] # Create time series of stationarized UBI transfers self.ubi_nom_array = self.get_ubi_nom_objs() diff --git a/ogcore/utils.py b/ogcore/utils.py index f743a11ca..fbd0c72d8 100644 --- a/ogcore/utils.py +++ b/ogcore/utils.py @@ -1240,7 +1240,8 @@ def unstationarize_vars( """ # compute non-stationary variables T = params.T - pop_growth = np.cumprod(1 + params.g_n[:T]) + pop_growth = np.ones(T) + pop_growth[1:] = np.cumprod(1 + params.g_n[: T - 1]) prod_growth = np.exp(params.g_y * np.arange(params.T)) if ("_m" in var) or ("_i" in var): pop_growth = pop_growth.reshape(T, 1) diff --git a/pyproject.toml b/pyproject.toml index 0d4a6a800..58c2c3b3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "ogcore" -version = "0.16.2" +version = "0.16.3" authors = [ {name = "Jason DeBacker and Richard W. Evans"}, ] diff --git a/tests/test_aggregates.py b/tests/test_aggregates.py index 9b6dd494e..39177cd8d 100644 --- a/tests/test_aggregates.py +++ b/tests/test_aggregates.py @@ -145,8 +145,8 @@ def test_get_L_J1_regression(): ) .sum(1) .sum(1) -) / (1 + np.squeeze(np.hstack((p.g_n[1 : p.T], p.g_n_ss)))) -aggI_TPI = (1 + np.squeeze(np.hstack((p.g_n[1 : p.T], p.g_n_ss)))) * np.exp( +) / (1 + np.squeeze(np.hstack((p.g_n[: p.T - 1], p.g_n_ss)))) +aggI_TPI = (1 + np.squeeze(np.hstack((p.g_n[: p.T - 1], p.g_n_ss)))) * np.exp( p.g_y ) * (K_p1 - part2) - (1.0 - p.delta) * K test_data = [ @@ -156,11 +156,9 @@ def test_get_L_J1_regression(): aggI_total_SS = (1 + p.g_n_ss) * np.exp(p.g_y) * (K[-1]) - (1.0 - p.delta) * K[ -1 ] -aggI_total_TPI = ( - (1 + np.squeeze(np.hstack((p.g_n[1 : p.T], p.g_n_ss)))) - * np.exp(p.g_y) - * K_p1 -) - (1.0 - p.delta) * K +aggI_total_TPI = ((1 + p.g_n[: p.T]) * np.exp(p.g_y) * K_p1) - ( + 1.0 - p.delta +) * K test_data = [ (b_splus1[-1, :, :], K_p1[-1], K[-1], p, "SS", aggI_SS), (b_splus1, K_p1, K, p, "TPI", aggI_TPI), @@ -202,6 +200,10 @@ def test_get_I(b_splus1, K_p1, K, p, method, expected): "omega": np.ones((160, 40)) / 40, "omega_SS": np.ones(40) / 40, "imm_rates": np.zeros((160, 40)), + "omega_S_preTP": np.ones(40) / 40, + "imm_rates_preTP": np.zeros(40), + "rho_preTP": rho_vec[0, :], + "g_n_preTP": 0.01, } # update parameters instance with new values for test p.update_specifications(new_param_values) @@ -222,9 +224,9 @@ def test_get_I(b_splus1, K_p1, K, p, method, expected): ) expected1 = B_test[-1, :, :].sum() / (1.0 + p.g_n_ss) expected2 = B_test.sum(1).sum(1) / ( - 1.0 + np.hstack((p.g_n[1 : p.T], p.g_n_ss)) + 1.0 + np.hstack((p.g_n[: p.T - 1], p.g_n_ss)) ) -expected3 = B_test[0, :, :].sum() / (1.0 + p.g_n[0]) +expected3 = B_test[0, :, :].sum() / (1.0 + p.g_n_preTP) test_data = [ (b[-1, :, :], p, "SS", False, expected1), (b, p, "TPI", False, expected2), @@ -263,6 +265,10 @@ def test_get_B(b, p, method, PreTP, expected): "omega": np.ones((160, 40)) / 40, "omega_SS": np.ones(40) / 40, "imm_rates": np.zeros((160, 40)), + "omega_S_preTP": np.ones(40) / 40, + "imm_rates_preTP": np.zeros(40), + "rho_preTP": rho_vec[0, :], + "g_n_preTP": 0.01, } # update parameters instance with new values for test p.update_specifications(new_param_values) @@ -274,7 +280,8 @@ def test_get_B(b, p, method, PreTP, expected): BQ_presum = (b_splus1 * np.squeeze(p.lambdas)) * np.tile( np.reshape(p.rho[0, :] * pop, (p.T, p.S, 1)), (1, 1, p.J) ) -growth_adj = (1.0 + r) / (1.0 + p.g_n[: p.T]) +growth_adj = (1.0 + r) / (1.0 + np.append(p.g_n_preTP, p.g_n[: p.T - 1])) +growth_adj_preTP = (1.0 + r[0]) / (1.0 + p.g_n_preTP) expected1 = BQ_presum[-1, :, :].sum(0) * growth_adj[-1] expected2 = BQ_presum[-1, :, 1].sum(0) * growth_adj[-1] @@ -282,8 +289,8 @@ def test_get_B(b, p, method, PreTP, expected): np.reshape(growth_adj, (p.T, 1)), (1, p.J) ) expected4 = BQ_presum[:, :, 1].sum(1) * growth_adj -expected5 = BQ_presum[0, :, :].sum(0) * growth_adj[0] -expected6 = BQ_presum[0, :, 1].sum(0) * growth_adj[0] +expected5 = BQ_presum[0, :, :].sum(0) * growth_adj_preTP +expected6 = BQ_presum[0, :, 1].sum(0) * growth_adj_preTP p2 = copy.deepcopy(p) p2.use_zeta = True @@ -1150,6 +1157,29 @@ def test_get_BQ(r, b_splus1, j, p, method, PreTP, expected): 0.03125, ] ) + + +def expected_RM_path(Y, p): + RM = np.zeros_like(Y) + RM[0] = p.alpha_RM_1 * Y[0] + for t in range(1, p.tG1): + RM[t] = ((1 + p.g_RM[t]) / (np.exp(p.g_y) * (1 + p.g_n[t - 1]))) * RM[ + t - 1 + ] + rho_vec = np.linspace(0, 1, p.tG2 - p.tG1) + for t in range(p.tG1, p.tG2 - 1): + RM[t] = ( + rho_vec[t - p.tG1] * p.alpha_RM_T * Y[t] + + (1 - rho_vec[t - p.tG1]) + * ((1 + p.g_RM[t]) / (np.exp(p.g_y) * (1 + p.g_n[t - 1]))) + * RM[t - 1] + ) + RM[p.tG2 - 1 :] = p.alpha_RM_T * Y[p.tG2 - 1 :] + return RM + + +expected_RM_2 = expected_RM_path(Y_RM_2, p_RM_1) +expected_RM_3 = expected_RM_path(Y_RM_2, p_RM_3) test_data_RM = [ (Y_RM_1, p_RM_1, "SS", expected_RM_1), (Y_RM_2, p_RM_1, "TPI", expected_RM_2), diff --git a/tests/test_demographics.py b/tests/test_demographics.py index 6e821d7b4..925642ce4 100644 --- a/tests/test_demographics.py +++ b/tests/test_demographics.py @@ -23,10 +23,6 @@ pop_dist = np.loadtxt( os.path.join(data_dir, "population_distribution.csv"), delimiter="," ) -pre_pop_dist = np.loadtxt( - os.path.join(data_dir, "pre_period_population_distribution.csv"), - delimiter=",", -) @pytest.mark.local @@ -76,7 +72,6 @@ def test_get_pop_objs(): imm_rates=imm_rates, infer_pop=True, pop_dist=pop_dist[0, :].reshape(1, E + S), - pre_pop_dist=pre_pop_dist, initial_data_year=start_year - 1, final_data_year=start_year, GraphDiag=False, @@ -106,7 +101,6 @@ def test_pop_smooth(): imm_rates=imm_rates, infer_pop=True, pop_dist=pop_dist[0, :].reshape(1, E + S), - pre_pop_dist=pre_pop_dist, initial_data_year=start_year - 1, final_data_year=start_year, country_id="840", @@ -154,7 +148,6 @@ def test_pop_growth_smooth(): imm_rates=imm_rates, infer_pop=True, pop_dist=pop_dist[0, :].reshape(1, E + S), - pre_pop_dist=pre_pop_dist, initial_data_year=start_year - 1, final_data_year=start_year, country_id="840", @@ -395,7 +388,6 @@ def test_custom_series_fail(): "47", start_year=start_year - 1, end_year=start_year - 1 ) pop = df[(df.age < 100) & (df.age >= 0)].value.values - pre_pop_dist = demographics.pop_rebin(pop, E + S) pop_dict = demographics.get_pop_objs( E, S, @@ -407,7 +399,6 @@ def test_custom_series_fail(): infmort_rates=infmort_rates, imm_rates=imm_rates, pop_dist=pop_dist, - pre_pop_dist=pre_pop_dist, initial_data_year=start_year, final_data_year=start_year + 1, GraphDiag=False, @@ -437,7 +428,6 @@ def test_SS_dist(): imm_rates=imm_rates, infer_pop=True, pop_dist=pop_dist[0, :].reshape(1, E + S), - pre_pop_dist=pre_pop_dist, initial_data_year=start_year - 1, final_data_year=start_year, GraphDiag=False, @@ -470,7 +460,6 @@ def test_time_path_length(): imm_rates=imm_rates, infer_pop=True, pop_dist=pop_dist[0, :].reshape(1, E + S), - pre_pop_dist=pre_pop_dist, initial_data_year=start_year - 1, final_data_year=start_year, GraphDiag=False, @@ -480,9 +469,10 @@ def test_time_path_length(): assert pop_dict["g_n"].shape[0] == T + S assert pop_dict["imm_rates"].shape[0] == T + S assert pop_dict["rho"].shape[0] == T + S + assert np.isscalar(pop_dict["g_n_preTP"]) -# test of get pop when infer population, but don't pass initial pop or pre_pop +# test of get pop when infer population, but don't pass initial pop @pytest.mark.local def test_infer_pop_nones(): """ @@ -533,7 +523,6 @@ def test_infer_pop_nones(): imm_rates=imm_rates, infer_pop=True, pop_dist=None, - pre_pop_dist=None, initial_data_year=start_year, final_data_year=start_year + 1, GraphDiag=False, @@ -580,29 +569,36 @@ def test_data_download(tmpdir): pop_dist = np.loadtxt( os.path.join(tmpdir, "population_distribution.csv"), delimiter="," ) - pre_pop_dist = np.loadtxt( - os.path.join(tmpdir, "pre_period_population_distribution.csv"), - delimiter=",", - ) pop_dict2 = demographics.get_pop_objs( E, S, T, 0, 99, - fert_rates=fert_rates, - mort_rates=mort_rates, - infmort_rates=infmort_rates, - imm_rates=imm_rates, + fert_rates=fert_rates[:, :], + mort_rates=mort_rates[:, :], + infmort_rates=infmort_rates[:], + imm_rates=imm_rates[:, :], infer_pop=True, pop_dist=pop_dist[0, :].reshape(1, E + S), - pre_pop_dist=pre_pop_dist, initial_data_year=start_year, - final_data_year=start_year + 1, + final_data_year=start_year + 2, GraphDiag=False, ) # Assert that the two pop_dicts are the same for key in pop_dict: print(key) - assert np.allclose(pop_dict[key], pop_dict2[key]) + print("Diff =", np.abs(pop_dict[key] - pop_dict2[key]).max()) + if key == "imm_rates": + # print the max diff for each T + for t in range(pop_dict[key].shape[0]): + print( + "Max diff for imm_rates at T = ", + t, + " is ", + np.abs(pop_dict[key][t, :] - pop_dict2[key][t, :]).max(), + ) + for key in pop_dict: + print(key) + assert np.allclose(pop_dict[key], pop_dict2[key], atol=7e-5) diff --git a/tests/test_firm.py b/tests/test_firm.py index 4d7bc06c2..eeb376756 100644 --- a/tests/test_firm.py +++ b/tests/test_firm.py @@ -1013,7 +1013,8 @@ def test_solve_L(Y, K, Kg, p, method, expected): p3 = Specifications() p3.psi = 4.0 p3.g_n_ss = 0.0 -p3.g_n = np.array([-0.01, 0.02, 0.03, 0.0]) +p3.g_n = np.array([0.02, 0.03, 0.0]) +p3.g_n_preTP = -0.01 p3.T = 3 p3.g_y = 0.04 p3.delta = 0.05 diff --git a/tests/test_utils.py b/tests/test_utils.py index a5e4efd26..2b301c72d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -920,9 +920,11 @@ def test_shift_bio_clock(start_period, end_period, total_effect, expected): p2.g_n = np.ones(p2.T + p2.S) * 0.01 p2.g_y = 0.04 g_y_discount = np.exp(np.arange(p2.T) * (p2.g_y - p1.g_y)) -g_n_discount = np.cumprod(1 + (p2.g_n[: p2.T])) / np.cumprod( - 1 + p1.g_n[: p1.T] -) +pop_growth1 = np.ones(p1.T) +pop_growth1[1:] = np.cumprod(1 + p1.g_n[: p1.T - 1]) +pop_growth2 = np.ones(p2.T) +pop_growth2[1:] = np.cumprod(1 + p2.g_n[: p2.T - 1]) +g_n_discount = pop_growth2 / pop_growth1 expected_pct_change2 = { "K": (np.ones(p2.T) * (1.2 * g_y_discount * g_n_discount)) - 1, "Y": (np.ones(p2.T) * (1.2 * g_y_discount * g_n_discount)) - 1, diff --git a/tests/testing_params.json b/tests/testing_params.json index 2c6862d65..5f293c6e0 100644 --- a/tests/testing_params.json +++ b/tests/testing_params.json @@ -1168,46 +1168,46 @@ 0.05940869, 0.06896693, 0.08087685, 0.09692589, 0.11366492, 0.13429498, 0.16117335, 0.1886646 , 0.22230383, 0.26433221, 0.30426546, 0.35003558, 0.39994367, 0.43838896, 1.0]], -"g_n": [7.96404268e-03, 8.40062030e-03, 9.29197104e-03, 7.46734317e-03, - 5.76003535e-03, 4.47065743e-03, 3.58911639e-03, 3.24296433e-03, - 3.23553123e-03, 2.07757478e-03, 2.05620669e-03, 1.98933891e-03, - 2.02163433e-03, 1.05224777e-03, 8.37962006e-04, 8.01344391e-04, - 7.13869338e-04, 8.19051360e-04, 1.47644429e-04, -5.67560437e-04, - 1.22799059e-04, 8.11427764e-05, -1.17797415e-05, -1.47116590e-05, - -8.87362507e-05, -3.01032572e-04, -4.58447385e-04, -5.90615831e-04, - -7.60610068e-04, -8.63833108e-04, -1.05182101e-03, -1.24726610e-03, - -1.35236886e-03, -1.47194932e-03, -1.62805514e-03, -1.71416777e-03, - -1.80751327e-03, -1.85233291e-03, -1.84358101e-03, -1.85461596e-03, - -1.86045006e-03, -1.84619020e-03, -1.81564459e-03, -1.78759341e-03, - -1.77711043e-03, -1.75910570e-03, -1.77948840e-03, -1.79606651e-03, - -1.80383894e-03, -1.80930431e-03, -1.81107370e-03, -1.81343583e-03, - -1.82382018e-03, -1.80418309e-03, -1.79906201e-03, -1.80607292e-03, - -1.80414674e-03, -1.80483416e-03, -1.79972436e-03, -1.79245889e-03, - -1.80412651e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, - -1.80300324e-03, -1.80300324e-03, -1.80300324e-03, -1.80300324e-03], +"g_n": [ 8.40062030e-3, 9.29197104e-3, 7.46734317e-3, 5.76003535e-3, + 4.47065743e-3, 3.58911639e-3, 3.24296433e-3, 3.23553123e-3, + 2.07757478e-3, 2.05620669e-3, 1.98933891e-3, 2.02163433e-3, + 1.05224777e-3, 8.37962006e-4, 8.01344391e-4, 7.13869338e-4, + 8.19051360e-4, 1.47644429e-4, -5.67560437e-4, 1.22799059e-4, + 8.11427764e-5, -1.17797415e-5, -1.47116590e-5, -8.87362507e-5, + -3.01032572e-4, -4.58447385e-4, -5.90615831e-4, -7.60610068e-4, + -8.63833108e-4, -1.05182101e-3, -1.24726610e-3, -1.35236886e-3, + -1.47194932e-3, -1.62805514e-3, -1.71416777e-3, -1.80751327e-3, + -1.85233291e-3, -1.84358101e-3, -1.85461596e-3, -1.86045006e-3, + -1.84619020e-3, -1.81564459e-3, -1.78759341e-3, -1.77711043e-3, + -1.75910570e-3, -1.77948840e-3, -1.79606651e-3, -1.80383894e-3, + -1.80930431e-3, -1.81107370e-3, -1.81343583e-3, -1.82382018e-3, + -1.80418309e-3, -1.79906201e-3, -1.80607292e-3, -1.80414674e-3, + -1.80483416e-3, -1.79972436e-3, -1.79245889e-3, -1.80412651e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, + -1.80300324e-3, -1.80300324e-3, -1.80300324e-3, -1.80300324e-3], "imm_rates": [[0.00172906, 0.00116727, -0.00016137, -0.01018377, -0.01893683, -0.00107257 , 0.00197262, 0.01956533, 0.01741252, -0.00494443, -0.00777153, 0.01939821 @@ -2336,5 +2336,22 @@ 0.03104479, 0.02942136, 0.02786169, 0.02681268, 0.02060319, 0.0197469 , 0.01730843, 0.01474155, 0.01285935, 0.01119112, 0.00984811, 0.00801472, 0.00696934, 0.00592803, 0.00454995, - 0.00352386, 0.00256576, 0.00167457, 0.00106337, 0.00061474] + 0.00352386, 0.00256576, 0.00167457, 0.00106337, 0.00061474], +"rho_preTP": [0.0025781 , 0.00268902, 0.00282206, 0.00303204, 0.00333702, + 0.00373181, 0.00435139, 0.00521627, 0.00608546, 0.00715621, + 0.0084698 , 0.00975143, 0.01134659, 0.01332463, 0.01493943, + 0.01647184, 0.0181378 , 0.01991245, 0.02238255, 0.02570651, + 0.02896702, 0.03292571, 0.0381694 , 0.04358988, 0.05031253, + 0.05940869, 0.06896693, 0.08087685, 0.09692589, 0.11366492, + 0.13429498, 0.16117335, 0.1886646 , 0.22230383, 0.26433221, + 0.30426546, 0.35003558, 0.39994367, 0.43838896, 1.0], +"imm_rates_preTP": [0.00172906, 0.00116727, -0.00016137, -0.01018377, -0.01893683, -0.00107257 +, 0.00197262, 0.01956533, 0.01741252, -0.00494443, -0.00777153, 0.01939821 +, 0.01978244, 0.00747581, 0.00741143, 0.00150033, -0.00766893, -0.0058054 +, -0.00994736, -0.02296918, -0.00731107, -0.00217819, -0.02644512, -0.04922738 +, -0.01088844, -0.03118354, -0.03035488, -0.00925152, -0.02137357, 0.00121973 +, 0.00414307, -0.00055469, 0.02895412, 0.03014472, 0.00587107, 0.05014318 +, 0.05761331, 0.01828307, 0.08218118, 0.06926356], +"g_n_preTP": 7.96404268e-03 } + diff --git a/uv.lock b/uv.lock index 779152a3d..a70e7fb20 100644 --- a/uv.lock +++ b/uv.lock @@ -1574,7 +1574,7 @@ wheels = [ [[package]] name = "ogcore" -version = "0.16.2" +version = "0.16.3" source = { editable = "." } dependencies = [ { name = "dask" },