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

REF and TEST: rank_size in inequality.py #551

Merged
merged 1 commit into from
Jun 29, 2020

Conversation

bktaha
Copy link
Contributor

@bktaha bktaha commented Jun 16, 2020

Based on the discussion in #519, refactor the method rank_size_plot in inequality.py so the output now is the data to be plotted instead of a pyplot Axes object. This is in line with the rest of the methods in this module. The method is renamed to rank_size to reflect this change.

Also added test for the new method, which checks that

  • The x and y arrays are the same length.
  • This length is (c x 100)% of the input, as specified.
  • The output log-log plot is linear for a Pareto draw, and not otherwise.

Edited the docstring for the other two methods in the module for pep8 compliance.

This closes #519

@pep8speaks
Copy link

Hello @bktaha! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 30:1: W191 indentation contains tabs

Line 134:1: W391 blank line at end of file

@mmcky
Copy link
Contributor

mmcky commented Jun 17, 2020

thanks @bktaha.

As @jstac mentions in the issue we will need to coordinate updates for:

https://github.com/QuantEcon/lecture-python

source/rst/kesten_processes.rst:    qe.rank_size_plot(data, ax, c=0.01)
source/rst/wealth_dynamics.rst:If you like, you can use the function ``rank_size_plot`` from the ``quantecon`` library (documentation `here <https://quanteconpy.readthedocs.io/en/latest/tools/inequality.html#quantecon.inequality.rank_size_plot>`__). 
source/rst/wealth_dynamics.rst:    qe.rank_size_plot(ψ_star, ax, c=0.001)
source/rst/heavy_tails.rst:If you like you can use the function ``qe.rank_size_plot`` from the ``quantecon`` library to generate the plots.
source/rst/heavy_tails.rst:        qe.rank_size_plot(data, ax, label=label)

to support the new version of quantecon once this is merged and released.

@mmcky
Copy link
Contributor

mmcky commented Jun 17, 2020

thanks @bktaha -- I have seen this draft PR to address the above

QuantEcon/lecture-python#231

@jstac
Copy link
Contributor

jstac commented Jun 17, 2020

Excellent job @bktaha. This is great. I'll leave the merge with @mmcky and look at your other PR now.

@mmcky
Copy link
Contributor

mmcky commented Jun 20, 2020

thanks @bktaha I will merge this on Monday in coordination with QuantEcon/lecture-python#231

@mmcky mmcky merged commit 856dda8 into QuantEcon:master Jun 29, 2020
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

Successfully merging this pull request may close these issues.

[Test] Setup test for add_rank_size
4 participants