Skip to content

Commit

Permalink
specify age range 0 to 99
Browse files Browse the repository at this point in the history
  • Loading branch information
jdebacker committed Jan 31, 2024
1 parent 6bedc91 commit e331ca4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/test_demographics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_get_pop_objs():
start_year = 2019

pop_dict = demographics.get_pop_objs(
E, S, T, 1, 100, start_year - 1, start_year, GraphDiag=False
E, S, T, 0, 99, start_year - 1, start_year, GraphDiag=False
)

assert np.allclose(pop_dict["omega_SS"], pop_dict["omega"][-1, :])
Expand All @@ -32,8 +32,8 @@ def test_pop_smooth():
E,
S,
T,
1,
100,
0,
99,
start_year - 1,
start_year,
country_id="840",
Expand Down Expand Up @@ -73,8 +73,8 @@ def test_pop_growth_smooth():
E,
S,
T,
1,
100,
0,
99,
start_year - 1,
start_year,
country_id="840",
Expand Down Expand Up @@ -105,7 +105,7 @@ def test_imm_smooth():
start_year = 2019
fixper = int(1.5 * S)
pop_dict = demographics.get_pop_objs(
E, S, T, 1, 100, start_year - 1, start_year, GraphDiag=False
E, S, T, 0, 99, start_year - 1, start_year, GraphDiag=False
)
# assert diffs are small
# note that in the "fixper" we impost a jump in immigration rates
Expand All @@ -132,7 +132,7 @@ def test_get_fert():
Test of function to get fertility rates from data
"""
S = 100
fert_rates = demographics.get_fert(S, 0, 100, graph=False)
fert_rates = demographics.get_fert(S, 0, 99, graph=False)
assert fert_rates.shape[1] == S


Expand All @@ -141,15 +141,15 @@ def test_get_mort():
Test of function to get mortality rates from data
"""
S = 100
mort_rates, infmort_rate = demographics.get_mort(S, 0, 100, graph=False)
mort_rates, infmort_rate = demographics.get_mort(S, 0, 99, graph=False)
assert mort_rates.shape[1] == S


def test_infant_mort():
"""
Test of function to get mortality rates from data
"""
mort_rates, infmort_rate = demographics.get_mort(100, 0, 100, graph=False)
mort_rates, infmort_rate = demographics.get_mort(100, 0, 99, graph=False)
# check that infant mortality equals rate hardcoded into
# demographics.py
assert infmort_rate == 0.00491958
Expand All @@ -170,7 +170,7 @@ def test_get_imm_rates():
Test of function to solve for immigration rates from population data
"""
S = 100
imm_rates = demographics.get_imm_rates(S, 0, 100)
imm_rates = demographics.get_imm_rates(S, 0, 99)
assert imm_rates.shape[1] == S


Expand All @@ -188,8 +188,8 @@ def test_custom_series():
E,
S,
T,
1,
100,
0,
99,
start_year - 1,
start_year,
GraphDiag=False,
Expand All @@ -210,7 +210,7 @@ def test_SS_dist():
start_year = 2019

pop_dict = demographics.get_pop_objs(
E, S, T, 1, 100, start_year - 1, start_year, GraphDiag=False
E, S, T, 0, 99, start_year - 1, start_year, GraphDiag=False
)
# Assert that S reached by period T
assert np.allclose(pop_dict["omega_SS"], pop_dict["omega"][-S, :])
Expand Down

0 comments on commit e331ca4

Please sign in to comment.