{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Movie of a phase screen\n", "\n", "Below is a short movie clip showing a sequence of 200x200 pixel phase screens generated MegaScreen(), embedded in a jupyter notebook. The similarity to clouds is not accidental, as clouds reflect the turbulent structure of the atmosphere, as do phase screens. \n", "\n", "To see an infinitely long clip in a Python desktop window, run the script in `play_movie.py`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import context\n", "import numpy as np\n", "from matplotlib.animation import FuncAnimation\n", "import matplotlib.pyplot as plt\n", "from IPython.display import HTML\n", "from play_movie import screen_movie\n", "from speckle_movie import speckle_movie\n", "import numpy.random\n", "\n", "numpy.random.seed(1234) # Set to None to get non-repeatable initial state" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fig=plt.figure(figsize=(5,5))\n", "anim = FuncAnimation(fig, lambda x:x, frames=screen_movie(), interval=30, blit=True,save_count=200)\n", "plt.close() # Needed to avoid an extra plot\n", "HTML(anim.to_html5_video())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Movie clip of a speckle pattern\n", "\n", "To see an infinitely long clip, run speckle_movie.py" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fig=plt.figure(figsize=(5,5))\n", "anim = FuncAnimation(fig, lambda x:x, frames=speckle_movie(windowSize=200), interval=30, blit=True,save_count=200)\n", "plt.close() # Needed to avoid an extra plot\n", "HTML(anim.to_html5_video())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.6" } }, "nbformat": 4, "nbformat_minor": 2 }