@@ -42,6 +42,7 @@ def test_get_pop_objs_read_UN_data():
4242 T ,
4343 0 ,
4444 99 ,
45+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
4546 initial_data_year = start_year - 1 ,
4647 final_data_year = start_year ,
4748 GraphDiag = False ,
@@ -71,13 +72,17 @@ def test_get_pop_objs():
7172 infmort_rates = infmort_rates ,
7273 imm_rates = imm_rates ,
7374 infer_pop = True ,
75+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
7476 pop_dist = pop_dist [0 , :].reshape (1 , E + S ),
7577 initial_data_year = start_year - 1 ,
7678 final_data_year = start_year ,
7779 GraphDiag = False ,
7880 )
79-
80- assert np .allclose (pop_dict ["omega_SS" ], pop_dict ["omega" ][- 1 , :])
81+ print ("Omega_SS shape:" , pop_dict ["omega_SS" ].shape )
82+ print ("Omega last period shape:" , pop_dict ["omega" ][- 1 , :, :].shape )
83+ print ("Some values from Omega_SS:" , pop_dict ["omega_SS" ][:5 , :5 ])
84+ print ("Some values from Omega last period:" , pop_dict ["omega" ][- 1 , :5 , :5 ])
85+ assert np .allclose (pop_dict ["omega_SS" ], pop_dict ["omega" ][- 1 , :, :])
8186
8287
8388def test_pop_smooth ():
@@ -100,6 +105,7 @@ def test_pop_smooth():
100105 infmort_rates = infmort_rates ,
101106 imm_rates = imm_rates ,
102107 infer_pop = True ,
108+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
103109 pop_dist = pop_dist [0 , :].reshape (1 , E + S ),
104110 initial_data_year = start_year - 1 ,
105111 final_data_year = start_year ,
@@ -147,6 +153,7 @@ def test_pop_growth_smooth():
147153 infmort_rates = infmort_rates ,
148154 imm_rates = imm_rates ,
149155 infer_pop = True ,
156+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
150157 pop_dist = pop_dist [0 , :].reshape (1 , E + S ),
151158 initial_data_year = start_year - 1 ,
152159 final_data_year = start_year ,
@@ -187,6 +194,7 @@ def test_imm_smooth():
187194 99 ,
188195 initial_data_year = start_year - 1 ,
189196 final_data_year = start_year ,
197+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
190198 GraphDiag = False ,
191199 )
192200 # assert diffs are small
@@ -338,13 +346,14 @@ def test_custom_series():
338346 T ,
339347 0 ,
340348 99 ,
349+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
341350 initial_data_year = start_year ,
342351 final_data_year = start_year + 1 ,
343352 GraphDiag = False ,
344353 imm_rates = imm_rates ,
345354 infer_pop = True ,
346355 )
347- assert np .allclose (pop_dict ["imm_rates" ][0 , :], imm_rates [0 , E :])
356+ assert np .allclose (pop_dict ["imm_rates" ][0 , :, 0 ], imm_rates [0 , E :])
348357
349358
350359def test_custom_series_fail ():
@@ -398,6 +407,7 @@ def test_custom_series_fail():
398407 mort_rates = mort_rates ,
399408 infmort_rates = infmort_rates ,
400409 imm_rates = imm_rates ,
410+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
401411 pop_dist = pop_dist ,
402412 initial_data_year = start_year ,
403413 final_data_year = start_year + 1 ,
@@ -428,6 +438,7 @@ def test_SS_dist():
428438 imm_rates = imm_rates ,
429439 infer_pop = True ,
430440 pop_dist = pop_dist [0 , :].reshape (1 , E + S ),
441+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
431442 initial_data_year = start_year - 1 ,
432443 final_data_year = start_year ,
433444 GraphDiag = False ,
@@ -459,6 +470,7 @@ def test_time_path_length():
459470 infmort_rates = infmort_rates ,
460471 imm_rates = imm_rates ,
461472 infer_pop = True ,
473+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
462474 pop_dist = pop_dist [0 , :].reshape (1 , E + S ),
463475 initial_data_year = start_year - 1 ,
464476 final_data_year = start_year ,
@@ -521,6 +533,7 @@ def test_infer_pop_nones():
521533 mort_rates = mort_rates ,
522534 infmort_rates = infmort_rates ,
523535 imm_rates = imm_rates ,
536+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
524537 infer_pop = True ,
525538 pop_dist = None ,
526539 initial_data_year = start_year ,
@@ -548,12 +561,13 @@ def test_data_download(tmpdir):
548561 T ,
549562 0 ,
550563 99 ,
564+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
551565 initial_data_year = start_year ,
552566 final_data_year = start_year + 1 ,
553567 download_path = tmpdir ,
554568 )
555569
556- # No read in each file and call get_pop_objs again with the data
570+ # Now read in each file and call get_pop_objs again with the data
557571 fert_rates = np .loadtxt (
558572 os .path .join (tmpdir , "fert_rates.csv" ), delimiter = ","
559573 )
@@ -580,6 +594,7 @@ def test_data_download(tmpdir):
580594 infmort_rates = infmort_rates [:],
581595 imm_rates = imm_rates [:, :],
582596 infer_pop = True ,
597+ income_percentiles = [0.25 , 0.25 , 0.2 , 0.2 , 0.05 , 0.04 , 0.01 ],
583598 pop_dist = pop_dist [0 , :].reshape (1 , E + S ),
584599 initial_data_year = start_year ,
585600 final_data_year = start_year + 2 ,
0 commit comments