Skip to content

Commit

Permalink
Update propNav.ipynb
Browse files Browse the repository at this point in the history
Use Matplotlib jshtml for embedding saved engagement animation when run with Spyder
  • Loading branch information
gedeschaines committed Mar 21, 2024
1 parent b5a1fd4 commit 271e1a9
Showing 1 changed file with 40 additions and 12 deletions.
52 changes: 40 additions & 12 deletions propNav.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"+ Target rotation direction vector (UWt)\n",
"+ Integration step size and stop time (T_STEP, T_STOP)\n",
"\n",
"then select \"Run Selected Cell and All Below\" for Jupyter \"Run\" menu options. Processing output text and figures will be presented in an output cell following the main routine code cell immediately below the \"Processing Main Routine ...\" markdown cell."
"then select \"Run Selected Cell and All Below\" for Jupyter \"Run\" menu options. Processing output text and figures will be presented in output cells following the main routine code cell immediately below the \"Processing Main Routine ...\" markdown cell."
]
},
{
Expand Down Expand Up @@ -189,7 +189,9 @@
"source": [
"import sys\n",
"\n",
"RUN_WITH_COLAB = False\n",
"RUN_WITH_SPYDER = False\n",
"RUN_WITH_COLAB = False\n",
"\n",
"if RUN_WITH_COLAB:\n",
" from google.colab import widgets\n",
" from google.colab import drive\n",
Expand Down Expand Up @@ -237,9 +239,13 @@
" if RUN_WITH_COLAB:\n",
" %matplotlib inline\n",
" else:\n",
" from matplotlib import rc\n",
" rc('animation', html='jshtml', embed_limit=100)\n",
" #rc['animation.embed_limit'] = 100\n",
" if RUN_WITH_SPYDER:\n",
" # CAUTION: Embedded 'jshtml' engagement animation in saves of this\n",
" # notebook with output may be upwards of 50 Mb in size.\n",
" from matplotlib import rc # Needed to set Matplotlib animation._repr_html_()\n",
" rc('animation',\n",
" html='jshtml', # Matplotlib animation will be HTML wrapped JavaScript\n",
" embed_limit=100) # Embedded animation size will be limited to 100 Mb\n",
" try:\n",
" %matplotlib ipympl\n",
" except:\n",
Expand Down Expand Up @@ -2958,8 +2964,7 @@
"jupyter": {
"source_hidden": true
},
"outputId": "15892832-50ea-43a6-edce-a1aa50cc6831",
"scrolled": true
"outputId": "15892832-50ea-43a6-edce-a1aa50cc6831"
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -3095,19 +3100,42 @@
"id": "a6f227aa-094a-4314-b80a-195ec1980881"
},
"source": [
"### Display Engagement Animation"
"### Display Saved Engagement Animation"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "20747fa8-215d-468d-9870-0d75071a1e8e",
"metadata": {},
"id": "f878a27a-9a8b-455d-9821-a861b1f29852",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 621
},
"executionInfo": {
"elapsed": 731,
"status": "ok",
"timestamp": 1710972498468,
"user": {
"displayName": "Gary Deschaines",
"userId": "00818646848844190559"
},
"user_tz": 300
},
"id": "f878a27a-9a8b-455d-9821-a861b1f29852",
"jupyter": {
"source_hidden": true
},
"outputId": "b5302278-cadf-4e20-daee-88c53b254b3e"
},
"outputs": [],
"source": [
" if SAVE_ANIM and anim_filename is not None:\n",
" from moviepy import editor\n",
" display(editor.ipython_display(anim_filename))"
" if RUN_WITH_SPYDER:\n",
" display(anim)\n",
" else:\n",
" from moviepy import editor\n",
" display(editor.ipython_display(anim_filename))"
]
}
],
Expand Down

0 comments on commit 271e1a9

Please sign in to comment.