Acoustics equations in 1 dimension


In [1]:
%pylab inline

In [2]:
from matplotlib import pyplot as plt
from ipywidgets import interact, interact_manual
import ipywidgets

In [3]:
import clawpack
clawpack.__file__

In [4]:
import sys, os
CLAW = [p for p in sys.path if 'clawpack' in p][0]
print 'Setting CLAW = ',CLAW

In [18]:
claw_env = os.environ
claw_env['CLAW'] = CLAW

In [5]:
from clawpack.clawutil import nbtools

In [19]:
nbtools.make_htmls(env=claw_env)

In [20]:
nbtools.make_exe(new=True,env=claw_env)

In [22]:
nbtools.make_data(env=claw_env)

In [21]:
# Run the code with the original parameter settings
outdir,plotdir = nbtools.make_output_and_plots(env=claw_env, verbose=True)

<plot_output.txt>

Display the time frame plots with an interactive slider:


In [8]:
import glob, os
images = []
files = glob.glob('_plots/frame*png')
for file in files:
    im = plt.imread(file)
    images.append(im)

def imshow_noaxes(im, figsize=(8,6)):
    plt.figure(figsize=figsize)
    ax = plt.axes()
    plt.imshow(im)
    ax.axis('off')

def display_frame(frameno):
    imshow_noaxes(images[frameno])

In [14]:
interact(display_frame, frameno=ipywidgets.IntSlider(min=0,max=len(images)-1, value=0))

In [ ]: