@@ -1046,7 +1046,6 @@ def get_pop_objs(
10461046 # print("Max diff = ", np.abs(pop_2D[0, :] - initial_pop_counter).max())
10471047 # # assert np.allclose(initial_pop_counter, pop_2D[0, :])
10481048
1049-
10501049 """
10511050 NEW CODE - use the actual UN historical data instead of solving backwards
10521051 """
@@ -1061,26 +1060,23 @@ def get_pop_objs(
10611060 initial_pop_counter = np .zeros (E + S )
10621061 newborns = (fert_rates [0 , :] * pre_pop_EpS [:]).sum ()
10631062 initial_pop_counter [0 ] = (
1064- 1 - infmort_rates [0 ]
1063+ 1 - infmort_rates [0 ]
10651064 ) * newborns + imm_rates_orig [0 , 0 ] * pre_pop_EpS [0 ]
10661065 initial_pop_counter [1 :] = (
1067- pre_pop_EpS [:- 1 ] * (1 - mort_rates [0 , :- 1 ])
1068- + pre_pop_EpS [1 :] * imm_rates_orig [0 , 1 :]
1066+ pre_pop_EpS [:- 1 ] * (1 - mort_rates [0 , :- 1 ])
1067+ + pre_pop_EpS [1 :] * imm_rates_orig [0 , 1 :]
10691068 )
10701069
10711070 max_diff = np .abs (pop_2D [0 , :] - initial_pop_counter ).max ()
1072- print (
1073- "Pre-period population verification: Max diff = " ,
1074- max_diff
1075- )
1071+ print ("Pre-period population verification: Max diff = " , max_diff )
10761072
10771073 if max_diff > 100_000 :
10781074 print (
1079- "WARNING: Large difference between UN pre-period population "
1080- + "and period 0 population ({:.2f}). " .format (max_diff )
1081- + "This may indicate inconsistencies in the data or "
1082- + "immigration rate calculations, but using UN historical "
1083- + "data as it is more reliable than backward-solved estimates."
1075+ "WARNING: Large difference between UN pre-period population "
1076+ + "and period 0 population ({:.2f}). " .format (max_diff )
1077+ + "This may indicate inconsistencies in the data or "
1078+ + "immigration rate calculations, but using UN historical "
1079+ + "data as it is more reliable than backward-solved estimates."
10841080 )
10851081
10861082 # Create the transition matrix for the population distribution
0 commit comments