from ipywidgets import StaticInteract, RangeWidget, RadioWidget
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
var = 1
def plot(a):
fig, ax = plt.subplots(figsize=(4, 3),subplot_kw={'axisbg':'#EEEEEE','axisbelow':True})
ax.grid(color='w', linewidth=2, linestyle='solid')
x = np.linspace(-2, 2, 201)
y = np.sinc((x+a)/var)**2 + np.sinc((x-a)/var)**2
ax.plot(x, y, lw=5, alpha=0.4)
return fig
StaticInteract(plot,a=RangeWidget(0, 2, 0.1))
from ipywidgets import StaticInteract, RangeWidget, RadioWidget
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
var = 5
def plot(a):
fig, ax = plt.subplots(figsize=(4, 3),subplot_kw={'axisbg':'#EEEEEE','axisbelow':True})
#ax.grid(color='w', linewidth=2, linestyle='solid')
#x = np.linspace(-2, 2, 201)
image = np.zeros([10,10])
for i in xrange(len(image)):
for j in xrange(len(image)):
image[i,j] = (np.sinc((i-4.5-a)/var)**2)*(np.sinc((j-4.5)/var)**2) + (np.sinc((i-4.5+a)/var)**2)*(np.sinc((j-4.5)/var)**2)
# y = np.sinc((x+a)/var)**2 + np.sinc((x-a)/var)**2
# ax.plot(x, y, lw=5, alpha=0.4)
ax.imshow(image)
return fig
StaticInteract(plot,a=RangeWidget(1, 5, 1))
from ipywidgets import StaticInteract, RangeWidget, RadioWidget
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
var = 5
def plot(a,b):
fig, ax = plt.subplots(figsize=(4, 3),subplot_kw={'axisbg':'#EEEEEE','axisbelow':True})
#ax.grid(color='w', linewidth=2, linestyle='solid')
#x = np.linspace(-2, 2, 201)
image = np.zeros([10,10])
for i in xrange(len(image)):
for j in xrange(len(image)):
image[i,j] = (np.sinc((i-4.5-a)/var)**2)*(np.sinc((j-4.5-b)/var)**2) + (np.sinc((i-4.5+a)/var)**2)*(np.sinc((j-4.5+b)/var)**2)
# y = np.sinc((x+a)/var)**2 + np.sinc((x-a)/var)**2
# ax.plot(x, y, lw=5, alpha=0.4)
ax.imshow(image)
return fig
StaticInteract(plot,a=RangeWidget(0.5, 2.5, 0.5),b=RangeWidget(0.5, 2.5, 0.5))