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

Fixing SDEC docs page #1817

Merged
merged 6 commits into from
Nov 8, 2021
Merged

Conversation

isaacgsmith
Copy link
Member

Description

This provides a permanent fix to the issue in #1811. The problem was that the SVG file format which the SDEC plots were saved as are too large (6+ MB per plot). This PR makes it so the plots on this page (not any other page) are exported as high-resolution PNG (png2x) files -- this is not as nice as SVG, but it will do for that page. The file size is much more manageable. I have also included a description of this problem and its solution in the documentation.

Examples

The two pages involved:
https://smithis7.github.io/tardis/branch/sdec_fix_doc/io/visualization/sdec_plot.html
https://smithis7.github.io/tardis/branch/sdec_fix_doc/development/documentation_guidelines.html (see note at the bottom of the page)

Type of change

  • Bug fix.
  • New feature.
  • Breaking change.
  • None of the above.

Checklist

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
    • (optional) I have built the documentation on my fork following the instructions.
  • I have assigned and requested two reviewers for this pull request.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@tardis-bot
Copy link
Contributor

Before a pull request is accepted, it must meet the following criteria:

  • Is the necessary information provided?
  • Is this a duplicate PR?
    • If a new PR is clearly a duplicate, ask how this PR is different from the original PR?
    • If this PR is about to be merged, close the original PR with a link to this new PR that solved the issue.
  • Does it pass existing tests and are new tests provided if required?
    • The test coverage should not decrease, and for new features should be close to 100%.
  • Is the code tidy?
    • No unnecessary print lines or code comments.

1 similar comment
@tardis-bot
Copy link
Contributor

Before a pull request is accepted, it must meet the following criteria:

  • Is the necessary information provided?
  • Is this a duplicate PR?
    • If a new PR is clearly a duplicate, ask how this PR is different from the original PR?
    • If this PR is about to be merged, close the original PR with a link to this new PR that solved the issue.
  • Does it pass existing tests and are new tests provided if required?
    • The test coverage should not decrease, and for new features should be close to 100%.
  • Is the code tidy?
    • No unnecessary print lines or code comments.

@codecov
Copy link

codecov bot commented Oct 20, 2021

Codecov Report

Merging #1817 (5244b7b) into master (efebacd) will decrease coverage by 0.02%.
The diff coverage is n/a.

❗ Current head 5244b7b differs from pull request most recent head 2f4264b. Consider uploading reports for the commit 2f4264b to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1817      +/-   ##
==========================================
- Coverage   58.25%   58.22%   -0.03%     
==========================================
  Files          66       66              
  Lines        6721     6722       +1     
==========================================
- Hits         3915     3914       -1     
- Misses       2806     2808       +2     
Impacted Files Coverage Δ
tardis/tardis/plasma/properties/ion_population.py 85.64% <0.00%> (-0.08%) ⬇️
...s/tardis/visualization/widgets/custom_abundance.py 14.42% <0.00%> (-0.01%) ⬇️
...dis/montecarlo/montecarlo_numba/formal_integral.py 50.00% <0.00%> (+0.17%) ⬆️
...s/tardis/plasma/properties/radiative_properties.py 79.02% <0.00%> (+1.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efebacd...2f4264b. Read the comment docs.

Copy link
Member

@atharva-2001 atharva-2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this!
Everything looks great to me, I just had a few small questions though: Is the InlineBackend.figure_format statement deprecated? It says here in this old version of docs that we must be using InlineBackend.figure_formats instead. However, in the newer docs even that is deprecated, and it says that we should use matplotlib_inline.backend_inline.set_matplotlib_formats().
Maybe you might want to check out this too.

Also, we do not have an option of png2x there. Is that also deprecated, or is it the same as the retina option?

@andrewfullard
Copy link
Contributor

Please look into Atharva's comments

@jaladh-singhal jaladh-singhal removed their request for review October 27, 2021 15:56
@isaacgsmith
Copy link
Member Author

Thank you for fixing this! Everything looks great to me, I just had a few small questions though: Is the InlineBackend.figure_format statement deprecated? It says here in this old version of docs that we must be using InlineBackend.figure_formats instead. However, in the newer docs even that is deprecated, and it says that we should use matplotlib_inline.backend_inline.set_matplotlib_formats(). Maybe you might want to check out this too.

Also, we do not have an option of png2x there. Is that also deprecated, or is it the same as the retina option?

Indeed, figure_format is deprecated -- great catch! I believe %config InlineBackend.figure_formats='png2x' is the same as putting c.InlineBackend.figure_formats='png2x' in the configuration file, so it is consistent with the current documentation.

Copy link
Member

@atharva-2001 atharva-2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I wondered if %config InlineBackend.figure_formats is deprecated, but it is not mentioned anywhere in the documentation that it is, just the function(IPython.display.set_matplotlib_formats) is deprecated.
Also, both the png2x and the retina options are the same, so I am happy with the changes.

@andrewfullard andrewfullard merged commit 60e044e into tardis-sn:master Nov 8, 2021
@isaacgsmith isaacgsmith deleted the sdec_fix_doc branch November 8, 2021 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants