{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import warnings\n", "warnings.filterwarnings('ignore')\n", "import numpy as np\n", "#picaso\n", "from picaso import justdoit as jdi\n", "from picaso import justplotit as jpi\n", "from bokeh.io import output_notebook\n", "output_notebook()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# How do I load in target properties from Exo.Mast? " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "nexsci = jdi.all_planets()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "nexsci.head()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "nexsci.loc[nexsci['hostname']=='HAT-P-26']" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#first isolate the row \n", "hatp26_row = nexsci.loc[nexsci['hostname']=='HAT-P-26']\n", "\n", "#add it to load planet function with opacity\n", "opa = jdi.opannection(wave_range=[1,5])\n", "hatp26 = jdi.load_planet(hatp26_row,opa , st_metfe=0)#hatp26 is misst st_metfe so we must add it as a keyword" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Load planet function adds in: \n", " - planet properties and stellar properties \n", " - parameterized PT profile \n", "\n", "That means you still need to add in the chemistry and cloud parameters" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "co=1.0#c/o ratio 1x solar\n", "logfeh = 1.5 #10^1.5 ~ 30x solar \n", "hatp26.chemeq_visscher(co,logfeh) #adds in template chemistry from sonora\n", "df = hatp26.spectrum(opa, calculation='transmission+thermal')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "x,y = jdi.mean_regrid(df['wavenumber'], df['fpfs_thermal'],R=150)\n", "plot = [jpi.spectrum(x,y,plot_width=400, y_axis_type='log',y_axis_label='FpFs')]\n", "x,y = jdi.mean_regrid(df['wavenumber'], df['transit_depth'],R=150)\n", "plot += [jpi.spectrum(x,y,plot_width=400,y_axis_label='(Rp/Rs)^2')]\n", "\n", "jpi.show(jpi.row(plot))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# How do I access the pressure-temperature profile parameterizations?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#start by loading in some template properties\n", "opa = jdi.opannection(wave_range=[1,5])\n", "hatp26_row = nexsci.loc[nexsci['hostname']=='HAT-P-26']\n", "hatp26 = jdi.load_planet(hatp26_row,opa, st_metfe=0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### How do the input parameters effect the parameterization?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig = [jpi.figure(width=300, height=300, y_axis_type='log', y_range=[100,1e-6],x_range=[400,1700],\n", " y_axis_label='Pressure(bars)',x_axis_label='Temperature (K)',\n", " title='Effect of logg1')]\n", "colors = jpi.pals.magma(10)\n", "for i, logg1 in enumerate(np.linspace(-2,2,10)):\n", " hatp26.guillot_pt(576.17, T_int=100, logg1=logg1, logKir=-1.5)\n", " fig[0].line(hatp26.inputs['atmosphere']['profile']['temperature'],\n", " hatp26.inputs['atmosphere']['profile']['pressure'],color=colors[i])\n", "\n", "fig += [jpi.figure(width=300, height=300, y_axis_type='log', y_range=[100,1e-6],x_range=[400,1700], \n", " x_axis_label='Temperature (K)',title='Effect of LogKir')]\n", "for i,logKir in enumerate(np.linspace(-2,2,10)):\n", " hatp26.guillot_pt(576.17, T_int=100, logg1=-2, logKir=logKir)\n", " fig[1].line(hatp26.inputs['atmosphere']['profile']['temperature'],\n", " hatp26.inputs['atmosphere']['profile']['pressure'], color=colors[i])\n", " \n", "fig += [jpi.figure(width=300, height=300, y_axis_type='log', y_range=[100,1e-6],x_range=[400,1700], \n", " x_axis_label='Temperature (K)',title='Effect of Tint')] \n", "for i,T_int in enumerate(np.linspace(50,300,10)):\n", " hatp26.guillot_pt(576.17, T_int=T_int, logg1=-2, logKir=-2)\n", " fig[2].line(hatp26.inputs['atmosphere']['profile']['temperature'],\n", " hatp26.inputs['atmosphere']['profile']['pressure'], color=colors[i])\n", "\n", "jpi.show(jpi.row(fig))\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# How do I return the output from photon attenuation plot? " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#first isolate the row \n", "hatp26_row = nexsci.loc[nexsci['hostname']=='HAT-P-26']\n", "\n", "#add it to load planet function with opacity\n", "opa = jdi.opannection(wave_range=[0.3,1])\n", "hatp26 = jdi.load_planet(hatp26_row,opa ,st_metfe=0)\n", "co = 1\n", "logfeh=2\n", "hatp26.chemeq_visscher(co,logfeh)\n", "df = hatp26.spectrum(opa, calculation='reflected',full_output=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot,wave,at_pressures_gas,at_pressures_cld,at_pressures_ray = jpi.photon_attenuation(df['full_output'],\n", " return_output=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#now you can make your own plot!\n", "fig = jpi.figure(y_axis_type='log',y_range=[10,1e-3],height=250, width=500)\n", "for i,iy,ilab in zip([0,1],[at_pressures_gas,at_pressures_ray ], ['Molecular','Rayleigh']):\n", " x,y = jpi.mean_regrid(1e4/wave,iy, R=150)\n", " fig.line(1e4/x,y,legend_label=ilab, line_width=4, color=jpi.Colorblind8[i])\n", "jpi.show(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Can I use the phase angle function to specify a non-zero phase for thermal emission? \n", "\n", "The phase angle function computes the incoming and outgoing angles. However, non-zero phase functionality is specific to __reflected light observations only__. This might be confusing because of course it is possible to observe thermal emission of planet at non-zero phase. However, unlike reflected light, thermal emission radiates from the planet in all directions (regardless of phase angle). \n", "\n", "__Do not force the code to run at non-zero phase angles for thermal emission.__ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# I'm confused about what opacity file to use\n", "\n", "Question: I'm confused about the opacity files. Version 1.0 (opacity.db) is the low res version that covers the \"useful\" wavelengths (0.3 to 14 micron) while version 2.0 has two files that cover the 0.6-6 micron at higher resolution and 4.8-15 micron. What should I download? And once I download it, where do I put them? If it's just the one file that seems straightforward in terms of where to put it but what happens when there are two files (or all 3) in the same folder?\n", "\n", "Answer: \n", "\n", "**What do I download?**\n", "\n", "The [low sampled files across a large wavelength range](https://zenodo.org/record/3759675#.Y8HVkezMLvU), which is on Zenodo as V1 is great for quick calculations that don't necessarily need to be accurate. For example: proposals, example models, any testing, retrievals on fake data. \n", "\n", "However, when comparing to real data, it's important to use higher sampling. [This tutorial](https://natashabatalha.github.io/picaso/notebooks/10_ResamplingOpacities.html) shows users estimated sampling errors. Therefore, it is important to have higher sampling files as well. The [higher sampling files are located here under V2](https://zenodo.org/record/6928501#.Y8HWH-zMLvU). \n", "\n", "So depending on your use case, the answer might be: download both! \n", "\n", "**Where do I put all the files?**\n", "\n", "`PICASO` uses the function [`justdoit.opannection`](https://natashabatalha.github.io/picaso/picaso.html#picaso.justdoit.opannection) to grab the opacity file located in the reference directory [`opacities`](https://github.com/natashabatalha/picaso/tree/master/reference/opacities). In the installation instructions you will notice there is a step to place the zenodo file here. Just for completeness, internally, we specify the name of this [file here](https://github.com/natashabatalha/picaso/blob/891343fcc41faa345f8b85aaa8d50c4939c421a3/reference/config.json#L91). \n", "\n", "The general recommendation is to keep one \"default\" file in your `reference/opacities` folder so that you do not need to worry about always specifying a file when running the code. Then assign one place, easy to locate, where you include the rest of the files. In order to access these will need to point to this file path using the `filename_db` keyword in `opannection`. \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Has your question not been answered? Feel free to contact us! \n", "\n", "Submit an issue on Github: https://github.com/natashabatalha/picaso/issues" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.11.5" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": true, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }