Skip to content

Commit

Permalink
Update 07 initially
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Nov 19, 2024
1 parent 309e322 commit 599a13a
Showing 1 changed file with 25 additions and 35 deletions.
60 changes: 25 additions & 35 deletions stellarphot/notebooks/photometry/07-transit-fit-with-exotic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -14,14 +14,11 @@
"\n",
"from astropy.table import Table\n",
"\n",
"from stellarphot.transit_fitting.gui.gui_core import (\n",
" exotic_arguments,\n",
" generate_json_file_name,\n",
" get_values_from_widget,\n",
" exotic_settings_widget,\n",
" populate_TOI_boxes,\n",
")\n",
"from stellarphot.settings.fits_opener import FitsOpener"
"#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"
]
},
{
Expand All @@ -39,11 +36,9 @@
"metadata": {},
"outputs": [],
"source": [
"fits_openr = FitsOpener(\n",
" title=\"Select your photometry/relative flux file\", filter_pattern=[\"*.csv\"]\n",
")\n",
"fits_opener = FitsOpener(title=\"Select your photometry/relative flux file\", filter_pattern=[\"*.ecsv\"])\n",
"\n",
"fits_openr.file_chooser"
"fits_opener.file_chooser"
]
},
{
Expand All @@ -52,11 +47,10 @@
"metadata": {},
"outputs": [],
"source": [
"input_data_file = fits_openr.path\n",
"toi_info_file = \"tess-info.pickle\"\n",
"input_data_file = fits_opener.path\n",
"toi_info_file = Path(\"TIC-194461202-info.json\")\n",
"\n",
"with open(toi_info_file, \"rb\") as f:\n",
" tess_info = pickle.load(f)"
"tess_info = TOI.model_validate_json(toi_info_file.read_text())"
]
},
{
Expand All @@ -67,7 +61,7 @@
"source": [
"settings = exotic_settings_widget()\n",
"\n",
"exotic_data_file = \"data_for_exotic.csv\""
"exotic_data_file = 'data_for_exotic.csv'"
]
},
{
Expand All @@ -76,12 +70,12 @@
"metadata": {},
"outputs": [],
"source": [
"inp_data = Table.read(input_data_file)\n",
"inp_data = inp_data[inp_data[\"star_id\"] == 1]\n",
"\n",
"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 = inp_data['bjd', 'relative_flux', 'relative_flux_error', 'airmass']\n",
"out_data.write(exotic_data_file, overwrite=True)"
]
},
Expand All @@ -91,8 +85,8 @@
"metadata": {},
"outputs": [],
"source": [
"settings.data_file_widget[\"candidate\"].value = exotic_data_file\n",
"settings.data_file_widget[\"known\"].value = exotic_data_file\n",
"settings.data_file_widget['candidate'].value = exotic_data_file\n",
"settings.data_file_widget['known'].value = exotic_data_file\n",
"populate_TOI_boxes(tess_info, settings.value_widget)"
]
},
Expand Down Expand Up @@ -121,7 +115,7 @@
"metadata": {},
"outputs": [],
"source": [
"Path(contents[\"user_info\"][\"Directory to Save Plots\"]).mkdir(exist_ok=True)"
"Path(contents['user_info']['Directory to Save Plots']).mkdir(exist_ok=True)"
]
},
{
Expand All @@ -130,7 +124,7 @@
"metadata": {},
"outputs": [],
"source": [
"with open(settings_name, \"w\") as f:\n",
"with open(settings_name, 'w') as f:\n",
" json.dump(contents, f)"
]
},
Expand All @@ -140,12 +134,8 @@
"metadata": {},
"outputs": [],
"source": [
"print(\n",
" \"COPY AND PASTE THE LINE BELOW INTO AN EMPTY CELL TO RUN EXOTIC (include the exclamation point at the beginning):\\n\\n\"\n",
")\n",
"print(\n",
" f'!exotic {\" \".join(exotic_arguments[settings.planet_type.value])} {settings_name}'\n",
")\n",
"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[settings.planet_type.value])} {settings_name}')\n",
"print(\"\\n\\n\")"
]
},
Expand All @@ -155,7 +145,7 @@
"metadata": {},
"outputs": [],
"source": [
"!exotic --override --pre TIC_402828941-2022-08-03-SI.json"
"!exotic --override --pre TIC_194461202-2024-10-08-SR.json"
]
},
{
Expand All @@ -168,7 +158,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "stelldev-pyd2",
"language": "python",
"name": "python3"
},
Expand All @@ -182,7 +172,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 599a13a

Please sign in to comment.