Skip to content

Commit

Permalink
updated comparison of photometry
Browse files Browse the repository at this point in the history
  • Loading branch information
Ori Fox committed Oct 28, 2024
1 parent 4b59e46 commit 190ff7d
Show file tree
Hide file tree
Showing 3 changed files with 3,463 additions and 0 deletions.
141 changes: 141 additions & 0 deletions notebooks/psf_photometry/MIRI/miri_phot_comparison.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "5e6982fe-42fe-42d7-984b-226ae08a01d0",
"metadata": {},
"source": [
"# MIRI Photometry Comparison of Photutils vs. Space_Phot\n",
"\n",
"**Author**: Ori Fox<br>\n",
"\n",
"**Submitted**: August, 2023<br>\n",
"**Updated**: November, 2023<br>\n",
"\n",
"**Use case**: A comparison of the photometry produced by the two other notebooks in this folder.<br>\n",
"**Data**: MIRI Data PID 1028 (Calibration Program; Single Star Visit 006 A5V dwarf 2MASSJ17430448+6655015) and MIRI Data PID 1171 (LMC; Multiple Stars).<br>\n",
"**Tools**: photutils, space_phot drizzlepac, jupyter <br>\n",
"**Cross-Instrument**: NIRCam, MIRI.<br>\n",
"**Documentation**: This notebook is part of a STScI's larger post-pipeline Data Analysis Tools Ecosystem and can be downloaded directly from the JDAT Notebook Github directory.<br>\n",
"**Pipeline Version**: JWST Pipeline<br>\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18ff6a53-9e2d-4bef-aa2b-e2abd0758ec7",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import astropy.units as u\n",
"from astropy.coordinates import SkyCoord\n",
"from pandas import DataFrame"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "99887406-cc2a-4e62-8b8e-38de616e643d",
"metadata": {},
"outputs": [],
"source": [
"# Read space_phot data\n",
"\n",
"sphot = pd.read_csv('miri_photometry_space_phot_lvl2.txt') \n",
"sphot"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "672f0fde-cd6e-4e85-9518-a07b53f5f581",
"metadata": {},
"outputs": [],
"source": [
"# Read photutils data\n",
"\n",
"phot = pd.read_csv('miri_photometry_photutils.txt') \n",
"phot"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1bf4436f-47ad-4f59-9992-1ede269724cd",
"metadata": {},
"outputs": [],
"source": [
"sphot['dec'].to_numpy()*u.deg"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4a88bf03-50a0-4c9b-bc1d-1b9d93032ed0",
"metadata": {},
"outputs": [],
"source": [
"#Find closest neighbors\n",
"\n",
"c1 = SkyCoord(sphot['ra'].to_numpy()*u.deg, sphot['dec'].to_numpy()*u.deg, frame='icrs')\n",
"c2 = SkyCoord(phot['RA'].to_numpy()*u.deg, phot['DEC'].to_numpy()*u.deg, frame='icrs')\n",
"idx, d2d, d3d = c2.match_to_catalog_3d(c1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b32e3c67-397a-4515-94d6-afd8da0b850c",
"metadata": {},
"outputs": [],
"source": [
"# Calculate Delta Mag\n",
"\n",
"delta_mag = sphot['mag'][idx].to_numpy() - phot['Mag']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "34f6ed58-d8dc-4af8-8f2a-d7498e118fd1",
"metadata": {},
"outputs": [],
"source": [
"# Cross match Catalogs and Look at Delta Mags\n",
"\n",
"df = DataFrame({\"photutils_skycoord\": c1[idx], \"spacephot_skycoord\": c2, \"skycoord_separation\": d3d, \"photutils_mag\": phot['Mag'], \"spacephot_mag\": sphot['mag'][idx].to_numpy(), \"delta_mag\": delta_mag})\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8d0b5394-c11b-4fa0-922b-567225c7dc65",
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 190ff7d

Please sign in to comment.