Two-Level: Gaussian Pulse 1.8π
[1]:
mb_solve_json = """
{
"atom": {
"fields": [
{
"coupled_levels": [[0, 1]],
"rabi_freq_t_args": {
"n_pi": 1.8,
"centre": 0.0,
"fwhm": 1.0
},
"rabi_freq_t_func": "gaussian"
}
],
"num_states": 2
},
"t_min": -2.0,
"t_max": 10.0,
"t_steps": 120,
"z_min": -0.5,
"z_max": 1.5,
"z_steps": 100,
"interaction_strengths": [
10.0
],
"savefile": "mbs-two-gaussian-1.8pi"
}
"""
[2]:
from maxwellbloch import mb_solve
mbs = mb_solve.MBSolve().from_json_str(mb_solve_json)
[3]:
import numpy as np
[4]:
# Check the input pulse area is correct
print(
"The input pulse area is {0:.3f}".format(
np.trapezoid(mbs.Omegas_zt[0, 0, :].real, mbs.tlist) / np.pi
)
)
The input pulse area is 1.800
Solve the Problem
[5]:
Omegas_zt, states_zt = mbs.mbsolve(recalc=False)
/home/docs/checkouts/readthedocs.org/user_builds/maxwellbloch/envs/v0.8.1/lib/python3.11/site-packages/qutip/fileio.py:253: VisibleDeprecationWarning: dtype(): align should be passed as Python or NumPy boolean but got `align=0`. Did you mean to pass a tuple to create a subarray type? (Deprecated NumPy 2.4)
out = pickle.load(fileObject, encoding='latin1')
Plot Output
[6]:
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set_style("darkgrid")
fig = plt.figure(1, figsize=(16, 6))
ax = fig.add_subplot(111)
cmap_range = np.linspace(0.0, 1.0, 11)
cf = ax.contourf(
mbs.tlist,
mbs.zlist,
np.abs(mbs.Omegas_zt[0] / (2 * np.pi)),
cmap_range,
cmap=plt.cm.Blues,
)
ax.set_title(r"Rabi Frequency ($\Gamma / 2\pi $)")
ax.set_xlabel(r"Time ($1/\Gamma$)")
ax.set_ylabel("Distance ($L$)")
for y in [0.0, 1.0]:
ax.axhline(y, c="grey", lw=1.0, ls="dotted")
plt.colorbar(cf);
[7]:
fig, ax = plt.subplots(figsize=(16, 4))
ax.plot(mbs.zlist, mbs.fields_area()[0] / np.pi, clip_on=False)
ax.set_ylim([0.0, 8.0])
ax.set_xlabel("Distance ($L$)")
ax.set_ylabel(r"Pulse Area ($\pi$)");
Movie
[8]:
# FNAME = "mb-solve-two-gaussian-0.8pi"
[9]:
# z_steps was 200 for movie
[10]:
# C = 0.1 # speed of light
# Y_MIN = 0.0 # Y-axis min
# Y_MAX = 4.0 # y-axis max
# ZOOM = 2 # level of linear interpolation
# FPS = 30 # frames per second
# ATOMS_ALPHA = 0.2 # Atom indicator transparency
[11]:
# FNAME_IMG = "images/" + FNAME
# FNAME_JSON = FNAME_IMG + '.json'
# with open(FNAME_JSON, "w") as f:
# f.write(mb_solve_json)
[12]:
# !make-mp4-fixed-frame.py -f $FNAME_JSON -c $C --fps $FPS --y-min $Y_MIN --y-max $Y_MAX \
# --zoom $ZOOM --atoms-alpha $ATOMS_ALPHA #--peak-line --c-line
[13]:
# FNAME_MP4 = FNAME_IMG + '.mp4'
# !make-gif-ffmpeg.sh -f $FNAME_MP4 --in-fps $FPS
[14]:
# from IPython.display import Image
# Image(url=FNAME_MP4+'.gif', format='gif')