Skip to content

Commit

Permalink
Update exotic notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Dec 1, 2024
1 parent 9cabbd8 commit c024b5f
Showing 1 changed file with 69 additions and 17 deletions.
86 changes: 69 additions & 17 deletions stellarphot/notebooks/photometry/07-transit-fit-with-exotic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
"from pathlib import Path\n",
"import pickle\n",
"\n",
"import numpy as np\n",
"import numpy as np \n",
"\n",
"from astropy.table import Table\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.transit_fitting.gui import generate_json_file_name, exotic_arguments, get_values_from_widget, exotic_settings_widget, populate_TOI_boxes\n",
"from stellarphot.settings.fits_opener import FitsOpener\n",
"from stellarphot import PhotometryData\n",
"from stellarphot.io import TOI"
"from stellarphot.io import TOI\n",
"from stellarphot.gui_tools.photometry_widget_functions import TessAnalysisInputControls"
]
},
{
Expand All @@ -30,15 +31,49 @@
"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."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 0. Get some data\n",
"\n",
"+ Select photometry file with relative flux\n",
"+ Select passband\n",
"+ Select TESS info file"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fits_opener = FitsOpener(title=\"Select your photometry/relative flux file\", filter_pattern=[\"*.ecsv\"])\n",
"taic = TessAnalysisInputControls()\n",
"taic"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# 👉 File with photometry, including flux\n",
"photometry_file = taic.photometry_data_file\n",
"inp_photometry = taic.phot_data\n",
"\n",
"fits_opener.file_chooser"
"# 👉 File with exoplanet info in\n",
"tess_info_output_file = taic.tic_info_file\n",
"tess_info = TOI.model_validate_json(tess_info_output_file.read_text())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Get just the target star and some information about it"
]
},
{
Expand All @@ -47,10 +82,17 @@
"metadata": {},
"outputs": [],
"source": [
"input_data_file = fits_opener.path\n",
"toi_info_file = Path(\"TIC-194461202-info.json\")\n",
"\n",
"tess_info = TOI.model_validate_json(toi_info_file.read_text())"
"if np.isnan(inp_photometry['bjd']).all():\n",
" inp_photometry.add_bjd_col()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"photometry = inp_photometry.lightcurve_for(1, flux_column=\"relative_flux\", passband=taic.passband).remove_nans()"
]
},
{
Expand All @@ -70,12 +112,8 @@
"metadata": {},
"outputs": [],
"source": [
"inp_data = PhotometryData.read(input_data_file)\n",
"inp_data = inp_data[inp_data['star_id'] == 1]\n",
"inp_data.add_bjd_col()\n",
"# inp_data = inp_data[inp_data['BJD'] > 2459795.75]\n",
"\n",
"out_data = inp_data['bjd', 'relative_flux', 'relative_flux_error', 'airmass']\n",
"out_data = photometry['bjd', 'relative_flux', 'relative_flux_error', 'airmass']\n",
"out_data.write(exotic_data_file, overwrite=True)"
]
},
Expand All @@ -90,6 +128,13 @@
"populate_TOI_boxes(tess_info, settings.value_widget)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## YOU MAY NEED DATA FROM HERE: https://exofop.ipac.caltech.edu/tess/\n"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -145,9 +190,16 @@
"metadata": {},
"outputs": [],
"source": [
"!exotic --override --pre TIC_194461202-2024-10-08-SR.json"
"!exotic --override --pre TIC_370981403-2024-10-18-SG.json"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -158,7 +210,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "stelldev-pyd2",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -172,7 +224,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit c024b5f

Please sign in to comment.