{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# High-Resolution Emission Retrievals\n", "\n", "This tutorial covers how to run a retrieval with high-resolution ground-based emission data using POSEIDON. \n", "\n", "Before you run this notebook, you should run the [\\\"Ground-Based High-Resolution Emission Spectroscopy (Cross Correlation)\\\"](emission_high_res_cross_correlate.html) tutorial first to preprocess the data. If you have data_processed.hdf5 saved in your planet directory, you are all set!\n", "\n", "We will reproduce the result from [Brogi and Line 2019](https://ui.adsabs.harvard.edu/abs/2021Natur.598..580L/abstract), validating our framework on WASP-77Ab." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Loading WASP-77Ab Emission Data\n", "\n", "First, we will load the processed data for WASP-77 Ab. For more information about this dataset and to learn the basics of high-resolution cross correlation spectroscopy, see the [\\\"Ground-Based High-Resolution Emission Spectroscopy (Cross Correlation)\\\"](emission_high_res_cross_correlate.html) tutorial." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from POSEIDON.high_res import read_high_res_data\n", "\n", "planet_name = 'WASP-77Ab'\n", "\n", "data_dir = '../../../POSEIDON/reference_data/observations/' + planet_name # The directory where you've put the data\n", "\n", "data = read_high_res_data(data_dir, names=[\"IGRINS\"]) # We named the dataset IGRINS in the previous notebook" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating a Retrieval Model\n", "\n", "Now, let's provide the wavelength grid and properties of the host star and your planet. The wavelength range should match the range of your data, which spans 1.3 microns to 2.6 microns in this case.\n", "\n", "We use R=250,000 as a tradeoff between computational speed and accuracy. For more discussion, see the previous tutorial." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from POSEIDON.core import define_model, wl_grid_constant_R\n", "from POSEIDON.core import create_star, create_planet\n", "from POSEIDON.constants import R_Sun, R_J, M_J\n", "\n", "# ***** Wavelength grid *****#\n", "\n", "wl_min = 1.3 # Minimum wavelength (um)\n", "wl_max = 2.6 # Maximum wavelength (um)\n", "R = 250000 # Change the spectral resolution of grid here.\n", "\n", "# Create a wavelength grid with constant R\n", "wl = wl_grid_constant_R(wl_min, wl_max, R)\n", "\n", "# ***** Define stellar properties *****#\n", "\n", "R_s = 0.91 * R_Sun # Stellar radius (m)\n", "T_s = 5605.0 # Stellar effective temperature (K)\n", "Met_s = -0.04 # Stellar metallicity [log10(Fe/H_star / Fe/H_solar)]\n", "log_g_s = 4.48 # Stellar log surface gravity (log10(cm/s^2) by convention)\n", "\n", "star = create_star(R_s, T_s, log_g_s, Met_s, wl=wl, stellar_grid=\"phoenix\")\n", "\n", "# ***** Define planet properties *****#\n", "\n", "planet_name = \"WASP-77Ab\" # Planet name used for plots, output files etc.\n", "\n", "R_p = 1.21 * R_J # Planetary radius (m)\n", "M_p = 1.76 * M_J # Mass of planet (kg)\n", "\n", "# Create the planet object\n", "planet = create_planet(planet_name, R_p, mass=M_p)\n", "\n", "# If distance not specified, use fiducial value\n", "if planet[\"system_distance\"] is None:\n", " planet[\"system_distance\"] = 1 # This value only used for flux ratios, so it cancels\n", "d = planet[\"system_distance\"]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Existing literature have shown detection of $\\rm{H}_2\\rm{O}$, $\\rm{C}\\rm{O}$, $\\rm{N}\\rm{H}_3$, and $\\rm{C}\\rm{H}_4$ in the atmosphere of WASP-77Ab.\n", "\n", "So for a first attempt, we consider a model with $\\rm{H}_2\\rm{O}$, $\\rm{C}\\rm{O}$, $\\rm{N}\\rm{H}_3$, and $\\rm{C}\\rm{H}_4$, a 5-parameter temperature profile (Madhusudan & Seager 2009), and no clouds.\n", "\n", "For additional parameters used in high resolution retrieval, we include: $log_\\alpha$ (the scaling parameter), $K_p$ (the Keplerian orbital velocity), $V_{sys}$ (the systematic velocity), and $W_{conv}$ (width of the gaussian convolution kernel used for line broadening). An additional parameter available is $\\Delta \\phi$ (offseting the ephemeris)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Free parameters: ['R_p_ref' 'a1' 'a2' 'log_P1' 'log_P2' 'log_P3' 'T_ref' 'log_H2O' 'log_CO'\n", " 'log_NH3' 'log_CH4' 'K_p' 'V_sys' 'W_conv' 'log_alpha_HR']\n" ] } ], "source": [ "# ***** Define model *****#\n", "\n", "model_name = \"Retrieval\" # Model name used for plots, output files etc.\n", "bulk_species = [\"H2\", \"He\"] # H2 + He comprises the bulk atmosphere\n", "\n", "param_species = [\"H2O\", \"CO\", \"NH3\", \"CH4\"]\n", "\n", "model = define_model(model_name, bulk_species, param_species, \n", " PT_profile = \"Madhu\", reference_parameter = \"R_p_ref\",\n", " high_res_method = \"sysrem\", # Important! Should be the same as the method used to preprocess the data\n", " alpha_high_res_option = 'log', \n", " fix_alpha_high_res = False, fix_W_conv_high_res = False,\n", " fix_beta_high_res = True, fix_Delta_phi_high_res = True,\n", " )\n", "\n", "# Check the free parameters defining this model\n", "print(\"Free parameters: \" + str(model[\"param_names\"]))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setting Retrieval Priors\n", "\n", "One of the most important aspects in any Bayesian analysis is deciding what priors to use for the free parameters. Specifying a prior has two steps: (i) choosing the type of probability distribution; and (ii) choosing the allowable range.\n", "\n", "Most free parameters in atmospheric retrievals with POSEIDON use the following prior types:\n", "\n", "- Uniform: you provide the minimum and maximum values for the parameter.\n", "- Gaussian: you provide the mean and standard deviation for the parameter.\n", "\n", "