Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate proper HTML file on local machine #29

Open
GoFroggyRun opened this issue Aug 31, 2016 · 4 comments
Open

Unable to generate proper HTML file on local machine #29

GoFroggyRun opened this issue Aug 31, 2016 · 4 comments

Comments

@GoFroggyRun
Copy link
Contributor

GoFroggyRun commented Aug 31, 2016

I'm working on a new plot based on an idea discussed here. And I think it would be helpful to take a look at how tax_reform_viz_1 generates the plot and HTML file.

While trying to get an HTML for tax_reform_viz_1 locally, I followed the instruction in the README file, and executed python build.py. I got two extra HTML files name index_landscape.html and index_portrait.html, with the same content as shown in the screenshot below:

screen shot 2016-08-31 at 2 58 40 pm

I thought the final output would be a single HTML file, I'm thus not quite sure what I have missed, could anyone please advise?

cc @MattHJensen

@GoFroggyRun GoFroggyRun changed the title Unable to generate HTML file on local machine Unable to generate proper HTML file on local machine Aug 31, 2016
@GoFroggyRun
Copy link
Contributor Author

The problem might be coming from package version. Based on the conda list of the tre environment:

apipkg                    1.4                       <pip>
appnope                   0.1.0                    py35_0  
bokeh                     0.12.1                   py35_0  
decorator                 4.0.10                   py35_0  
entrypoints               0.2.2                    py35_0  
execnet                   1.4.1                     <pip>
ipykernel                 4.4.1                    py35_0  
ipython                   5.1.0                    py35_0  
ipython-notebook          4.0.4                    py35_0  
ipython_genutils          0.1.0                    py35_0  
jinja2                    2.8                      py35_1  
jsonschema                2.5.1                    py35_0  
jupyter_client            4.3.0                    py35_0  
jupyter_core              4.1.1                    py35_0  
llvmlite                  0.11.0                   py35_0  
markupsafe                0.23                     py35_2  
mistune                   0.7.2                    py35_1  
mkl                       11.3.3                        0  
nbconvert                 4.2.0                    py35_0  
nbformat                  4.1.0                    py35_0  
notebook                  4.2.2                    py35_0  
numba                     0.26.0              np110py35_0  
numpy                     1.10.4                   py35_2  
openssl                   1.0.2h                        2  
taxcalc                   0.5.9                    py35_0    ospc
pandas                    0.16.2              np110py35_0  
path.py                   8.2.1                    py35_0  
pep8                      1.7.0                     <pip>
pexpect                   4.0.1                    py35_0  
pickleshare               0.7.3                    py35_0  
pip                       8.1.2                    py35_0  
prompt_toolkit            1.0.3                    py35_0  
ptyprocess                0.5.1                    py35_0  
py                        1.4.31                   py35_0  
pygments                  2.1.3                    py35_0  
pytest                    2.9.2                    py35_0  
pytest-cache              1.0                       <pip>
pytest-pep8               1.0.6                     <pip>
python                    3.5.2                         0  
python-dateutil           2.5.3                    py35_0  
python.app                1.2                      py35_4  
pytz                      2016.6.1                 py35_0  
pyyaml                    3.11                     py35_4  
pyzmq                     15.4.0                   py35_0  
readline                  6.2                           2  
requests                  2.11.1                   py35_0  
setuptools                26.1.1                   py35_0  
simplegeneric             0.8.1                    py35_1  
six                       1.10.0                   py35_0  
sqlite                    3.13.0                        0  
terminado                 0.6                      py35_0  
tk                        8.5.18                        0  
toolz                     0.8.0                    py35_0  
tornado                   4.4.1                    py35_0  
traitlets                 4.2.2                    py35_0  
wcwidth                   0.1.7                    py35_0  
wheel                     0.29.0                   py35_0  
xz                        5.2.2                         0  
yaml                      0.1.6                         0  
zlib                      1.2.8                         3  

Note that taxcalc 0.5.9 py35_0 ospc doesn't seem to be the latest taxcalc distribution.

@MattHJensen
Copy link
Contributor

@GoFroggyRun, we currently have portrait and landscape versions of the plot: http://www.ospc.org/gallery/tax_reform_viz_1/

This might be what you have stumbled across.

@brendancol, could you please advise?

@GoFroggyRun
Copy link
Contributor Author

@MattHJensen

Based on my understanding, code lines here call some compressed, pre-calculated data, and thus building without such file would result in the error I'm experiencing as mentioned, which is similar to the link http://www.ospc.org/gallery/tax_reform_viz_1/.

Replacing the existing code with those got commented out to call function get_source_data(), which is defined in data.py will, however, result in some different error. The error message reads:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-9a9236e3bc4a> in <module>()
----> 1 l = get_source_data()

<ipython-input-1-6318ba7ad1e3> in get_source_data()
     58             for name1, growth in groups_grow.items():
     59                 for name2, behave in groups_beha.items():
---> 60                     data = run_reform(name, reform, growth, behave)
     61                     dataframes[name + name1 +name2 + 'diff'] = data
     62         return dataframes

<ipython-input-1-6318ba7ad1e3> in run_reform(name, reform, growth, behave)
     15         puf = pd.read_csv("./puf.csv")
     16         policy_base = Policy(start_year=2013)
---> 17         records_base = Records(puf)
     18         policy_reform = Policy()
     19         records_reform = Records(puf)

/Users/seanwang/anaconda2/envs/tre/lib/python3.5/site-packages/taxcalc/records.py in __init__(self, data, blowup_factors, weights, start_year, consider_imputations)
    243         """
    244         # pylint: disable=unused-argument,too-many-arguments
--> 245         self._read_data(data)
    246         self._read_blowup(blowup_factors)
    247         self._read_weights(weights)

/Users/seanwang/anaconda2/envs/tre/lib/python3.5/site-packages/taxcalc/records.py in _read_data(self, data)
    525             if varname not in Records.VALID_READ_VARS:
    526                 msg = 'Records data variable name {} not in VALID_READ_VARS'
--> 527                 raise ValueError(msg.format(varname))
    528             READ_VARS.add(varname)
    529             setattr(self, varname, tax_dta[varname].values)

ValueError: Records data variable name age_head not in VALID_READ_VARS

And it seems to me that such error might due to the fact that TRE environment is not using the latest taxcalc release.

@brendancol
Copy link

brendancol commented Sep 2, 2016

@GoFroggyRun Yes, you are correct about the compressed data file dependency. In terms of creating your plot from the idea above, tax_reform_viz_1 is a good template...but having multiple layouts (portrait, landscape) is optional. All you need a single build_cmd which lives in the info.yml file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants