Skip to content

Commit

Permalink
Minor updates to relative flux notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Nov 20, 2024
1 parent 599a13a commit 8e31f29
Showing 1 changed file with 22 additions and 54 deletions.
76 changes: 22 additions & 54 deletions stellarphot/notebooks/photometry/05-relative-flux-calculation-template.ipynb
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"\n",
"import numpy as np\n",
"\n",
"from stellarphot.differential_photometry.aij_rel_fluxes import *\n",
"from stellarphot.differential_photometry.aij_rel_fluxes import calc_aij_relative_flux\n",
"from stellarphot.settings.fits_opener import FitsOpener\n",
"from stellarphot import PhotometryData, SourceListData"
]
Expand Down Expand Up @@ -79,15 +79,6 @@
"output_file = photometry_file.stem + \"-relative-flux\" + photometry_file.suffix"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"photometry_file"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -96,10 +87,7 @@
},
"outputs": [],
"source": [
"\n",
"photometry = PhotometryData.read(photometry_file)\n",
"del_rows = photometry[\"file\"] == \"image_file.fits\"\n",
"photometry = photometry[~del_rows]"
"photometry = PhotometryData.read(photometry_file)"
]
},
{
Expand All @@ -113,17 +101,6 @@
"comp_table = SourceListData.read(aperture_file)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"comp_table"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -133,38 +110,13 @@
"outputs": [],
"source": [
"comp_table[\"coord\"] = SkyCoord(\n",
" ra=comp_table[\"ra\"], dec=comp_table[\"dec\"], unit=\"degree\", frame=\"icrs\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" ra=comp_table[\"ra\"], dec=comp_table[\"dec\"], frame=\"icrs\"\n",
")\n",
"comp_bool = comp_table[\"marker name\"] == [\"APASS comparison\"]\n",
"only_comp_stars = comp_table[comp_bool]\n",
"coords = only_comp_stars[\"coord\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"ra = [i.ra for i in coords]\n",
"dec = [i.dec for i in coords]\n",
"comp_coords = Table()\n",
"comp_coords[\"ra\"] = ra * u.degree\n",
"comp_coords[\"dec\"] = dec * u.degree"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -181,7 +133,23 @@
"outputs": [],
"source": [
"# calculate flux\n",
"flux_table = calc_aij_relative_flux(photometry, comp_coords)"
"flux_table = calc_aij_relative_flux(photometry, only_comp_stars)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if \"bjd\" not in flux_table.colnames:\n",
" flux_group = flux_table.group_by(\"file\")\n",
" # Add dummy BJD column so the whole table has one\n",
" flux[\"bjd\"] = np.nan\n",
" for group in flux_group.groups:\n",
" mean_ra = group[\"ra\"].mean()\n",
" mean_dec = group[\"dec\"].mean()\n",
" group.add_bjd_col(bjd_coordinates=SkyCoord(mean_ra, mean_dec))"
]
},
{
Expand Down Expand Up @@ -219,7 +187,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 8e31f29

Please sign in to comment.