Skip to content

Commit 007e598

Browse files
authored
Merge pull request PSLmodels#386 from hdoupe/update-build
Update for version 0.5.+ conda builds
2 parents 4c56f47 + 2619699 commit 007e598

File tree

8 files changed

+214
-297
lines changed

8 files changed

+214
-297
lines changed

conda.recipe/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
BLD_DIR=`pwd`
44

55
# Recipe and source are stored together
6-
SRC_DIR=$RECIPE_DIR/../../
6+
SRC_DIR=$RECIPE_DIR/../
77
pushd $SRC_DIR
88

99
$PYTHON setup.py install

conda.recipe/meta.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package:
22
name: ogusa
3-
version: 0.4
3+
version: 0.5.10
44

55
requirements:
66
build:
7+
- python
8+
- pip
79
- matplotlib
810
- numpy >=1.12.1
911
- pandas >=0.20.1
10-
- pytest
11-
- python
1212
- scipy
1313
- setuptools
1414
- taxcalc
@@ -22,6 +22,7 @@ requirements:
2222
- scipy
2323
- setuptools
2424
- taxcalc
25+
- dask
2526

2627
about:
2728
home: https://github.com/open-source-economics/OG-USA/
@@ -33,7 +34,6 @@ test:
3334
- ogusa.TPI
3435
- ogusa.calibrate
3536
- ogusa.demographics
36-
- ogusa.demographics_old
3737
- ogusa.elliptical_u_est
3838
- ogusa.firm
3939
- ogusa.fiscal
@@ -48,4 +48,3 @@ test:
4848
- ogusa.utils
4949
- ogusa.wealth
5050
- ogusa.wealthinit
51-

ogusa/TPI_graphs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
Packages
2020
------------------------------------------------------------------------
2121
'''
22+
import os
23+
import pickle
2224

2325
import numpy as np
2426
import matplotlib
2527
import matplotlib.pyplot as plt
2628
from mpl_toolkits.mplot3d import Axes3D
27-
import cPickle as pickle
29+
# import cPickle as pickle
2830

2931
import firm
3032

@@ -450,7 +452,7 @@ def gini_nocol(path, omega):
450452
cum_levels[:, 1:] = cum_levels[:, :-1]
451453
cum_levels[:, 0] = 0
452454
G = 2 * (.5 - (cum_levels * omega_sorted).sum(1))
453-
print G[-1]
455+
print(G[-1])
454456
return G
455457

456458
'''
@@ -728,7 +730,7 @@ def gini_nocol(path, omega):
728730
X, Y = np.meshgrid(domain, Jgrid)
729731

730732

731-
print 'Starting movies'
733+
print('Starting movies')
732734
# top zlim is for the income tax, bottom zlim is for the wealth tax
733735

734736

ogusa/get_micro_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323
import dask.multiprocessing
2424
import numpy as np
2525
import pickle
26-
from ogusa.utils import DEFAULT_START_YEAR, TC_LAST_YEAR
27-
from ogusa.utils import RECORDS_START_YEAR
26+
from ogusa.utils import DEFAULT_START_YEAR, TC_LAST_YEAR, PUF_START_YEAR
2827

2928

3029
def get_calculator(baseline, calculator_start_year, reform=None,
3130
data=None, weights=None,
32-
records_start_year=RECORDS_START_YEAR):
31+
records_start_year=PUF_START_YEAR):
3332
'''
3433
--------------------------------------------------------------------
3534
This function creates the tax calculator object for the microsim
@@ -41,7 +40,8 @@ def get_calculator(baseline, calculator_start_year, reform=None,
4140
data = DataFrame for Records object
4241
weights = weights DataFrame for Records object
4342
records_start_year = the start year for the data and weights
44-
dfs
43+
dfs (default is set to the PUF start year
44+
as defined in the Tax-Calculator project)
4545
4646
RETURNS: Calculator object with a current_year equal to
4747
calculator_start_year

ogusa/tests/test_basic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pickle
55
import numpy as np
66
import pandas as pd
7-
from ogusa.utils import RECORDS_START_YEAR
7+
from ogusa.utils import CPS_START_YEAR
88
from ogusa.utils import comp_array, comp_scalar, dict_compare
99
from ogusa.get_micro_data import get_calculator
1010
from ogusa import SS
@@ -190,7 +190,7 @@ def test_get_micro_data_get_calculator():
190190
calc = get_calculator(baseline=False, calculator_start_year=2017,
191191
reform=reform, data=TAXDATA,
192192
weights=WEIGHTS,
193-
records_start_year=RECORDS_START_YEAR)
193+
records_start_year=CPS_START_YEAR)
194194
assert calc.current_year == 2017
195195

196196
reform = {
@@ -207,5 +207,5 @@ def test_get_micro_data_get_calculator():
207207
calc2 = get_calculator(baseline=False, calculator_start_year=2017,
208208
reform=reform, data=TAXDATA,
209209
weights=WEIGHTS,
210-
records_start_year=RECORDS_START_YEAR)
210+
records_start_year=CPS_START_YEAR)
211211
assert calc2.current_year == 2017

ogusa/tests/test_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
import os
3-
from ogusa.utils import RECORDS_START_YEAR
3+
from ogusa.utils import CPS_START_YEAR
44

55

66
def test_cps():
@@ -14,7 +14,7 @@ def test_cps():
1414

1515
calc = get_micro_data.get_calculator(
1616
baseline, start_year, reform=reform,
17-
records_start_year=RECORDS_START_YEAR, data="cps")
17+
records_start_year=CPS_START_YEAR, data="cps")
1818
# blind_head is only in the CPS file and e00700 is only in the PUF.
1919
# See taxcalc/records_variables.json
2020
assert (calc.array("blind_head").sum() > 0 and
@@ -38,7 +38,7 @@ def test_set_path():
3838
with pytest.raises((IOError, ValueError), match="notapath.csv"):
3939
get_micro_data.get_calculator(
4040
baseline, start_year, reform=reform,
41-
records_start_year=RECORDS_START_YEAR, data="notapath.csv")
41+
records_start_year=CPS_START_YEAR, data="notapath.csv")
4242

4343

4444
def test_puf_path():
@@ -68,4 +68,4 @@ def test_puf_path():
6868
with pytest.raises((IOError, ValueError), match="puf.csv"):
6969
get_micro_data.get_calculator(
7070
baseline, start_year, reform=reform,
71-
records_start_year=RECORDS_START_YEAR, data=None)
71+
records_start_year=CPS_START_YEAR, data=None)

ogusa/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import os
1313
from io import StringIO
1414
import numpy as np
15+
import taxcalc
1516
try:
1617
import cPickle as pickle
1718
except ImportError:
@@ -31,7 +32,8 @@
3132
TC_LAST_YEAR = 2027
3233

3334
# Year of data used (e.g. PUF or CPS year)
34-
RECORDS_START_YEAR = 2011
35+
CPS_START_YEAR = taxcalc.Records.CPSCSV_YEAR
36+
PUF_START_YEAR = taxcalc.Records.PUFCSV_YEAR
3537

3638
# for f in (REFORM_DIR, BASELINE_DIR):
3739
# if not os.path.exists(f):

0 commit comments

Comments
 (0)