Last active
December 5, 2019 14:52
-
-
Save j-faria/4f11fd5ed28323555c45d19e60ced882 to your computer and use it in GitHub Desktop.
The Keplerian and transit curves
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Two small demonstration notebooks of how the Keplerian and transit curves respond to a change in the parameters. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import numpy as np\n", | |
"from ipywidgets import interact, interactive\n", | |
"\n", | |
"# install pykima from here: https://github.com/j-faria/kima\n", | |
"from pykima.keplerian import keplerian" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"t = np.linspace(0, 10, 200)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def plot_keplerian(K=1, P=5, ecc=0., w=0., T0=0.):\n", | |
" fig, ax = plt.subplots(1, 1, figsize=(14, 10))\n", | |
" ax.plot(t, keplerian(t, P, K, ecc, w, T0, 0.0), lw=2)\n", | |
" ax.axhline(y=0, color='k', alpha=0.2)\n", | |
" ax.set(xlabel='Time [days]', ylabel='RV [m/s]')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.jupyter.widget-view+json": { | |
"model_id": "f1e66b95db2e44008b64a7fa9d28717f", | |
"version_major": 2, | |
"version_minor": 0 | |
}, | |
"text/plain": [ | |
"interactive(children=(FloatSlider(value=1.0, description='K', max=10.0, min=0.1), IntSlider(value=5, descripti…" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"w = interact(plot_keplerian, K=(0.1, 10.0), P=(1, 10), ecc=(0, 0.99, 0.05), w=(0, 2*np.pi, 0.1), T0=(0, 5, 0.1));" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"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.7.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment