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

Convert active matter and reaction ensemble tutorials to ipython #3249

Closed
mkuron opened this issue Oct 15, 2019 · 3 comments
Closed

Convert active matter and reaction ensemble tutorials to ipython #3249

mkuron opened this issue Oct 15, 2019 · 3 comments

Comments

@mkuron
Copy link
Member

mkuron commented Oct 15, 2019

The students last week struggled quite a bit with the active matter tutorial because it was the only one not in ipython yet.

@jonaslandsgesell
Copy link
Member

I suggest to delete the old reaction ensemble tutorial completely.

@jngrad
Copy link
Member

jngrad commented Dec 27, 2019

Tutorial reaction ensemble: replaced by the constant pH tutorial in 4.2.

Tutorial active matter: the LaTeX file was converted to Jupyter in jngrad/espresso/fix-3249.

# to get a readable diff
git show 9fd068464b:doc/tutorials/06-active_matter/06-active_matter.tex | sed -r 's/^(.*)$/    "\1\\n",/' > 06-active_matter.tex.bak
git show 961ba8e776:doc/tutorials/06-active_matter/06-active_matter.ipynb > 06-active_matter.ipynb.bak
meld 06-active_matter.tex.bak 06-active_matter.ipynb.bak

Everything related to LaTeX or BibTeX was also removed.

@mkuron: how should we proceed with the exercises and solutions?

  1. @KaiSzuttor once looked into Jupyter notebooks with an add-on to mask solutions, but I don't remember if he found a solution that would be compatible with our CI pipeline.
  2. Alternatively, we could remove the exercises and convert each solution into a Jupyter notebook. This means editing 06-active_matter.ipynb to move some paragraphs to the relevant part1-enhanced_diffusion.ipynb, part2-rectification_geometry.ipynb, part3-rectification_simulation.ipynb, and part4-flow_field.ipynb notebooks.

kodiakhq bot added a commit that referenced this issue Jan 3, 2020
Convert the last remaining LaTeX file to Jupyter and delete all LaTeX-related resources.

Partial fix for #3249
@jngrad
Copy link
Member

jngrad commented Jul 27, 2020

Here is a solution to mask solutions and prevent them from running when clicking on "Run all cells":

  • install the NB extensions, and push the javascript and CSS of the "exercise2" plugin into your local jupyter installation:
    # install nbcontribs
    pip3 install --user jupyter_contrib_nbextensions
    # copy javascript and css
    jupyter contrib nbextension install --user
    # enable exercise and its dependencies
    jupyter nbextension enable rubberband/main
    jupyter nbextension enable exercise2/main
    Please note this will bring in or update a lot of dependencies. Among those, the tornado dependency, if too recent, can create compatibility issues with old versions of Jupyter.
  • start ipypresso, open a tutorial, find a cell containing a solution, convert it to Markdown and add strings ```python before the first line and ``` after the last line to pygmentize the code. Insert an empty code cell below. Use Shift+left-click to drag a red box around the markdown cell containing the question and the markdown cell containing the code solution to highlight them both, then click on the "exercise2" button to hide the solution.

In CI, we need to convert those markdown cells back into code and delete the next code cell (which should be empty).

There are a few glitches if you forget to convert the code cell into a markdown cell before clicking the "exercise2" button (I saw unicode glyphs being inserted, probably as a workaround for a known bug with matplolib).

@biermanncarl is currently looking into this.

Since the original issue here was converting the tutorials into IPython, and this task has been completed, I'm closing this. Feel free to open tickets to any tutorial(s) that you would like to see improved with this exercise2 Jupyter add-on.

@jngrad jngrad closed this as completed Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants