Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple ephemerides for RR Lyrae #3

Merged
merged 4 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
184 changes: 184 additions & 0 deletions mult_ephem_RR-Lyr.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
"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",
"* **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:"
]
},
{
"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.rename_component('default', '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
}