{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Two-Level: Sech Pulse 2π — Self-Induced Transparency" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define the Problem\n", "\n", "First we need to define a sech pulse with the area we want. We'll fix the width of the pulse and the area to find the right amplitude.\n", "\n", "The full-width at half maximum (FWHM) $t_s$ of the sech pulse is related to the FWHM of a Gaussian by a factor of $1/2.6339157938$. (See §3.2.2 of my [PhD thesis](https://github.com/tpogden/phd-thesis))." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "SECH_FWHM_CONV = 1.0 / 2.6339157938\n", "t_width = 1.0 * SECH_FWHM_CONV # [τ]\n", "print(\"t_width\", t_width)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mb_solve_json = \"\"\"\n", "{\n", " \"atom\": {\n", " \"fields\": [\n", " {\n", " \"coupled_levels\": [[0, 1]],\n", " \"rabi_freq_t_args\": {\n", " \"n_pi\": 2.0,\n", " \"centre\": 0.0,\n", " \"width\": %f\n", " },\n", " \"rabi_freq_t_func\": \"sech\"\n", " }\n", " ],\n", " \"num_states\": 2\n", " },\n", " \"t_min\": -2.0,\n", " \"t_max\": 10.0,\n", " \"t_steps\": 120,\n", " \"z_min\": -0.5,\n", " \"z_max\": 1.5,\n", " \"z_steps\": 100,\n", " \"interaction_strengths\": [\n", " 10.0\n", " ],\n", " \"savefile\": \"mbs-two-sech-2pi\"\n", "}\n", "\"\"\" % (t_width)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from maxwellbloch import mb_solve\n", "\n", "mb_solve_00 = mb_solve.MBSolve().from_json_str(mb_solve_json)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We'll just check that the pulse area is what we want." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\n", " \"The input pulse area is {0}\".format(\n", " np.trapezoid(mb_solve_00.Omegas_zt[0, 0, :].real, mb_solve_00.tlist) / np.pi\n", " )\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Solve the Problem" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%time Omegas_zt, states_zt = mb_solve_00.mbsolve(recalc=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot Output" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", "%matplotlib inline\n", "import numpy as np\n", "import seaborn as sns\n", "\n", "sns.set_style(\"darkgrid\")\n", "\n", "fig = plt.figure(1, figsize=(16, 6))\n", "ax = fig.add_subplot(111)\n", "cmap_range = np.linspace(0.0, 1.0, 11)\n", "cf = ax.contourf(\n", " mb_solve_00.tlist,\n", " mb_solve_00.zlist,\n", " np.abs(mb_solve_00.Omegas_zt[0] / (2 * np.pi)),\n", " cmap_range,\n", " cmap=plt.cm.Blues,\n", ")\n", "ax.set_title(r\"Rabi Frequency ($\\Gamma / 2\\pi $)\")\n", "ax.set_xlabel(r\"Time ($1/\\Gamma$)\")\n", "ax.set_ylabel(\"Distance ($L$)\")\n", "for y in [0.0, 1.0]:\n", " ax.axhline(y, c=\"grey\", lw=1.0, ls=\"dotted\")\n", "plt.colorbar(cf);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig, ax = plt.subplots(figsize=(16, 4))\n", "ax.plot(mb_solve_00.zlist, mb_solve_00.fields_area()[0] / np.pi, clip_on=False)\n", "ax.set_ylim([0.0, 8.0])\n", "ax.set_xlabel(\"Distance ($L$)\")\n", "ax.set_ylabel(r\"Pulse Area ($\\pi$)\");" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Analysis\n", "\n", "The $2 \\pi$ sech pulse passes through, slowed but with shape unaltered. This is **self-induced transparency.**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Movie" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# C = 0.1 # speed of light\n", "# Y_MIN = 0.0 # Y-axis min\n", "# Y_MAX = 4.0 # y-axis max\n", "# ZOOM = 2 # level of linear interpolation\n", "# FPS = 30 # frames per second\n", "# ATOMS_ALPHA = 0.2 # Atom indicator transparency" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# FNAME = \"images/mb-solve-two-sech-2pi\"\n", "# FNAME_JSON = FNAME + '.json'\n", "# with open(FNAME_JSON, \"w\") as f:\n", "# f.write(mb_solve_json)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# !make-mp4-fixed-frame.py -f $FNAME_JSON -c $C --fps $FPS --y-min $Y_MIN --y-max $Y_MAX \\\n", "# --zoom $ZOOM --atoms-alpha $ATOMS_ALPHA #--peak-line --c-line" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# FNAME_MP4 = FNAME + '.mp4'\n", "# !make-gif-ffmpeg.sh -f $FNAME_MP4 --in-fps $FPS" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# from IPython.display import Image\n", "# Image(url=FNAME_MP4 +'.gif', format='gif')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }