{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Populating the interactive namespace from numpy and matplotlib\n" ] } ], "source": [ "from ipywidgets import interact, interactive, FloatSlider, IntSlider, ToggleButtons\n", "from em_examples.TDEMInductiveSource import *\n", "%pylab inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Exploring fields from inductive sources" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Purpose\n", "\n", "We explore time-domain electromagnetic (EM) simulation results from inductive sources. Both electric currents and magnetic flux will be visualized to undertand physics of inductive source EM. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load simulation results (or run)\n", "\n", "Two inductive sources are considered:\n", "\n", "- Vertical magnetic dipole(VMD)\n", "- Horizontal magnetic dipole(HMD)\n", "\n", "Using below widget, you can choose a model that you want to explore. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "f397115717fc4ea9b400ca336d753df3", "version_major": 2, "version_minor": 0 }, "text/html": [ "

Failed to display Jupyter Widget of type interactive.

\n", "

\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "

\n", "

\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "

\n" ], "text/plain": [ "interactive(children=(ToggleButtons(description='src_type', options=('VMD', 'HMD'), value='VMD'), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "Q = interact(choose_source, \n", " src_type=ToggleButtons(\n", " options=[\"VMD\", \"HMD\"], value=\"VMD\"\n", " )\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then here we are going to load results. If you want to rerun, you can set `re_run` as `True`. \n", "With that option, you can change conductivity value of the block and halfspace you can alter a value for `sigma_halfspace`." ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "file already exists, new file is called /Users/sgkang/Projects/em_apps/notebooks/tdem_inductivesource.tar\n", "Downloading https://storage.googleapis.com/simpeg/em_examples/tdem_inductivesource/tdem_inductivesource.tar\n", " saved to: /Users/sgkang/Projects/em_apps/notebooks/tdem_inductivesource.tar\n", "Download completed!\n" ] } ], "source": [ "import matplotlib\n", "matplotlib.rcParams['font.size']=16\n", "options = load_or_run_results(\n", " re_run=False, \n", " fname=choose_source(Q.widget.kwargs['src_type']),\n", " src_type=Q.widget.kwargs['src_type'],\n", " sigma_halfspace=0.01\n", ")\n", "tdem = PlotTDEM(**options)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "98f00dd3bfcb4bb88ab7989c9386d7b5", "version_major": 2, "version_minor": 0 }, "text/html": [ "

Failed to display Jupyter Widget of type interactive.

\n", "

\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "

\n", "

\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "

\n" ], "text/plain": [ "interactive(children=(FloatSlider(value=30.0, description='elev', max=180.0, min=-180.0, step=10.0), FloatSlider(value=-45.0, description='azim', max=180.0, min=-180.0, step=10.0), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ ".>" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "interact(\n", " tdem.show_3d_survey_geometry, \n", " elev=FloatSlider(min=-180, max=180, step=10, value=30),\n", " azim=FloatSlider(min=-180, max=180, step=10, value=-45),\n", ")\n" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "65706f9e2d864622b6e7f8397cd6a1e5", "version_major": 2, "version_minor": 0 }, "text/html": [ "

Failed to display Jupyter Widget of type interactive.

\n", "

\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "

\n", "

\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "

\n" ], "text/plain": [ "interactive(children=(IntSlider(value=15, description='itime', max=50, min=15), ToggleButtons(description='scale', options=('linear', 'log'), value='linear'), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ ".>" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "interact(\n", " tdem.plot_input_currents, \n", " itime=IntSlider(min=15, max=50, step=1, value=15, contiusous_update=False),\n", " scale=ToggleButtons(\n", " options=[\"linear\", \"log\"], value=\"linear\"\n", " ),\n", " \n", ")" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "16ff6a13687d47958b764e16e876c677", "version_major": 2, "version_minor": 0 }, "text/html": [ "

Failed to display Jupyter Widget of type interactive.

\n", "

\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "

\n", "

\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "

\n" ], "text/plain": [ "interactive(children=(IntSlider(value=10, description='itime', max=50, min=10, step=2), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ ".>" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "interact(\n", " tdem.plot_electric_currents, \n", " itime=IntSlider(min=10, max=50, step=2, value=10, contiusous_update=False)\n", ")" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "2976a9e3653845c6a5aaed540eb38d63", "version_major": 2, "version_minor": 0 }, "text/html": [ "

Failed to display Jupyter Widget of type interactive.

\n", "

\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "

\n", "

\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "

\n" ], "text/plain": [ "interactive(children=(IntSlider(value=10, description='itime', max=50, min=10, step=2), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ ".>" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "interact(\n", " tdem.plot_magnetic_flux, \n", " itime=IntSlider(min=10, max=50, step=2, value=10, contiusous_update=False)\n", ")" ] } ], "metadata": { "anaconda-cloud": {}, "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.6.4" } }, "nbformat": 4, "nbformat_minor": 1 }