Skip to content

Commit

Permalink
Merge pull request #386 from hdoupe/update-build
Browse files Browse the repository at this point in the history
Update for version 0.5.+ conda builds
  • Loading branch information
jdebacker authored May 23, 2018
2 parents 4c56f47 + 2619699 commit 007e598
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 297 deletions.
2 changes: 1 addition & 1 deletion conda.recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BLD_DIR=`pwd`

# Recipe and source are stored together
SRC_DIR=$RECIPE_DIR/../../
SRC_DIR=$RECIPE_DIR/../
pushd $SRC_DIR

$PYTHON setup.py install
Expand Down
9 changes: 4 additions & 5 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package:
name: ogusa
version: 0.4
version: 0.5.10

requirements:
build:
- python
- pip
- matplotlib
- numpy >=1.12.1
- pandas >=0.20.1
- pytest
- python
- scipy
- setuptools
- taxcalc
Expand All @@ -22,6 +22,7 @@ requirements:
- scipy
- setuptools
- taxcalc
- dask

about:
home: https://github.com/open-source-economics/OG-USA/
Expand All @@ -33,7 +34,6 @@ test:
- ogusa.TPI
- ogusa.calibrate
- ogusa.demographics
- ogusa.demographics_old
- ogusa.elliptical_u_est
- ogusa.firm
- ogusa.fiscal
Expand All @@ -48,4 +48,3 @@ test:
- ogusa.utils
- ogusa.wealth
- ogusa.wealthinit

8 changes: 5 additions & 3 deletions ogusa/TPI_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
Packages
------------------------------------------------------------------------
'''
import os
import pickle

import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import cPickle as pickle
# import cPickle as pickle

import firm

Expand Down Expand Up @@ -450,7 +452,7 @@ def gini_nocol(path, omega):
cum_levels[:, 1:] = cum_levels[:, :-1]
cum_levels[:, 0] = 0
G = 2 * (.5 - (cum_levels * omega_sorted).sum(1))
print G[-1]
print(G[-1])
return G

'''
Expand Down Expand Up @@ -728,7 +730,7 @@ def gini_nocol(path, omega):
X, Y = np.meshgrid(domain, Jgrid)


print 'Starting movies'
print('Starting movies')
# top zlim is for the income tax, bottom zlim is for the wealth tax


Expand Down
8 changes: 4 additions & 4 deletions ogusa/get_micro_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@
import dask.multiprocessing
import numpy as np
import pickle
from ogusa.utils import DEFAULT_START_YEAR, TC_LAST_YEAR
from ogusa.utils import RECORDS_START_YEAR
from ogusa.utils import DEFAULT_START_YEAR, TC_LAST_YEAR, PUF_START_YEAR


def get_calculator(baseline, calculator_start_year, reform=None,
data=None, weights=None,
records_start_year=RECORDS_START_YEAR):
records_start_year=PUF_START_YEAR):
'''
--------------------------------------------------------------------
This function creates the tax calculator object for the microsim
Expand All @@ -41,7 +40,8 @@ def get_calculator(baseline, calculator_start_year, reform=None,
data = DataFrame for Records object
weights = weights DataFrame for Records object
records_start_year = the start year for the data and weights
dfs
dfs (default is set to the PUF start year
as defined in the Tax-Calculator project)
RETURNS: Calculator object with a current_year equal to
calculator_start_year
Expand Down
6 changes: 3 additions & 3 deletions ogusa/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pickle
import numpy as np
import pandas as pd
from ogusa.utils import RECORDS_START_YEAR
from ogusa.utils import CPS_START_YEAR
from ogusa.utils import comp_array, comp_scalar, dict_compare
from ogusa.get_micro_data import get_calculator
from ogusa import SS
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_get_micro_data_get_calculator():
calc = get_calculator(baseline=False, calculator_start_year=2017,
reform=reform, data=TAXDATA,
weights=WEIGHTS,
records_start_year=RECORDS_START_YEAR)
records_start_year=CPS_START_YEAR)
assert calc.current_year == 2017

reform = {
Expand All @@ -207,5 +207,5 @@ def test_get_micro_data_get_calculator():
calc2 = get_calculator(baseline=False, calculator_start_year=2017,
reform=reform, data=TAXDATA,
weights=WEIGHTS,
records_start_year=RECORDS_START_YEAR)
records_start_year=CPS_START_YEAR)
assert calc2.current_year == 2017
8 changes: 4 additions & 4 deletions ogusa/tests/test_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import os
from ogusa.utils import RECORDS_START_YEAR
from ogusa.utils import CPS_START_YEAR


def test_cps():
Expand All @@ -14,7 +14,7 @@ def test_cps():

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


def test_puf_path():
Expand Down Expand Up @@ -68,4 +68,4 @@ def test_puf_path():
with pytest.raises((IOError, ValueError), match="puf.csv"):
get_micro_data.get_calculator(
baseline, start_year, reform=reform,
records_start_year=RECORDS_START_YEAR, data=None)
records_start_year=CPS_START_YEAR, data=None)
4 changes: 3 additions & 1 deletion ogusa/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import os
from io import StringIO
import numpy as np
import taxcalc
try:
import cPickle as pickle
except ImportError:
Expand All @@ -31,7 +32,8 @@
TC_LAST_YEAR = 2027

# Year of data used (e.g. PUF or CPS year)
RECORDS_START_YEAR = 2011
CPS_START_YEAR = taxcalc.Records.CPSCSV_YEAR
PUF_START_YEAR = taxcalc.Records.PUFCSV_YEAR

# for f in (REFORM_DIR, BASELINE_DIR):
# if not os.path.exists(f):
Expand Down
Loading

0 comments on commit 007e598

Please sign in to comment.