Skip to content

Commit

Permalink
Improve notebook navigation with internal links
Browse files Browse the repository at this point in the history
  • Loading branch information
haticekaratay committed Dec 9, 2023
1 parent 0ce8c03 commit 057f9d5
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions notebooks/ifu_optimal/ifu_optimal.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a id=\"imports\"/>"
]
},
{
Expand Down Expand Up @@ -108,7 +108,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Read in NIRSpec IFU Cube\n",
"## 2. Read in NIRSpec IFU Cube <a id=\"read\"/>\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",
Expand Down Expand Up @@ -191,7 +191,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Visualize Science Data with Cubeviz"
"## 3. Visualize Science Data with Cubeviz <a id=\"visualize\"/>"
]
},
{
Expand All @@ -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 <a id=\"source\"/>\n",
"Export the region defined by the user in Cubeviz as astropy PixelRegions"
]
},
Expand Down Expand Up @@ -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 <a id=\"viewer\"/>\n",
"Retrieve the collapsed spectrum (Subset1) of the user-defined region from the Spectrum Viewer as a Spectrum1D object."
]
},
Expand Down Expand Up @@ -328,7 +328,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 6. Extract Spectrum by Sum Over Spaxels\n",
"## 6. Extract Spectrum by Sum Over Spaxels <a id=\"sum\"/>\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."
]
Expand Down Expand Up @@ -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) <a id=\"cylinder\" />\n",
"This method is appropriate for an extended source."
]
},
Expand Down Expand Up @@ -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) <a id = \"cone\" />\n",
"This method is appropriate for a point source PSF with width proportional to wavelength"
]
},
Expand Down Expand Up @@ -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 <a id = \"plot\" />\n",
"Compare spectra extracted in cylinder, cone, Cubeviz subset."
]
},
Expand Down Expand Up @@ -484,7 +484,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 10. WebbPSF Model PSF for Optimal Extraction\n",
"## 10. WebbPSF Model PSF for Optimal Extraction <a id=\"webbpsf\" />\n",
"Generate PSF model cube using WebbPSF for NIRSpec IFU, or read in precomputed PSF model cube."
]
},
Expand Down Expand Up @@ -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 <a id=\"align\"/>\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",
Expand Down Expand Up @@ -635,7 +635,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 12. Optimal Extraction using WebbPSF Model\n",
"## 12. Optimal Extraction using WebbPSF Model <a id=\"optimal\" />\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."
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 057f9d5

Please sign in to comment.