Skip to content

Commit

Permalink
HAT-P-7 b short cadence example
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorris3 committed Nov 13, 2023
1 parent e33729f commit 66d7767
Showing 1 changed file with 170 additions and 0 deletions.
170 changes: 170 additions & 0 deletions notebooks/example_HAT-P-7b.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "c0bbfab2-238f-4539-9a51-d6cb46fc067d",
"metadata": {},
"source": [
"# Short cadence observations of HAT-P-7 b\n",
"\n",
"HAT-P-7 b ([Pál et al. 2008](https://ui.adsabs.harvard.edu/abs/2008ApJ...680.1450P/abstract)) is a hot Jupiter orbiting a bright F6V host in the Kepler field. Let's take a look at short cadence (one-minute) Kepler observations from the first three Kepler quarters to see the secondary eclipse of the planet, when the planet's flux disappears as the planet is eclipsed by the host star.\n",
"\n",
"First we download the observations with `lightkurve`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3c6f5e23-f9d9-4577-b012-4f138f722e9a",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import astropy.units as u\n",
"from astropy.time import Time\n",
"from lightkurve import search_lightcurve\n",
"\n",
"from lcviz import LCviz\n",
"\n",
"# Download three quarters of short cadence observations from Kepler:\n",
"lc = search_lightcurve(\n",
" target=\"HAT-P-7\", \n",
" mission=\"Kepler\", \n",
" quarter=[1, 2, 3], \n",
" cadence=\"short\", \n",
" author=\"Kepler\"\n",
").download_all().stitch(\n",
" # stitch together the quarters after normalizing each one:\n",
" lambda x: x.normalize()\n",
")"
]
},
{
"cell_type": "markdown",
"id": "74d491b0-b59f-43bb-b24b-ba530d1185bb",
"metadata": {},
"source": [
"Now we'll start `LCviz`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "17261527-c741-4cc7-a08c-4df10a9daef6",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"lcviz = LCviz()\n",
"lcviz.show()"
]
},
{
"cell_type": "markdown",
"id": "210a6609-1a6c-42d0-81e3-696492a79e11",
"metadata": {},
"source": [
"Now load the data. This takes a moment because there are nearly 300,000 observations in the light curve:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "81ace88e-9d18-4b81-9634-cfbfac8983ce",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"lcviz.load_data(lc)"
]
},
{
"cell_type": "markdown",
"id": "46809b2d-1ef3-4eb6-9b13-69e91469e5ee",
"metadata": {},
"source": [
"Now let's phase-fold the observations with the ephemeris of the planet using the `Ephemeris` plugin:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2eec0609-f242-41d0-bc06-4a28177d541f",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# planet parameters from Morris et al. 2013:\n",
"# https://ui.adsabs.harvard.edu/abs/2013ApJ...764L..22M/abstract\n",
"\n",
"time_coordinates = lcviz.app.data_collection[0].coords\n",
"reference_time = time_coordinates.reference_time\n",
"\n",
"period = 2.204737 # days\n",
"epoch = Time(2454954.357463, format='jd')\n",
"\n",
"# phase-fold the transit light curve in an ephemeris viewer:\n",
"eph = lcviz.plugins['Ephemeris']\n",
"eph.period = period\n",
"eph.t0 = (\n",
" (epoch - reference_time).to_value(time_coordinates.unit) % eph.period\n",
")\n",
"\n",
"# offset the wrapping phase so the transit (at phase 0) displays at center\n",
"eph.wrap_at = 1"
]
},
{
"cell_type": "markdown",
"id": "c9b2bfe4-6b36-4fc6-bced-fb6062c35cf2",
"metadata": {},
"source": [
"We can easily see the secondary eclipse if we bin the phased observations with the `Binning` plugin, and adjust the axes:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0d97cbfa-162b-4204-80ec-fbe0c6dc8fab",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"binning = lcviz.plugins['Binning']\n",
"binning.n_bins = 150\n",
"binning.keep_active = True\n",
"binning.ephemeris = 'default'\n",
"\n",
"viewer = lcviz.app.get_viewer('flux-vs-phase:default')\n",
"viewer.state.y_min = 0.9995\n",
"viewer.state.y_max = 1.0005"
]
}
],
"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.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 66d7767

Please sign in to comment.