# Import some boilerplate libraries
%matplotlib inline
from IPython.display import Image
from IPython.html.widgets import interact
from numpy import pi, cos, sin
import numpy as np
import pylab as plt
import seaborn as sns

def plot_fringe(bl_length, wavelength, source_spacing):
    """ Plot the fringe function for a baseline with 2 sources (see Fig 1)

    bl_length:      distance between antennas, in m
    wavelength:     wavelength, in m
    source_spacing: distance between sources, in degrees
    """
    theta = np.linspace(-np.pi, np.pi, 401)
    l = sin(theta)
    l_spc = sin(source_spacing / 57.3)

    # first baseline
    F_src1_bl1 = cos(2 * pi * bl_length * l / wavelength)
    F_src2_bl1 = cos(2 * pi * bl_length * (l - l_spc) / wavelength)
    F_bl1 = F_src1_bl1 + F_src2_bl1

    # second baseline
    F_src1_bl2 = cos(2 * pi * 2 * bl_length * l / wavelength)
    F_src2_bl2 = cos(2 * pi * 2* bl_length * (l - l_spc) / wavelength)
    F_bl2 = F_src1_bl2 + F_src2_bl2

    plt.plot(l, F_bl1, c='#cc0000', label="Baseline 1-2")
    plt.plot(l, F_bl2, c='#0000cc', label="Baseline 1-3")
    plt.xlabel("$sin(\\theta)$")
    plt.ylabel("Fringe amplitude")
    plt.ylim(-2, 2)
    plt.legend()

f = interact(plot_fringe, bl_length=(1, 100), wavelength=(1, 100), source_spacing=(0, 90))

About Share Cell

This runs Jupyter kernels inside of Docker containers, through a temporary notebook system. The frontend exposed here is O'Reilly Media's Thebe.

There is no network access and operations are limited. If you find a bug, report it.

Hosting for the kernels is provided by developer.rackspace.com.