{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Light travel time delay\n", "\n", "A simple example showing the effects of light travel time delay on an edge-on planet in an orbit similar to that of Earth." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "hide_input" ] }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "hide_input" ] }, "outputs": [], "source": [ "%run notebook_setup.py" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import starry\n", "from astropy import units as u\n", "\n", "starry.config.lazy = True\n", "starry.config.quiet = True" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "star = starry.Primary(starry.Map(udeg=2, amp=1.0), m=1.0, r=1.0)\n", "star.map[1:] = [0.5, 0.25]\n", "planet = starry.Secondary(\n", " starry.Map(1, amp=0.0025), porb=365.25, r=0.1, prot=365.25, m=0.0, t0=0.0\n", ")\n", "planet.map[1, 0] = 0.5" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sys1 = starry.System(star, planet, light_delay=False)\n", "sys2 = starry.System(star, planet, light_delay=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Compute the delay in the zero-crossing\n", "t = np.linspace(-0.01, 0.01, 999)\n", "t1 = t[np.argmin(np.abs(sys1.position(t)[0][1].eval()))]\n", "t2 = t[np.argmin(np.abs(sys2.position(t)[0][1].eval()))]\n", "diff = (t1 - t2) * u.day.to(u.minute)\n", "\n", "# Plot the transits\n", "t = np.linspace(-0.5, 0.5, 20000)\n", "fig = plt.figure(figsize=(8, 3))\n", "plt.plot(t, sys1.flux(t).eval() - 1, label=\"no delay\")\n", "plt.plot(t, sys2.flux(t).eval() - 1, label=\"with delay\")\n", "plt.xlabel(\"time [days]\")\n", "plt.ylabel(\"relative flux\")\n", "plt.legend(fontsize=10, loc=\"lower right\")\n", "plt.title(\"Light delay causes transits to occur %.2f minutes early\" % diff, fontsize=14);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Compute the delay in the zero-crossing\n", "t = np.linspace(planet.porb.eval() / 2 - 0.01, planet.porb.eval() / 2 + 0.01, 999)\n", "t1 = t[np.argmin(np.abs(sys1.position(t)[0][1].eval()))]\n", "t2 = t[np.argmin(np.abs(sys2.position(t)[0][1].eval()))]\n", "diff = (t2 - t1) * u.day.to(u.minute)\n", "\n", "t = np.linspace(planet.porb.eval() / 2 - 0.5, planet.porb.eval() / 2 + 0.5, 20000)\n", "fig = plt.figure(figsize=(8, 3))\n", "plt.plot(t, sys1.flux(t).eval() - 1, label=\"no delay\")\n", "plt.plot(t, sys2.flux(t).eval() - 1, label=\"with delay\")\n", "plt.xlabel(\"time [days]\")\n", "plt.ylabel(\"relative flux\")\n", "plt.legend(fontsize=10, loc=\"lower right\")\n", "plt.title(\"Light delay causes eclipses to occur %.2f minutes late\" % diff, fontsize=14);" ] } ], "metadata": { "celltoolbar": "Tags", "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.4" } }, "nbformat": 4, "nbformat_minor": 2 }