<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-version="1" data-course-id="course-v1:MITx+8.03x+1T2020" data-graded="False" data-block-type="vertical" data-has-score="False" data-usage-id="block-v1:MITx+8.03x+1T2020+type@vertical+block@vert-jupyter-notebooks_1" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-request-token="99159a022af711f0a8a00e09798aea1b">
<h2 class="hd hd-2 unit-title">Jupyter Notebooks for Python Widgets</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.03x+1T2020+type@html+block@jupyter_notebooks_gifs_1">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-version="1" data-course-id="course-v1:MITx+8.03x+1T2020" data-graded="False" data-block-type="html" data-has-score="False" data-usage-id="block-v1:MITx+8.03x+1T2020+type@html+block@jupyter_notebooks_gifs_1" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-request-token="99159a022af711f0a8a00e09798aea1b">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p><h3>About</h3></p><p>
In this course, we will use Jupyter notebooks to run Python widgets. These "widgets" mostly consist of short, interactive simulations. This is an UNGRADED component of the course!</p><p>See the examples below (hover over gifs to play):</p><div align="center"><iframe src="https://mitx-803.github.io/gifs/python_01.html" width="720" height="547" scrolling="no" frameborder="0"/></div><div align="center"><iframe src="https://mitx-803.github.io/gifs/python_02.html" width="720" height="569" scrolling="no" frameborder="0"/></div><div align="center"><iframe src="https://mitx-803.github.io/gifs/python_03.html" width="720" height="665" scrolling="no" frameborder="0"/></div><div align="center"><iframe src="https://mitx-803.github.io/gifs/python_04.html" width="720" height="519" scrolling="no" frameborder="0"/></div>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-version="1" data-course-id="course-v1:MITx+8.03x+1T2020" data-graded="False" data-block-type="vertical" data-has-score="False" data-usage-id="block-v1:MITx+8.03x+1T2020+type@vertical+block@vert-jupyter-notebook_3" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-request-token="99159a022af711f0a8a00e09798aea1b">
<h2 class="hd hd-2 unit-title">Purpose</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.03x+1T2020+type@html+block@jupyter_notebooks_gifs_3">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-version="1" data-course-id="course-v1:MITx+8.03x+1T2020" data-graded="False" data-block-type="html" data-has-score="False" data-usage-id="block-v1:MITx+8.03x+1T2020+type@html+block@jupyter_notebooks_gifs_3" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-request-token="99159a022af711f0a8a00e09798aea1b">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p><h3>Opportunity for Deeper Learning</h3></p><p>
Interactive simulations offer the potential for students to engage with material at a higher cognitive level, and provide an opportunity to delve deeper into content. </p><p><h3>Exposure to Python</h3></p><p>
Python is a ubiquitous programming language among scientists, particularly physicists. Additionally, it is open source, which means you do not need a license to use it. This is why we wanted to write our simulations in this language. </p><p>
Although we do not explicity teach programming skills, it may still be useful (or at least interesting) to view the code, if you are so inclined. Therefore, each Jupyter notebook contains a toggle button that permits students to view the source code. <i class="itshape">Students are encouraged to look behind the curtain, so-to-speak.</i> </p><p>
Moreover, students can alter the code themselves, either on the server where the notebook is run, or by downloading a copy of the notebook locally. Next, we address how these simulations are actually run. </p>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-version="1" data-course-id="course-v1:MITx+8.03x+1T2020" data-graded="False" data-block-type="vertical" data-has-score="False" data-usage-id="block-v1:MITx+8.03x+1T2020+type@vertical+block@vert-jupyter-notebooks_2" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-request-token="99159a022af711f0a8a00e09798aea1b">
<h2 class="hd hd-2 unit-title">Location and Usage</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.03x+1T2020+type@html+block@jupyter_notebooks_gifs_2">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-version="1" data-course-id="course-v1:MITx+8.03x+1T2020" data-graded="False" data-block-type="html" data-has-score="False" data-usage-id="block-v1:MITx+8.03x+1T2020+type@html+block@jupyter_notebooks_gifs_2" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-request-token="99159a022af711f0a8a00e09798aea1b">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p><h3>Optional Link After Lesson Exercises</h3></p><p>
The widgets appear after some graded exercises in the course, but <i class="itshape">their use is purely optional.</i> The related exercises often use plots that are generated by a Python simulation and ask questions related to these plots, but you will always be able to complete these exercises without using the simulation itself. </p><div align="center"><iframe src="https://mitx-803.github.io/gifs/python_05.html" width="720" height="513" scrolling="no" frameborder="0"/></div><p><h3>Running Notebooks on an External Server</h3></p><p>To access a simulation, click the "ACCESS JUPYTER NOTEBOOK HERE" button. This will bring you to a loading page, hosted by <i class="itshape">mybinder.org</i> (the loading time is anywhere from 20 seconds to 3 minutes). The Jupyter notebooks are run externally to the course, on a server which runs an instance of Python. There is no need to install Python or related dependencies!</p><div align="center"><iframe src="https://mitx-803.github.io/gifs/python_06.html" width="720" height="590" scrolling="no" frameborder="0"/></div><p><h3>Initializing the Program</h3></p><p>Once loaded, you will see a Jupyter notebook in your browser! You will have to click a button to initialize the program. The button is indicated in the instructions within the notebook, and also shown below.</p><div align="center"><img width="700" src="/assets/courseware/v1/3f6c044fc06f79d82bb2e8a97f7dd11a/asset-v1:MITx+8.03x+1T2020+type@asset+block/images_binder_initialize_button.png"/></div><p/><div align="center"><iframe src="https://mitx-803.github.io/gifs/python_07.html" width="720" height="602" scrolling="no" frameborder="0"/></div><p><h3>Instructions and Source Code</h3></p><p>Each notebook has self-contained instructions on how to use the Python simulation. Additionally, you may toggle the button at the bottom of the notebook to view/augment the source code.</p><div align="center"><iframe src="https://mitx-803.github.io/gifs/python_08.html" width="720" height="608" scrolling="no" frameborder="0"/></div><p><h3>Saving/Running Notebooks Locally</h3></p><p>Finally, you can dowload each notebook to run locally. Additionally, you can visit the git repository to download all notebooks in the course. In order to run notebooks locally, you must install Python and its dependencies. We cannot help with this process, but we encourage you to look at the resources after this page, if you are interested.</p><div align="center"><iframe src="https://mitx-803.github.io/gifs/python_09.html" width="720" height="609" scrolling="no" frameborder="0"/></div>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-version="1" data-course-id="course-v1:MITx+8.03x+1T2020" data-graded="False" data-block-type="vertical" data-has-score="False" data-usage-id="block-v1:MITx+8.03x+1T2020+type@vertical+block@vert-jupyter-notebooks_4" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-request-token="99159a022af711f0a8a00e09798aea1b">
<h2 class="hd hd-2 unit-title">Resources</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.03x+1T2020+type@html+block@jupyter_notebooks_gifs_4">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-version="1" data-course-id="course-v1:MITx+8.03x+1T2020" data-graded="False" data-block-type="html" data-has-score="False" data-usage-id="block-v1:MITx+8.03x+1T2020+type@html+block@jupyter_notebooks_gifs_4" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-request-token="99159a022af711f0a8a00e09798aea1b">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p><h3>External Links</h3><br/> [mathjaxinline]\bullet[/mathjaxinline] git repository: <a href="https://github.com/mitx-803/vis" target="blank">github.com/mitx-803/vis</a><br/> [mathjaxinline]\bullet[/mathjaxinline] information on Jupyter notebooks: <a href="https://jupyter.org/" target="blank">Jupyter Notebooks</a><br/> [mathjaxinline]\bullet[/mathjaxinline] information on installing Python through Anaconda: <a href="https://www.anaconda.com/distribution/" target="blank">Anaconda</a><br/> [mathjaxinline]\bullet[/mathjaxinline] information on the Binder community: <a href="https://mybinder.readthedocs.io/en/latest/" target="blank">Binder</a><br/></p><p><h3>Dependencies</h3></p><p>
The visualizations run on Python 3. Dependencies for running Python code locally (not through Binder) are stated in the git repository, and include (but are not limited to) the following:
<br/> [mathjaxinline]\bullet[/mathjaxinline] scipy
<br/> [mathjaxinline]\bullet[/mathjaxinline] numpy
<br/> [mathjaxinline]\bullet[/mathjaxinline] ipywidgets
<br/> [mathjaxinline]\bullet[/mathjaxinline] nbinteract
<br/> [mathjaxinline]\bullet[/mathjaxinline] matplotlib
<br/> [mathjaxinline]\bullet[/mathjaxinline] pandas
<br/> [mathjaxinline]\bullet[/mathjaxinline] IPython
<br/> [mathjaxinline]\bullet[/mathjaxinline] ffmpeg
<br/> [mathjaxinline]\bullet[/mathjaxinline] jupyter-contrib-nbextensions
<br/>
</p><p>
You will have to find resources that explain how to install these appropriately for your system, if they are not already installed with your Python package.
</p>
</div>
</div>
</div>
</div>