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

Tutorials maintenance #3993

Merged
merged 14 commits into from
Nov 16, 2020
Merged

Conversation

jngrad
Copy link
Member

@jngrad jngrad commented Nov 13, 2020

Description of changes:

  • remove crystallization tutorial (partial fix for Write Tutorial 02 part 2: ELC system with dielectric boundaries #3955, closes Tutorial 02: electrostatics part 2 #3820)
  • remove tutorial numbers and indicate difficulty level (fixes Consistent numbering for tutorials #3959)
  • resolve issues in tutorial LJ (fixes Issue tracker for Tutorial 01 #3934)
  • create a tool to simplify editing exercise2 notebooks by temporarily converting solution markdown cells to executable code cells (fixes Simplify code review of tutorials #3930) and apply pep8 formatting
    # convert solution cells to code cells
    ./pypresso doc/tutorials/convert.py exercise2 --to-py doc/tutorials/lennard_jones/lennard_jones.ipynb
    # edit the notebook
    ./ipypresso notebook
    # convert solution cells back to markdown cells
    ./pypresso doc/tutorials/convert.py exercise2 --to-md doc/tutorials/lennard_jones/lennard_jones.ipynb
    # apply autopep formatting rules
    ./pypresso doc/tutorials/convert.py exercise2 --pep8  doc/tutorials/lennard_jones/lennard_jones.ipynb
  • implement an autocorrelation function espressomd.analyze.autocorrelation() to calculate the ACF of 1-dimensional and 2-dimensional data

Move parser to the end of the script and wrap the main logic
into __main__, so that the script can be imported as a module.
The subprocess module is then no longer needed in the testsuite.
Use the html_runner.py to convert exercise2 cells from Markdown to
Python and back, while preserving metadata. This is helpful when
editing notebooks, to avoid having to manually copy-paste the
solutions to the empty code cells (to be able to run the notebook)
and then clear these cells.
The python `assert` keyword does not behave like a function. Adding
round brackets can lead to subtle bugs: `assert(a == b, "message")`
actually evaluates a tuple and prints "SyntaxWarning: assertion is
always true, perhaps remove parentheses?" without halting the flow
of the program. Warnings cannot be caught by a try/except, instead
one has to rely on the warnings module to convert them to exceptions.
Remove the numbered prefix from all tutorials. Rename html_runner.py
to convert.py to better reflect its new design.
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jngrad jngrad added this to the Espresso 4.2 milestone Nov 13, 2020
@jngrad jngrad marked this pull request as ready for review November 13, 2020 22:59
@jngrad jngrad requested a review from RudolfWeeber November 13, 2020 23:06
@RudolfWeeber
Copy link
Contributor

I assume, you ran the html build job locally for this. If not, please do before merging.

@jngrad jngrad added the automerge Merge with kodiak label Nov 16, 2020
@kodiakhq kodiakhq bot merged commit 6f3239e into espressomd:python Nov 16, 2020
@jngrad jngrad deleted the tutorials-maintenance-2 branch December 15, 2020 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants