diff --git a/notebooks/ifu_optimal/ifu_optimal.ipynb b/notebooks/ifu_optimal/ifu_optimal.ipynb index 23b4248e8..819117b58 100644 --- a/notebooks/ifu_optimal/ifu_optimal.ipynb +++ b/notebooks/ifu_optimal/ifu_optimal.ipynb @@ -34,25 +34,25 @@ "metadata": {}, "source": [ "## Table of Contents\n", - "1. Imports\n", - "2. Read in NIRSpec IFU Cube\n", - "3. Visualize Science Data with Cubeviz\n", - "4. Export Source and Good Data Regions from Cubeviz\n", - "5. Extract Subset Spectrum and Background from Cubeviz Spectrum Viewer\n", - "6. Extract Spectrum by Sum over Spaxels\n", - "7. Extract Spectrum in Constant Radius Circular Aperture (Cylinder)\n", - "8. Extract Spectrum in Linearly Expanding Circular Aperture (Cone)\n", - "9. Plot and Compare Non-optimal Spectral Extractions\n", - "10. WebbPSF Model for Optimal Extraction\n", - "11. Align Model PSF Cube with Science Data\n", - "12. Optimal Extraction Using WebbPSF Model" + "1. [Imports](#imports)\n", + "2. [Read in NIRSpec IFU Cube](#read)\n", + "3. [Visualize Science Data with Cubeviz](#visualize)\n", + "4. [Export Source and Good Data Regions from Cubeviz](#source)\n", + "5. [Extract Subset Spectrum and Background from Cubeviz Spectrum Viewer](#viewer)\n", + "6. [Extract Spectrum by Sum over Spaxels](#sum)\n", + "7. [Extract Spectrum in Constant Radius Circular Aperture (Cylinder)](#cylinder)\n", + "8. [Extract Spectrum in Linearly Expanding Circular Aperture (Cone)](#cone)\n", + "9. [Plot and Compare Non-optimal Spectral Extractions](#plot)\n", + "10. [WebbPSF Model for Optimal Extraction](#webbpsf)\n", + "11. [Align Model PSF Cube with Science Data](#align)\n", + "12. [Optimal Extraction Using WebbPSF Model](#optimal)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## 1. Imports " + "## 1. Imports " ] }, { @@ -108,7 +108,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 2. Read in NIRSpec IFU Cube\n", + "## 2. Read in NIRSpec IFU Cube \n", "\n", "The NIRSpec IFU observation of quasar SDSS J1652+1728 (redshift z=1.9) was taken using the G235H grating with F170LP filter, covering 1.66-3.17 microns at a spectral resolution of R~2700. The IFU spaxels are 0.1\" on a side. \n", "The level-3 pipeline_processed datacube (s3d.fits, which combines all dithered exposures) is retrieved from MAST \n", @@ -191,7 +191,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 3. Visualize Science Data with Cubeviz" + "## 3. Visualize Science Data with Cubeviz " ] }, { @@ -216,7 +216,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 4. Export Source and Good Data Regions from Cubeviz\n", + "## 4. Export Source and Good Data Regions from Cubeviz \n", "Export the region defined by the user in Cubeviz as astropy PixelRegions" ] }, @@ -285,7 +285,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 5. Extract Subset Spectrum and Background from Cubeviz Spectrum Viewer\n", + "## 5. Extract Subset Spectrum and Background from Cubeviz Spectrum Viewer \n", "Retrieve the collapsed spectrum (Subset1) of the user-defined region from the Spectrum Viewer as a Spectrum1D object." ] }, @@ -328,7 +328,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 6. Extract Spectrum by Sum Over Spaxels\n", + "## 6. Extract Spectrum by Sum Over Spaxels \n", "\n", "Perform a simple numpy sum over all spaxels in the cube as a rudimentary extraction method. Also sum over wavelength to collapse the cube." ] @@ -369,7 +369,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 7. Extract Spectrum in Constant Radius Circular Aperture (Cylinder)\n", + "## 7. Extract Spectrum in Constant Radius Circular Aperture (Cylinder) \n", "This method is appropriate for an extended source." ] }, @@ -403,7 +403,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 8. Extract Spectrum in Linearly Expanding Circular Aperture (Cone)\n", + "## 8. Extract Spectrum in Linearly Expanding Circular Aperture (Cone) \n", "This method is appropriate for a point source PSF with width proportional to wavelength" ] }, @@ -437,7 +437,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 9. Plot and Compare Non-optimal Spectral Extractions\n", + "## 9. Plot and Compare Non-optimal Spectral Extractions \n", "Compare spectra extracted in cylinder, cone, Cubeviz subset." ] }, @@ -484,7 +484,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 10. WebbPSF Model PSF for Optimal Extraction\n", + "## 10. WebbPSF Model PSF for Optimal Extraction \n", "Generate PSF model cube using WebbPSF for NIRSpec IFU, or read in precomputed PSF model cube." ] }, @@ -557,7 +557,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 11. Align Model PSF Cube with Science Data\n", + "## 11. Align Model PSF Cube with Science Data \n", "Flip, smooth, and shift the model PSF cube to align with the simulated data. Trim the simulated data. \n", "\n", "Important Note 1: this PSF will likely be rotated with respect to your dataset, depending on telescope roll angle. You can either rotate it to match your data or reprocess your data using the ifualign keyword to align the WCS with the instrumental coordinate frame.\n", @@ -635,7 +635,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 12. Optimal Extraction using WebbPSF Model\n", + "## 12. Optimal Extraction using WebbPSF Model \n", "Optimal extraction ([Horne 1986, PASP, 98, 609](https://ui.adsabs.harvard.edu/abs/1986PASP...98..609H/abstract)) weights the flux contributions to a spectrum by their signal-to-noise ratio (SNR). Dividing the simulated data by the model PSF gives an estimate of the total flux density spectrum in each spaxel. A weighted average of these estimates over all spaxels yields the optimally extracted spectrum over the cube. In the faint source limit, where the noise is background-dominated, optimal extraction inside a 3-sigma radius can increase the effective exposure time by a factor of 1.69 (Horne et al. 1986). In the bright source limit, where the noise is dominated by the Poisson statistics of the source, optimal extraction is formally identical to a straight sum over spaxels for a perfect PSF model. \n", "\n", "We use the precomputed WebbPSF PSF model for optimal extraction here." @@ -697,8 +697,6 @@ "metadata": {}, "outputs": [], "source": [ - "from jdaviz import Specviz\n", - "\n", "specviz = Specviz()\n", "\n", "flux_opt = spectrum_optimal * u.MJy / u.sr\n",