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

Merged two PRs and added make_html.py #71

Closed
wants to merge 28 commits into from

Conversation

rjleveque
Copy link
Member

I merged the PRs #68 and #69 into this one since they were starting to diverge and I wanted to test various changes from each of them together. I suggest we close both of those if @ketch and @maojrs are happy with this one, and then merge this in and move on from there with new PRs.

I added a make_html.py to create html files from all the notebooks and put them in a separate directory riemann_book_files that can be moved to a website, such as: http://faculty.washington.edu/rjl/riemann_book/Index.html

This is far from perfect since much of the rendering is not working properly. See for example the Tammann notebook, which shows many of the problems:

  • bib citations mess up the rest of the text beyond
  • equation numbers aren't showing up
  • javascript widget broken.

On the other hand the Introduction looks pretty good except for the equation numbers.

rjleveque and others added 28 commits April 23, 2017 19:16
…tripes.

Illustrated in Euler_equations.ipynb where density is colored red to left and blue to right of contact discontinuity.
Also add snapshot_widget option to Traffic_flow.ipynb
To compile the book, you’ll need to update to the latest pandoc (1.19.2) from
https://github.com/jgm/pandoc/releases/tag/1.19.2.1 and install takluyver’s
bookbook (with pip).  I think you also need to have Clawpack installed for
Python 3.

Once you have all that, run the shell script:

    ./make_book.sh

The script generates a bunch of new notebook files with numbers in front of
them, and those are used to compile the book.  You can remove the extra
notebooks afterward by doing

    rm 0?-*.ipynb

The set of notebooks to be included, and their order, is determined by the list
at the beginning of `make_chapters.py`.  For the moment I’ve just included
three sample chapters.

Cells can be omitted (hidden) in the book output.  For instance, the cells with
import statements have been hidden.  To set a cell to be hidden, open the
notebook and select view -> cell toolbar -> tags.  Then add the tag ‘hide’ to
the desired cell(s).

To use the static versions of the widgets, I’m just doing a search and replace.
This means that the following code should appear by itself on some line of the
notebook:

    from ipywidgets import interact

bookbook expects that each notebook begins with a Markdown cell containing a
level-1 header, which will be the chapter title.

I removed the messages printed by snapshot_widgets because they are a bit of a
nuisance in the book.
* master:
  Fix a couple more typos.
  Fix a typo.
  Don't show delta shocks when t=0.
  Add exercise regarding low Froude number limit.
  Add references and notes on large Froude number limit in pressureless flow chapter.
…amples.

Added new function to utils/riemann_tools.py to make simple demo plots
and improved setting of x_traj points so stripes are equal width near origin
Cross references are now properly converted from
markdown to latex.
* master:
  Updated nbstripout to remove metadata
  Merged pull request
  Editorial changes to Tammann notebook.
  Added characterisitics
  Added section in negative pressure
  Minor changes to examples
  Put repeated code into a function.
  Update Docker.md
  Update Docker.md
  Minor update to TammannNB
  Forgot to nbstrip on previous commit
  Added examples to Euler Tammann NB
  Updated Tammann book
  revert dirty notebooks commited by accident
  Add clawpack to Dockerfile and instructions for pulling from riemann@master
  Added Dockerfile and Docker.md
  Added very small versions of the phase plane interactive apps
  Added interactive pplane html apps
Include preface in pdf.
Use \small for code in pdf.
Use SVG backend so that graphics are in vector format.
Adjust figure and font sizes to work with SVG backend.
Plot Riemann solution and phase plane together for nonlinear elasticity.
Fix numerous minor issues in notebooks.
* master: (23 commits)
  Updated nbstripout to remove metadata
  Merged pull request
  Editorial changes to Tammann notebook.
  Added characterisitics
  Added section in negative pressure
  Minor changes to examples
  Put repeated code into a function.
  Update Docker.md
  Update Docker.md
  Minor update to TammannNB
  Fix a couple more typos.
  Fix a typo.
  Don't show delta shocks when t=0.
  Add exercise regarding low Froude number limit.
  Add references and notes on large Froude number limit in pressureless flow chapter.
  Forgot to nbstrip on previous commit
  Added examples to Euler Tammann NB
  Updated Tammann book
  revert dirty notebooks commited by accident
  Add clawpack to Dockerfile and instructions for pulling from riemann@master
  ...
