Skip to content

Commit

Permalink
Merge pull request #79 from mwcraig/add-exotic-notebook
Browse files Browse the repository at this point in the history
Add exotic notebook
  • Loading branch information
mwcraig authored Nov 6, 2022
2 parents 5d47eb3 + 0cbe678 commit 407d9a5
Showing 1 changed file with 153 additions and 0 deletions.
153 changes: 153 additions & 0 deletions stellarphot/notebooks/photometry/08-transit-fit-with-exotic.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"from pathlib import Path\n",
"\n",
"import numpy as np \n",
"\n",
"from astropy.table import Table \n",
"\n",
"#from try_json_editing_rev1 import whole_thing, generate_json_file_name, exotic_arguments, get_values_from_widget\n",
"from stellarphot.analysis.exotic import generate_json_file_name, exotic_arguments, get_values_from_widget, exotic_settings_widget"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Instructions and Overview\n",
"\n",
"This notebook will do a different kind of fit to your exoplanet data. It takes longer to run than the fitting we've done so far, which is why we didn't begin with this type of fit.\n",
"\n",
"## You will need the 9-digit \"TIC\" number for your exoplanete candidate"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"settings = exotic_settings_widget()\n",
"\n",
"exotic_data_file = 'data_for_exotic.csv'\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"inp_data = Table.read('recalculated-flux-kelt-1b-2021-09-14.fits')\n",
"inp_data = inp_data[inp_data['star_id'] == 1]\n",
"\n",
"# inp_data = inp_data[inp_data['relative_flux'] < 0.05]\n",
"\n",
"out_data = inp_data['BJD', 'relative_flux', 'relative_flux_error', 'airmass']\n",
"out_data.write(exotic_data_file, overwrite=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"settings.data_file_widget['candidate'].value = exotic_data_file\n",
"settings.data_file_widget['known'].value = exotic_data_file\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"settings"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"whole_thing = settings\n",
"settings_name = generate_json_file_name(whole_thing.planet_type.value)\n",
"contents = get_values_from_widget(whole_thing.planet_type.value)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Path(contents['user_info']['Directory to Save Plots']).mkdir(exist_ok=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with open(settings_name, 'w') as f:\n",
" json.dump(contents, f)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print('COPY AND PASTE THE LINE BELOW INTO AN EMPTY CELL TO RUN EXOTIC (include the exclamation point at the beginning):\\n\\n')\n",
"print(f'!exotic {\" \".join(exotic_arguments[whole_thing.planet_type.value])} {settings_name}')\n",
"print(\"\\n\\n\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"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.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

0 comments on commit 407d9a5

Please sign in to comment.