ogeth 0.0.1__tar.gz → 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ogeth-0.0.1/ogeth.egg-info → ogeth-0.0.2}/PKG-INFO +1 -1
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/__init__.py +1 -1
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/constants.py +1 -1
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/income.py +4 -2
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/input_output.py +1 -1
- {ogeth-0.0.1 → ogeth-0.0.2/ogeth.egg-info}/PKG-INFO +1 -1
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth.egg-info/SOURCES.txt +0 -2
- {ogeth-0.0.1 → ogeth-0.0.2}/setup.py +1 -1
- ogeth-0.0.1/tests/test_income.py +0 -99
- ogeth-0.0.1/tests/test_input_output.py +0 -75
- {ogeth-0.0.1 → ogeth-0.0.2}/LICENSE +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/MANIFEST.in +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/README.md +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/calibrate.py +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/data/IFPRI_SAM_ETH_2022_SAM.csv +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/labor.py +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/macro_params.py +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/ogeth_default_parameters.json +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/test_est_chi_n.py +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth/utils.py +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth.egg-info/dependency_links.txt +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth.egg-info/requires.txt +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/ogeth.egg-info/top_level.txt +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/pyproject.toml +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/setup.cfg +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/tests/test_macro_params.py +0 -0
- {ogeth-0.0.1 → ogeth-0.0.2}/tests/test_run_example.py +0 -0
|
@@ -12,7 +12,9 @@ CUR_PATH = os.path.abspath(os.path.dirname(__file__))
|
|
|
12
12
|
OUTPUT_DIR = os.path.join(CUR_PATH, "OUTPUT", "ability")
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
def get_e_interp(
|
|
15
|
+
def get_e_interp(
|
|
16
|
+
E, S, J, lambdas, age_wgts, gini_to_match=31.1, plot_path=None
|
|
17
|
+
):
|
|
16
18
|
"""
|
|
17
19
|
This function takes the calibrated lifetime earnings profiles
|
|
18
20
|
(abilities, e matrix) from OG-USA and then adjusts the shape of those
|
|
@@ -196,4 +198,4 @@ def get_e_interp(E, S, J, lambdas, age_wgts, gini_to_match=31.1, plot_path=None)
|
|
|
196
198
|
**kwargs,
|
|
197
199
|
)
|
|
198
200
|
|
|
199
|
-
return emat_new_scaled
|
|
201
|
+
return emat_new_scaled
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as readme_file:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="ogeth",
|
|
8
|
-
version="0.0.
|
|
8
|
+
version="0.0.2",
|
|
9
9
|
author="Marcelo LaFleur, Richard W. Evans, and Jason DeBacker",
|
|
10
10
|
license="CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
|
|
11
11
|
description="Ethiopia Calibration for OG-Core",
|
ogeth-0.0.1/tests/test_income.py
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Tests of income.py module
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import pytest
|
|
6
|
-
import numpy as np
|
|
7
|
-
from ogeth import income
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def test_arctan_func():
|
|
11
|
-
"""
|
|
12
|
-
Test of arctan_func()
|
|
13
|
-
"""
|
|
14
|
-
expected_vals = np.array([0.14677821, 0.083305594, 0.057901228])
|
|
15
|
-
xvals = np.array([1, 2, 3])
|
|
16
|
-
a = 1.3
|
|
17
|
-
b = 2.2
|
|
18
|
-
c = 0.5
|
|
19
|
-
test_vals = income.arctan_func(xvals, a, b, c)
|
|
20
|
-
|
|
21
|
-
assert np.allclose(test_vals, expected_vals)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def test_arctan_deriv_func():
|
|
25
|
-
"""
|
|
26
|
-
Test of arctan_deriv_func()
|
|
27
|
-
"""
|
|
28
|
-
expected_vals = np.array([-0.109814991, -0.036400091, -0.017707961])
|
|
29
|
-
xvals = np.array([1, 2, 3])
|
|
30
|
-
a = 1.3
|
|
31
|
-
b = 2.2
|
|
32
|
-
c = 0.5
|
|
33
|
-
test_vals = income.arctan_deriv_func(xvals, a, b, c)
|
|
34
|
-
|
|
35
|
-
assert np.allclose(test_vals, expected_vals)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def test_arc_error():
|
|
39
|
-
"""
|
|
40
|
-
Test of arc_error()
|
|
41
|
-
"""
|
|
42
|
-
expected_vals = np.array([30.19765553, -1.40779391, 14.19212336])
|
|
43
|
-
a = 1.3
|
|
44
|
-
b = 2.2
|
|
45
|
-
c = 0.5
|
|
46
|
-
abc_vals = (a, b, c)
|
|
47
|
-
first_point = 30.2
|
|
48
|
-
coef1 = 0.05995294
|
|
49
|
-
coef2 = -0.00004086
|
|
50
|
-
coef3 = -0.00000521
|
|
51
|
-
abil_deprec = 0.47
|
|
52
|
-
params = (first_point, coef1, coef2, coef3, abil_deprec)
|
|
53
|
-
test_vals = income.arc_error(abc_vals, params)
|
|
54
|
-
|
|
55
|
-
assert np.allclose(test_vals, expected_vals)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
@pytest.mark.local
|
|
59
|
-
def test_arctan_fit():
|
|
60
|
-
"""
|
|
61
|
-
Test arctan_fit() function
|
|
62
|
-
"""
|
|
63
|
-
expected_vals = np.array(
|
|
64
|
-
[
|
|
65
|
-
30.19999399,
|
|
66
|
-
30.19998699,
|
|
67
|
-
30.19997918,
|
|
68
|
-
30.19997039,
|
|
69
|
-
30.19996043,
|
|
70
|
-
30.19994904,
|
|
71
|
-
30.1999359,
|
|
72
|
-
30.19992057,
|
|
73
|
-
30.19990246,
|
|
74
|
-
30.19988072,
|
|
75
|
-
30.19985415,
|
|
76
|
-
30.19982094,
|
|
77
|
-
30.19977824,
|
|
78
|
-
30.19972131,
|
|
79
|
-
30.1996416,
|
|
80
|
-
30.19952204,
|
|
81
|
-
30.19932277,
|
|
82
|
-
30.19892423,
|
|
83
|
-
30.19772859,
|
|
84
|
-
14.19399974,
|
|
85
|
-
]
|
|
86
|
-
)
|
|
87
|
-
a = 1.3
|
|
88
|
-
b = 2.2
|
|
89
|
-
c = 0.5
|
|
90
|
-
init_guesses = (a, b, c)
|
|
91
|
-
first_point = 30.2
|
|
92
|
-
coef1 = 0.05995294
|
|
93
|
-
coef2 = -0.00004086
|
|
94
|
-
coef3 = -0.00000521
|
|
95
|
-
abil_deprec = 0.47
|
|
96
|
-
test_vals = income.arctan_fit(
|
|
97
|
-
first_point, coef1, coef2, coef3, abil_deprec, init_guesses
|
|
98
|
-
)
|
|
99
|
-
assert np.allclose(test_vals, expected_vals)
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Tests of input_output.py module
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import pandas as pd
|
|
6
|
-
import pytest
|
|
7
|
-
from ogeth import input_output as io
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
sam_dict = {
|
|
11
|
-
# "index": ["Beer", "Chocolate", "Car", "House"],
|
|
12
|
-
"Ag": [30, 160, 0, 5],
|
|
13
|
-
"Mining": [10, 0, 100, 100],
|
|
14
|
-
"Manufacturing": [60, 40, 200, 295],
|
|
15
|
-
"total": [100, 200, 300, 400],
|
|
16
|
-
"row": [10, 20, 30, 40],
|
|
17
|
-
}
|
|
18
|
-
sam_df = pd.DataFrame(sam_dict, index=["Beer", "Chocolate", "Car", "House"])
|
|
19
|
-
|
|
20
|
-
cons_dict = {"Food": ["Beer", "Chocolate"], "Non-food": ["Car", "House"]}
|
|
21
|
-
|
|
22
|
-
prod_dict = {
|
|
23
|
-
"Primary": ["Ag", "Mining"],
|
|
24
|
-
"Secondary": ["Manufacturing"],
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_read_sam():
|
|
29
|
-
"""
|
|
30
|
-
Test of read_SAM() function
|
|
31
|
-
"""
|
|
32
|
-
test_df = io.read_SAM()
|
|
33
|
-
|
|
34
|
-
assert isinstance(test_df, pd.DataFrame)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
@pytest.mark.parametrize(
|
|
38
|
-
"sam_df, cons_dict",
|
|
39
|
-
[
|
|
40
|
-
(sam_df, cons_dict),
|
|
41
|
-
],
|
|
42
|
-
ids=["Test 1"],
|
|
43
|
-
)
|
|
44
|
-
def test_get_alpha_c(sam_df, cons_dict):
|
|
45
|
-
"""
|
|
46
|
-
Test of get_alpha_c() function
|
|
47
|
-
"""
|
|
48
|
-
test_dict = io.get_alpha_c(sam=sam_df, cons_dict=cons_dict)
|
|
49
|
-
|
|
50
|
-
assert isinstance(test_dict, dict)
|
|
51
|
-
assert list(test_dict.keys()).sort() == ["Food", "Non-food"].sort()
|
|
52
|
-
assert test_dict["Food"] == 270 / 900
|
|
53
|
-
assert test_dict["Non-food"] == 630 / 900
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@pytest.mark.parametrize(
|
|
57
|
-
"sam_df, cons_dict, prod_dict",
|
|
58
|
-
[
|
|
59
|
-
(sam_df, cons_dict, prod_dict),
|
|
60
|
-
],
|
|
61
|
-
ids=["Test 1"],
|
|
62
|
-
)
|
|
63
|
-
def test_get_io_matrix(sam_df, cons_dict, prod_dict):
|
|
64
|
-
"""
|
|
65
|
-
Test of get_io_matrix()
|
|
66
|
-
"""
|
|
67
|
-
test_df = io.get_io_matrix(
|
|
68
|
-
sam=sam_df, cons_dict=cons_dict, prod_dict=prod_dict
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
assert isinstance(test_df, pd.DataFrame)
|
|
72
|
-
assert list(test_df.columns).sort() == ["Primary", "Secondary"].sort()
|
|
73
|
-
assert list(test_df.index).sort() == ["Food", "Non-food"].sort()
|
|
74
|
-
assert test_df.loc["Food", "Primary"] == 2 / 3
|
|
75
|
-
assert test_df.loc["Food", "Secondary"] == 1 / 3
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|