…nges

* bookform:
  rjleveque version for debugging bookbook
  Apply SIAM book formatting to pdf. Include preface in pdf. Use \small for code in pdf. Use SVG backend so that graphics are in vector format. Adjust figure and font sizes to work with SVG backend. Plot Riemann solution and phase plane together for nonlinear elasticity. Fix numerous minor issues in notebooks.
  Add Preface and fix some issues with bookbook.
  Improved presentation in Shallow_water.ipynb.
  Use t=0.2 instead of t=0 for static widget output.
  Run pdflatex one more time for citations.
  Remove stray comma from merge.
  Add 5 more chapters to book.
  Use report template and update script name.
  Initial effort at compiling book.
@ketch
Copy link
Member

ketch commented May 7, 2017

Could we merge #69 and then review this for merging?

@ketch
Copy link
Member

ketch commented May 7, 2017

I notice that the stripe plots in the HTML use rasterized images. What's the rationale for going that route?

@rjleveque
Copy link
Member Author

I merged #69 and then did a test merge of this branch and it seems to merge without any conflicts. But @ketch should try it out and then merge if all seems ok.

Github seems to be flagging mostly a bunch of conflicting metadata changes that merge fine, but maybe because I have nbdime installed? We might have to merge locally and push back to Github rather than using the Merge button?

@rjleveque
Copy link
Member Author

rjleveque commented May 7, 2017 via email

@rjleveque
Copy link
Member Author

@ketch: I tried changing from png to svg in the function utils.animation_tools.make_image but it seems imread only supports png format, see http://stackoverflow.com/questions/31452451/importing-an-svg-file-a-matplotlib-figure

So it doesn't seem easy to make JSAnimations out of vector graphics files, but if you know a way please let me know.

Otherwise I will go ahead and merge this in the next day or two so that we can move forward with submitting the proposal.

@ketch
Copy link
Member

ketch commented May 16, 2017

To make JSAnimations without rasterizing, I use the images from memory rather than writing them to disk. I did this for instance in the Shallow_tracer notebook; here's an executed version with the animation working:

http://nbviewer.jupyter.org/gist/ketch/aa3c953fb06d95cfb2624b5110c0a7ff

@ketch ketch mentioned this pull request May 16, 2017
@ketch
Copy link
Member

ketch commented May 16, 2017

I have a vector-image based HTML-functional animation working and will push something soon (to #73).

@@ -340,7 +335,23 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"nbdime-conflicts": {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like some nbdime merge conflict stuff got included in this commit.

@ketch
Copy link
Member

ketch commented May 17, 2017

Okay, I closed #73 and I'm just looking over this PR (#71). It seems indeed that somewhere there was a merged that messed things up. For instance, if you look at the first Traffic notebook:

https://github.com/rjleveque/riemann_book/blob/4368d3a129765e799d376277d80d9ee195eb9b32/Traffic_flow.ipynb

you'll see that the velocity figure is duplicated, all the imports are duplicated, and a bunch of changes I made have been reverted.

It's going to be very difficult to build on this and try to make sure that we didn't lose any of our previous work. I think that the best path forward is to abandon this PR and put the relevant changes from it into one or more new PRs based off the current master.

I'm sorry for being a bit unresponsive and slow to review/merge PRs. I can definitely be more proactive about this now.

@rjleveque
Copy link
Member Author

Sorry, I must have messed things up when merging bookform and plot_red_blue_stripes, so maybe we can try a new merge of those and be more careful about it.

ketch added a commit to ketch/riemann_book that referenced this pull request May 18, 2017
@ketch ketch mentioned this pull request May 18, 2017
@rjleveque
Copy link
Member Author

This was replaced by #74.

@rjleveque rjleveque closed this May 24, 2017
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.

2 participants