from rubidium.rubidium import Rubidium
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
from scipy.constants import c
rb = Rubidium(line=2)
T = 273.15 + 20 # Temperature in Kelvin
Lc = 0.075 # Length of cell in meters
delta = np.linspace(-4, 6, 200) # detuning in GHz
transdata = rb.Transmission(delta*1e9, T, Lc)
ndata = rb.Totaln(delta*1e9, T)
vg = rb.groupVelocity(delta,T)
transit = Lc/vg
timeshift = transit - Lc/c
plt.plot(delta, transdata)
plt.title("Rubidium D2 Spectrum at T= " + str(T) + " K")
plt.xlabel(r"Detuning $\Delta$ (GHz)")
plt.ylabel("Transmission")
<matplotlib.text.Text at 0x7f8264e13358>
plt.plot(delta, ndata)
plt.xlabel(r"Detuning $\Delta$ (GHz)")
plt.ylabel("Index n")
<matplotlib.text.Text at 0x7f8262694128>
plt.plot(delta[:-1], timeshift*1e9)
plt.plot([delta[0], delta[-2]], [0, 0], color='#888888', linestyle='--', linewidth=1)
plt.xlabel(r"Detuning $\Delta$ (GHz)")
plt.ylabel(r"T (ns)")
<matplotlib.text.Text at 0x7f82625bc128>