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

update many notebooks that they they work with python3.10 and the latest jupyterlab #42

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Thomas-Ulrich
Copy link

@Thomas-Ulrich Thomas-Ulrich commented May 22, 2020

In commit 41f4d2b, I changed backend to widget and fix the interactive plots using this script:

find . -name "*.py" -exec sed -i 's/plt.gcf().canvas.draw()/plt.gcf().canvas.draw(); display(plt.gcf()); clear_output(wait=True)/g' {} \;
find . -name "*.py" -exec sed -i 's/fig.canvas.draw()/fig.canvas.draw(); display(fig); clear_output(wait=True)/g' {} \;
find . -name "*.py" -exec sed -i 's/fig2.canvas.draw()/fig2.canvas.draw(); display(fig2); clear_output(wait=True)/g' {} \;
find . -name "*.py" -exec sed -i "/^[^#]/ s/plt.switch_backend(\"nbagg\")/%matplotlib widget\nfrom IPython.display import display, clear_output/g" {} \;
find . -name "*.py" -exec sed -i "/^[^#]/ s/plt.switch_backend(\"TkAgg\")/%matplotlib widget\nfrom IPython.display import display, clear_output/g" {} \;
find . -name "*.py" -exec sed -i 's/matplotlib.use(\"nbagg\")/%matplotlib widget\nfrom IPython.display import display, clear_output/g' {} \;

(some files need to be fixed manually, e.g. fd_ac2d_heterogeneous_solution.py)

I also removed plt.ion and ioff systematically with:

find . -name "*.py" -exec sed -i '/plt.ion()/d' {} \;
find . -name "*.py" -exec sed -i '/plt.ioff()/d' {} \;

(avoiding Kernel does not exist warnings).

@Thomas-Ulrich Thomas-Ulrich changed the title update NoiseCorrelation.py to comply new numpy requirements update many notebooks that they they work with python3.10 and the latest jupyterlab Apr 26, 2024
@megies
Copy link
Member

megies commented Jun 10, 2024

CC @christadler

@Thomas-Ulrich Thomas-Ulrich marked this pull request as draft June 10, 2024 08:53
@Thomas-Ulrich
Copy link
Author

Thomas-Ulrich commented Jun 10, 2024

Let's wait for the semester to be finished to possibly merge this one (as I'm adding new changes every time I'm discovering new notebooks while teaching).

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