{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 🐷💫 Susie Package Astroplan Schedule Generation Example" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 🔵 Import the necessary python libraries and Susie objects." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Importing any packages and libraries needed, (Susie package coming directly from filesystem)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "from susie.timing_data import TimingData\n", "from susie.ephemeris import Ephemeris" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 🔵 Import Data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Download the timing data (that includes occultations) from the GitHub repository" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "url = 'https://raw.githubusercontent.com/BoiseStatePlanetary/susie/main/example_data/wasp12b_tra_occ.csv'\n", "\n", "# Read the CSV file directly from the URL\n", "data = pd.read_csv(url)\n", "tra_or_occs = np.array(data[\"tra_or_occ\"])\n", "epochs = np.array(data[\"epoch\"].astype('int'))\n", "mid_times = np.array(data[\"mid_time\"])\n", "mid_time_errs = np.array(data[\"mid_time_err\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 🔵 The Package" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 🔷 **STEP 1:** Add your transit and occultation data to the TimingData object." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Create new transit times object with above data\n", "timing_obj = TimingData('jd', epochs, mid_times, mid_time_uncertainties=mid_time_errs, tra_or_occ=tra_or_occs, time_scale='tdb')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 🔷 **STEP 2:** Create the Ephemeris object and add your TimingData object." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "ephemeris_obj = Ephemeris(timing_obj)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We'll use the quadratic model for this example. Get the model data dictionary from the ephemeris object." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "quad_model_data = ephemeris_obj.fit_ephemeris(\"quadratic\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we need two main objects to get the observing schedule\n", " 1. The Observer object, which is created using the observer's Earth location (with longitude, latitude, and elevation if known)\n", " 2. The Target object, which is created using the star's sky coordinates (with either the star's name or the right ascension and declination)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# Create observer object (at Boise State)\n", "observer_obj = ephemeris_obj.create_observer_obj(timezone=\"US/Mountain\", longitude=-116.208710, latitude=43.602,\n", " elevation=821, name=\"BoiseState\")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "# Create target object (WASP-12)\n", "target_obj = ephemeris_obj.create_target_obj(\"WASP-12\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can call get observing schedule. For this we will need\n", " 1. Model data dictionary from ouru desired ephemeris (we will use the quadratic ephemeris that we created above)\n", " 2. A timezone (we will use US/Mountain for Boise State time)\n", " 3. The observer object (created above)\n", " 4. The target object (created above)\n", " 5. The number of transits we want in our schedule\n", " 6. The number of occultations we want in our schedule\n", " 7. The observation start time, which will be the moment we start looking for observable transits/occultations\n", " 8. And one of the two:\n", " - The name of the exoplanet, which will be used to get an eclipse duration OR\n", " - The eclipse duration itself if the object is either not a known exoplanet or you want to customize this parameter" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING: Unrecognized unit: 'hour' for column pl_trandur. [astroquery.ipac.nexsci.nasa_exoplanet_archive.core]\n", "WARNING: Unrecognized unit: 'hour' for column pl_trandur.\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ingressegresstype
52024-01-09 20:13:13 -07002024-01-09 23:13:16 -0700occultation
62024-01-10 22:24:51 -07002024-01-11 01:24:55 -0700occultation
72024-01-12 00:36:30 -07002024-01-12 03:36:34 -0700occultation
02024-01-15 20:17:16 -07002024-01-15 23:17:19 -0700transit
12024-01-16 22:28:54 -07002024-01-17 01:28:58 -0700transit
22024-01-18 00:40:33 -07002024-01-18 03:40:37 -0700transit
82024-01-21 20:21:18 -07002024-01-21 23:21:22 -0700occultation
92024-01-22 22:32:57 -07002024-01-23 01:33:01 -0700occultation
102024-01-24 00:44:36 -07002024-01-24 03:44:39 -0700occultation
32024-01-27 20:25:21 -07002024-01-27 23:25:25 -0700transit
42024-01-28 22:37:00 -07002024-01-29 01:37:04 -0700transit
112024-02-02 20:29:24 -07002024-02-02 23:29:28 -0700occultation
\n", "
" ], "text/plain": [ " ingress egress type\n", "5 2024-01-09 20:13:13 -0700 2024-01-09 23:13:16 -0700 occultation\n", "6 2024-01-10 22:24:51 -0700 2024-01-11 01:24:55 -0700 occultation\n", "7 2024-01-12 00:36:30 -0700 2024-01-12 03:36:34 -0700 occultation\n", "0 2024-01-15 20:17:16 -0700 2024-01-15 23:17:19 -0700 transit\n", "1 2024-01-16 22:28:54 -0700 2024-01-17 01:28:58 -0700 transit\n", "2 2024-01-18 00:40:33 -0700 2024-01-18 03:40:37 -0700 transit\n", "8 2024-01-21 20:21:18 -0700 2024-01-21 23:21:22 -0700 occultation\n", "9 2024-01-22 22:32:57 -0700 2024-01-23 01:33:01 -0700 occultation\n", "10 2024-01-24 00:44:36 -0700 2024-01-24 03:44:39 -0700 occultation\n", "3 2024-01-27 20:25:21 -0700 2024-01-27 23:25:25 -0700 transit\n", "4 2024-01-28 22:37:00 -0700 2024-01-29 01:37:04 -0700 transit\n", "11 2024-02-02 20:29:24 -0700 2024-02-02 23:29:28 -0700 occultation" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ephemeris_obj.get_observing_schedule(quad_model_data, \"US/Mountain\", observer_obj, target_obj, \n", " 25, 25, \"2024-01-07\", \"WASP-12 b\")" ] } ], "metadata": { "kernelspec": { "display_name": "docs_env", "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.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }