Skip to content

Commit

Permalink
Made edits in response to review
Browse files Browse the repository at this point in the history
  • Loading branch information
ojustino committed Jun 23, 2021
1 parent a207acb commit b2643c1
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions notebooks/concepts/generate_mosviz_photometry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Synthetic image and cutout creation for Mosviz pipeline data\n",
"\n",
"**Motiviation**: The synthetic dataset we currently possess from the JWST data pipeline team for use in Mosviz contains simulated spectra from NIRSpec but no associated NIRCam photometry. We would like to have test imagery to display in Mosviz alongside these 2D and 1D spectra since we are not aware that the pipeline team has plans to produce any.\n",
"**Motivation**: The synthetic dataset we currently possess from the JWST data pipeline team for use in Mosviz contains simulated spectra from NIRSpec but no associated NIRCam photometry. We would like to have test imagery to display in Mosviz alongside these 2D and 1D spectra since we are not aware that the pipeline team has plans to produce any.\n",
"\n",
"**Goal**: Populate an image of background noise with properly-scaled galaxy cutouts sourced from a Hubble Space Telescope image and placed at their analogous locations in the new image. These galaxies' real spectra do not necessarily correspond with those in our dataset, but we care more about the veneer of having photometry to match with our spectra in Mosviz at this point.\n",
"\n",
Expand All @@ -17,7 +17,7 @@
"- We wanted to scrape RA/Dec information from the data pipeline products to get a range of coordinates over which to scale our synthetic image, but it appears that the pipeline's data products lack `\"TARG_RA\"` or `\"TARG_DEC\"` keywords in their headers.\n",
" - The data products also do not appear to have WCS information. Though it is not strictly needed to achieve this notebook's goals, it would be convenient to have.\n",
"- There does not appear to be an observation with Level 2 data in `jwst-pipeline/truth/test_nirspec_mos_spec2` and Level 3 data in `jwst-pipeline/truth/test_nirspec_mos_spec3`. All observations are either Level 2 only or Level 3 only.\n",
"- _(Resolved)_ A good number of the cutouts from the first couple of field images we tested had intrustions from other galaxies due to crowding. We settled on the Hubble Deep Field as a good source image, but had we not, we may have considered using galaxies modeled with Sersic profiles to get cleaner cutouts to inject into our synthetic image."
"- _(Resolved)_ A good number of the cutouts from the first couple of field images we tested had intrusions from other galaxies due to crowding. We settled on the Hubble Deep Field as a good source image, but had we not, we may have considered using galaxies modeled with Sersic profiles to get cleaner cutouts to inject into our synthetic image."
]
},
{
Expand All @@ -39,7 +39,8 @@
"- The objects from `photutils.segmentation` do the work of analytically finding bright sources, separating those that overlap, and creating a catalog of the resulting information.\n",
"- We use `matplotlib.pyplot` to preview the field image, the cutouts, and various stages of our synthetic image.\n",
"- We use `numpy` to facilitate several specialized mathematical and array-related operations.\n",
"- `os` helps us create a new directory for the final cutouts from the synthetic image."
"- `os` helps us create a new directory for the final cutouts from the synthetic image.\n",
"- `%matplotlib inline` is notebook \"magic\" that helps display in-notebook plots consistently for different users."
]
},
{
Expand All @@ -51,6 +52,9 @@
},
"outputs": [],
"source": [
"import os\n",
"from glob import glob\n",
"\n",
"from astropy import units as u\n",
"from astropy.coordinates import SkyCoord\n",
"from astropy.convolution import Gaussian2DKernel\n",
Expand All @@ -60,13 +64,21 @@
" sigma_clipped_stats, sigma_clip)\n",
"from astropy.table import Table, join\n",
"from astropy.wcs import WCS\n",
"from glob import glob\n",
"from photutils.segmentation import (detect_sources, deblend_sources,\n",
" SourceCatalog)\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import os"
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a451ac82-45ce-4ed9-a0fc-b122ceb128cc",
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
Expand Down Expand Up @@ -407,7 +419,7 @@
"\n",
"Note that this section's cells only run on a connection with access to the STScI VPN. They use copies of JWST pipeline files from May 19, 2021.\n",
"\n",
"To run them elsewhere and/or use more current files, visit the [Artifactory](https://bytesalad.stsci.edu/ui/repos/tree/General/jwst-pipeline%2Fdev%2Ftruth%2Ftest_nirspec_mos_spec3), ensure the `jwst-pipeline/dev/truth/test_nirspec_mos_spec3/` folder is the one selected in the directory tree, and download all files whose names begin with `jw00626-o030` and end with `nirspec_f170lp-g235m_x1d.fits` or `nirspec_f170lp-g235m_s2d.fits`. (The original version of this notebook uses six of these Level 3 data products.) Then, change `filepath` in the next cell to the location where you saved the downloaded files, remembering the trailing forward slash."
"To run them elsewhere and/or use more current files, visit the [Artifactory](https://bytesalad.stsci.edu/ui/repos/tree/General/jwst-pipeline%2Fdev%2Ftruth%2Ftest_nirspec_mos_spec3), ensure the `jwst-pipeline/dev/truth/test_nirspec_mos_spec3/` folder is the one selected in the directory tree, and download all files whose names begin with `jw00626-o030` and end with `nirspec_f170lp-g235m_x1d.fits` or `nirspec_f170lp-g235m_s2d.fits`. (The original version of this notebook uses six of these Level 3 data products.) Then, change `filepath` in the next cell to the location where you saved the downloaded files, remembering the trailing slash."
]
},
{
Expand All @@ -420,7 +432,7 @@
"# view level 3 spectra FITS header information\n",
"filepath = '/user/jotor/jwst-pipeline-lvl3-copy/'\n",
"x1d_header = fits.getheader(filepath + 'jw00626-o030_s00000_nirspec_f170lp-g235m_x1d.fits', ext=1)\n",
"#s2d_header = fits.getheader(filepath + 'jw00626-o030_s00000_nirspec_f170lp-g235m_s2d.fits'', ext=1)"
"s2d_header = fits.getheader(filepath + 'jw00626-o030_s00000_nirspec_f170lp-g235m_s2d.fits', ext=1)"
]
},
{
Expand All @@ -430,7 +442,7 @@
"metadata": {},
"outputs": [],
"source": [
"x1d_header['SRCRA'], x1d_header['SRCDEC']"
"(x1d_header['SRCRA'], x1d_header['SRCDEC']), (s2d_header['SRCRA'], s2d_header['SRCDEC'])"
]
},
{
Expand Down

0 comments on commit b2643c1

Please sign in to comment.