{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# High-Resolution Transmission Retrievals\n", "\n", "This tutorial covers how to run a retrieval with high-resolution ground-based transmission spectrum data using POSEIDON. \n", "\n", "Before you run this notebook, you should first run the [\\\"Ground-Based High-Resolution Transmission Spectroscopy (Cross Correlation)\\\"](transmission_high_res_cross_correlate.html) tutorial to preprocess the WASP-121b data. If you have data_processed.hdf5 saved in your planet directory, you are all set!" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Loading WASP-121b Transmission Data\n", "\n", "First, we will load the processed data for your planet (here, WASP-121b). For more information about this dataset and to learn the basics of high-resolution cross correlation spectroscopy, see the [\\\"Ground-Based High-Resolution Transmission Spectroscopy (Cross Correlation)\\\"](transmission_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-121b'\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=[\"blue\"]) # only use blue arm for faster retrieval\n", "data = read_high_res_data(data_dir, names=[\"blue\", \"redl\", \"redu\"])" ] }, { "attachments": {}, "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. The blue arm spans 0.37 microns to 0.51 microns. If you decide to use both blue and red arms, you should increase the range to 0.37 microns to 0.87 microns.\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 = 0.37 # Minimum wavelength (um)\n", "wl_max = 0.51 # Maximum wavelength (um) for blue arm\n", "wl_max = 0.87 # change to include red arm\n", "R = 250000 # Spectral resolution of grid \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 = 1.458 * R_Sun # Stellar radius (m)\n", "T_s = 6776 # Stellar effective temperature (K) \n", "Met_s = 0.13 # Stellar metallicity [log10(Fe/H_star / Fe/H_solar)] \n", "log_g_s = 4.24 # 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-121b\" # Planet name used for plots, output files etc.\n", "\n", "R_p = 1.753 * R_J # Planetary radius (m) \n", "M_p = 1.157 * 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\"]" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Existing literature have shown detection of $\\rm{Fe}$ in the atmosphere of WASP-121b. There are strong $\\rm{Fe}$ absorption features in the wavelength range as well.\n", "\n", "So for a first attempt, we consider a model with $\\rm{Fe}$, an isothermal temperature profile, and no clouds.\n", "\n", "For additional parameters used in high resolution retrieval, we include: $a$ (the scale parameter), $b$ (the scale parameter for noise), $K_p$ (the Keplerian orbital velocity), $V_{sys}$ (the systematic velocity), and $W_{conv}$ (width of the gaussian convolution kernel used for line broadening). You can opt to use the MLE estimator of $\\beta$ and not include it as a free parameter, which we are going to do here. [Gibson et al. 2022](https://ui.adsabs.harvard.edu/abs/2022MNRAS.512.4618G/abstract) contains a discussion on this choice. An additional parameter available is $\\Delta \\phi$, which offsets the ephemeris. However $\\Delta \\phi$ is very degenerate with $V_{sys}$ if the range of covered orbital phase is small.\n", "\n", "Be sure to reference [Gibson et al. 2022](https://ui.adsabs.harvard.edu/abs/2022MNRAS.512.4618G/abstract) if you want a more detailed description of these parameters." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Free parameters: ['R_p_ref' 'T' 'log_Fe' 'log_Cr' 'log_Mg' 'log_V' 'log_Ti' 'K_p' 'V_sys'\n", " 'W_conv' 'log_alpha_HR']\n" ] } ], "source": [ "# ***** Define model *****#\n", "\n", "model_name = \"High-res retrieval\" # Model name used for plots, output files etc.\n", "\n", "bulk_species = [\"H2\", \"He\"] # H2 + He comprises the bulk atmosphere\n", "param_species = [\"Fe\", \"Cr\", \"Mg\", \"V\", \"Ti\"] # Add more chemical species to the model here\n", "\n", "method = \"sysrem\"\n", "\n", "# Create the model object\n", "model = define_model(model_name, bulk_species, param_species,\n", " PT_profile = \"isotherm\", 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\"]))" ] }, { "attachments": {}, "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", "