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

Open
wants to merge 6 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
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.

None yet

1 participant