Skip to content

Commit b07d609

Browse files
committed
temp commit
1 parent f6e4a0e commit b07d609

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

ogcore/aggregates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ def get_B(b, p, method, preTP):
134134
part1 = b * np.transpose(p.omega_S_preTP * p.lambdas)
135135
omega_extended = np.append(p.omega_S_preTP[1:], [0.0])
136136
imm_extended = np.append(
137-
p.imm_rates_pre_TP[1:], [0.0]
137+
p.imm_rates_preTP[1:], [0.0]
138138
)
139-
pop_growth_rate = p.g_n_pretP
139+
pop_growth_rate = p.g_n_preTP
140140
else:
141141
part1 = b * np.transpose(p.omega_SS * p.lambdas)
142142
omega_extended = np.append(p.omega_SS[1:], [0.0])

ogcore/default_parameters.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4586,7 +4586,7 @@
45864586
}
45874587
}
45884588
},
4589-
"imm_rates_pre_TP": {
4589+
"imm_rates_preTP": {
45904590
"title": "Immigration rates in period before model start year",
45914591
"description": "Immigration rates in period before model start year.",
45924592
"section_1": "Demographic Parameters",

ogcore/demographics.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ def get_pop(
388388
pre_pop_data = get_un_data(
389389
"47",
390390
country_id=country_id,
391-
start_year=start_year - 1,
392-
end_year=start_year - 1,
391+
start_year=start_year,
392+
end_year=start_year,
393393
)
394394
if download_path:
395395
pre_pop_data.to_csv(
@@ -893,7 +893,7 @@ def get_pop_objs(
893893
initial_pop,
894894
pre_pop_dist,
895895
country_id,
896-
start_data_year,
896+
initial_data_year, # TODO: should this be start_data_year?
897897
final_data_year,
898898
download_path=download_path,
899899
)
@@ -1319,7 +1319,7 @@ def get_pop_objs(
13191319
"omega_S_preTP": omega_path_S[0, :],
13201320
"imm_rates_preTP": imm_rates_mat[0, :],
13211321
"rho_preTP": mort_rates_S[0, :],
1322-
"g_m_preTP": g_n_path[0],
1322+
"g_n_preTP": g_n_path[0],
13231323
}
13241324

13251325
return pop_dict

tests/test_demographics.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,14 +563,17 @@ def test_data_download(tmpdir):
563563
infmort_rates=infmort_rates[1:],
564564
imm_rates=imm_rates[1:, :],
565565
infer_pop=True,
566-
pop_dist=pop_dist[0, :].reshape(1, E + S),
567-
pre_pop_dist=pre_pop_dist,
566+
pop_dist=pop_dist[1, :].reshape(1, E + S),
567+
pre_pop_dist=pop_dist[0, :], # pre_pop_dist,
568568
initial_data_year=start_year,
569569
final_data_year=start_year + 1,
570570
GraphDiag=False,
571571
)
572572

573573
# Assert that the two pop_dicts are the same
574+
for key in pop_dict:
575+
print(key)
576+
print("Diff =", np.abs(pop_dict[key] - pop_dict2[key]).max())
574577
for key in pop_dict:
575578
print(key)
576579
assert np.allclose(pop_dict[key], pop_dict2[key])

0 commit comments

Comments
 (0)