From 881786cf2ff382bd7b60c3deec424419bd4d6d86 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Wed, 6 Dec 2023 15:45:12 -0500 Subject: [PATCH 1/4] Multiple ephemerides for RR Lyrae --- mult_ephem_RR-Lyr.ipynb | 181 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 mult_ephem_RR-Lyr.ipynb diff --git a/mult_ephem_RR-Lyr.ipynb b/mult_ephem_RR-Lyr.ipynb new file mode 100644 index 0000000..c223123 --- /dev/null +++ b/mult_ephem_RR-Lyr.ipynb @@ -0,0 +1,181 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "c0bbfab2-238f-4539-9a51-d6cb46fc067d", + "metadata": {}, + "source": [ + "# RR Lyrae\n", + "\n", + "[RR Lyrae](https://en.wikipedia.org/wiki/RR_Lyrae) is the prototype of a class of variable stars with radial pulsations. The pulsation period is related to the stellar luminosity, and a second, lower frequency variation can be seen on longer timescales, known as the [Blazkho effect](https://en.wikipedia.org/wiki/Blazhko_effect). \n", + "\n", + "RR Lyrae itself was in the Kepler field, so let's load one Kepler Quarter of long-cadence observations, and inspect the periods:" + ] + }, + { + "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 long cadence observations from Kepler:\n", + "lc = search_lightcurve(\n", + " target=\"RR Lyra\", \n", + " mission=\"Kepler\", \n", + " quarter=2, \n", + " cadence=\"long\", \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": "96da5408-26ab-4823-b85f-4a1992c1c7dc", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "lcviz = LCviz()\n", + "\n", + "lcviz.load_data(lc)\n", + "\n", + "# we'll make use of these plugins later:\n", + "eph = lcviz.plugins['Ephemeris']\n", + "plot_options = lcviz.plugins['Plot Options']\n", + "freq_analysis = lcviz.plugins['Frequency Analysis']\n", + "freq_analysis.auto_range = False\n", + "freq_analysis.xunit.selected = 'period'\n", + "\n", + "lcviz.show()" + ] + }, + { + "cell_type": "markdown", + "id": "ab983eb0-6da0-45ee-a343-edfa1155f384", + "metadata": {}, + "source": [ + "Compute the peak power at periods near 13 hours using the `Frequency Analysis` plugin, and use the `Ephemeris` plugin to add a new viewer that's phase-folded at the pulsation period:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "17261527-c741-4cc7-a08c-4df10a9daef6", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# compute pulsation period:\n", + "freq_analysis.minimum = 0.1\n", + "freq_analysis.maximum = 1.0\n", + "ls = freq_analysis.periodogram\n", + "period_pulsation = 1 / ls.frequency[ls.power.argmax()]\n", + "\n", + "# update Ephemeris:\n", + "eph.component.add_choice('pulsation')\n", + "eph.period = period_pulsation.to_value(u.d)\n", + "eph.t0 = 0.26\n", + "\n", + "print(f\"Pulsation period: {period_pulsation:.3f}\")" + ] + }, + { + "cell_type": "markdown", + "id": "d0132512-d62e-45bb-9b25-61d9e3664f45", + "metadata": {}, + "source": [ + "Compute the peak power at periods near 36 days using the `Frequency Analysis` plugin, and add an `Ephemeris` component for the Blazkho effect:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2bcb8d93-e9d0-4219-9539-d797099a172d", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# compute Blazkho period:\n", + "freq_analysis.minimum = 20.0\n", + "freq_analysis.maximum = 55.0\n", + "ls = freq_analysis.periodogram\n", + "period_blazkho = 1 / ls.frequency[ls.power.argmax()]\n", + "\n", + "# update Ephemeris:\n", + "eph.add_component('blazkho')\n", + "eph.period = period_blazkho.to_value(u.d)\n", + "eph.t0 = 23\n", + "\n", + "print(f\"Blazkho period: {period_blazkho:.3f}\")" + ] + }, + { + "cell_type": "markdown", + "id": "087ffb91-d24e-49e7-ba9a-14c6df0510ce", + "metadata": {}, + "source": [ + "Color each point in the light curve in each viewer by the phase of the Blazkho effect, using the `Plot Options` plugin:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "39108e3e-b84c-4c21-9861-007f3a0ab2da", + "metadata": {}, + "outputs": [], + "source": [ + "for viewer in lcviz.app.get_viewer_reference_names():\n", + " plot_options.viewer = viewer\n", + " plot_options.layer = lcviz.app.data_collection[0].label\n", + " plot_options.marker_color_mode = 'Linear'\n", + " plot_options.marker_colormap = 'Viridis'\n", + " plot_options._obj.marker_color_col_value = 'phase:blazkho'" + ] + } + ], + "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 +} From 5ef3e5d6397d6d01a2ee496a284007dba9c9f472 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Wed, 6 Dec 2023 15:57:06 -0500 Subject: [PATCH 2/4] add version header --- mult_ephem_RR-Lyr.ipynb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mult_ephem_RR-Lyr.ipynb b/mult_ephem_RR-Lyr.ipynb index c223123..e82f39c 100644 --- a/mult_ephem_RR-Lyr.ipynb +++ b/mult_ephem_RR-Lyr.ipynb @@ -9,6 +9,9 @@ "\n", "[RR Lyrae](https://en.wikipedia.org/wiki/RR_Lyrae) is the prototype of a class of variable stars with radial pulsations. The pulsation period is related to the stellar luminosity, and a second, lower frequency variation can be seen on longer timescales, known as the [Blazkho effect](https://en.wikipedia.org/wiki/Blazhko_effect). \n", "\n", + "* **Last Updated**: Dec 6, 2023\n", + "* **lcviz version**: unreleased (Dec 6, 2023)\n", + "\n", "RR Lyrae itself was in the Kepler field, so let's load one Kepler Quarter of long-cadence observations, and inspect the periods:" ] }, From c7fe4fc40983f6e62e17ce1c7e3c31d561fc6432 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Wed, 6 Dec 2023 16:02:53 -0500 Subject: [PATCH 3/4] add to index --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b49ba7..a519c94 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,29 @@ Demo notebooks for [lcviz](https://github.com/spacetelescope/lcviz). These note ## Plugins +#### Plot Options + +* [RR-Lyrae](mult_ephem_RR-Lyr.ipynb) + #### Flattening * [KIC 2835289](mult_ephem_kic_2835289.ipynb) +#### Frequency Analysis + +* [RR-Lyrae](mult_ephem_RR-Lyr.ipynb) #### Ephemeris / Phase-Folding * [KIC 2835289](mult_ephem_kic_2835289.ipynb) - +* [RR-Lyrae](mult_ephem_RR-Lyr.ipynb) ## Science Topics #### Eclipsing Binaries * [KIC 2835289](mult_ephem_kic_2835289.ipynb) + +#### Pulsating Stars + +* [RR-Lyrae](mult_ephem_RR-Lyr.ipynb) From cf6e5c82a14a9032e3914e7e89d0e139664eed7a Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Fri, 8 Dec 2023 10:06:20 -0500 Subject: [PATCH 4/4] Update mult_ephem_RR-Lyr.ipynb Co-authored-by: Kyle Conroy --- mult_ephem_RR-Lyr.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mult_ephem_RR-Lyr.ipynb b/mult_ephem_RR-Lyr.ipynb index e82f39c..779cd70 100644 --- a/mult_ephem_RR-Lyr.ipynb +++ b/mult_ephem_RR-Lyr.ipynb @@ -98,7 +98,7 @@ "period_pulsation = 1 / ls.frequency[ls.power.argmax()]\n", "\n", "# update Ephemeris:\n", - "eph.component.add_choice('pulsation')\n", + "eph.rename_component('default', 'pulsation')\n", "eph.period = period_pulsation.to_value(u.d)\n", "eph.t0 = 0.26\n", "\n",