|
89 | 89 | "metadata": {}, |
90 | 90 | "source": [ |
91 | 91 | "<a id=\"env\"></a>\n", |
92 | | - "## 1.1 Environment \n", |
| 92 | + "### 1.1 Environment \n", |
93 | 93 | "\n", |
94 | 94 | "This notebook requires users to install the packages listed in the `requirements.txt` file located in the notebook's <br>\n", |
95 | 95 | "sub-folder on the GitHub repository. We will use the `conda` package manager to build the necessary virtual environment. <br>\n", |
|
124 | 124 | }, |
125 | 125 | "source": [ |
126 | 126 | "<a id=\"import\"></a>\n", |
127 | | - "## 1.2 Imports \n", |
| 127 | + "### 1.2 Imports \n", |
128 | 128 | " \n", |
129 | 129 | "For this notebook we import:\n", |
130 | 130 | "\n", |
|
228 | 228 | "metadata": {}, |
229 | 229 | "source": [ |
230 | 230 | "<a id=\"config\"></a>\n", |
231 | | - "## 1.3 `Slitlessutils` Configuration \n", |
| 231 | + "### 1.3 `Slitlessutils` Configuration \n", |
232 | 232 | "\n", |
233 | 233 | "In order to extract or simulate grism spectra with `slitlessutils`, you must have the necessary reference files. <br>\n", |
234 | 234 | "Below, we provide a table of file descriptions, example filenames, and file types for the different reference files <br>\n", |
|
299 | 299 | "outputs": [], |
300 | 300 | "source": [ |
301 | 301 | "# Initialize configuration \n", |
302 | | - "cfg = su.config.Config()" |
| 302 | + "cfg = su.config.Config()\n", |
| 303 | + "# Download latest reffile version\n", |
| 304 | + "cfg.retrieve_reffiles(update=True)" |
303 | 305 | ] |
304 | 306 | }, |
305 | 307 | { |
|
411 | 413 | " \n", |
412 | 414 | "We download G102 `_raw.fits` and F105W `_flt.fits` images of the galactic planetary nebula, [VY2-2](https://simbad.cds.unistra.fr/simbad/sim-id?Ident=%402707077&Name=PN%20Vy%20%202-2&submit=submit), from CAL<br>\n", |
413 | 415 | "program [17687](https://www.stsci.edu/hst-program-info/program/?program=17687). This target is a well-established calibration source routinely used by the WFC3 instrument team to <br>\n", |
414 | | - "derive and validate the wavelength solution for the IR grisms (WFC3 ISR [2016-15](https://www.stsci.edu/files/live/sites/www/files/home/hst/instrumentation/wfc3/documentation/instrument-science-reports-isrs/_documents/2016/WFC3-2016-15.pdf)).\n", |
415 | | - "After downloading the images, we <br>\n", |
416 | | - "move them to a subdirectory within the current working directory. " |
| 416 | + "derive and validate the wavelength solution for the IR grisms ([WFC3 ISR 2016-15](https://www.stsci.edu/files/live/sites/www/files/home/hst/instrumentation/wfc3/documentation/instrument-science-reports-isrs/_documents/2016/WFC3-2016-15.pdf) (Pirzkal et al.)).\n", |
| 417 | + "After downloading the <br>\n", |
| 418 | + "images, we move them to a subdirectory within the current working directory. " |
417 | 419 | ] |
418 | 420 | }, |
419 | 421 | { |
|
1045 | 1047 | { |
1046 | 1048 | "cell_type": "code", |
1047 | 1049 | "execution_count": null, |
1048 | | - "metadata": { |
1049 | | - "scrolled": true |
1050 | | - }, |
| 1050 | + "metadata": {}, |
1051 | 1051 | "outputs": [], |
1052 | 1052 | "source": [ |
1053 | 1053 | "os.chdir('../output')\n", |
|
1064 | 1064 | "### 6.1 Display a Region File\n", |
1065 | 1065 | "\n", |
1066 | 1066 | "Below, we display a grism FLT file and the associated region file. The region files are useful for quickly inspecting which part <br>\n", |
1067 | | - "of the grism image contribute to each object’s spectrum. The 0, <span style=\"color: blue;\">+1</span>, <span style=\"color: orange;\">+2</span>, and <span style=\"color: green;\">+3</span> spectral orders for the observations are outlined <br>\n", |
1068 | | - "in white, blue, orange, and green, respectively. More information about the `slitlessutils` region files can be found in the <br>[documentation](https://slitlessutils.readthedocs.io/en/latest/regions.html). " |
| 1067 | + "of the grism image contribute to each object’s spectrum. The 0, <span style=\"color: blue;\"><b>+1</b></span>, <span style=\"color: orange;\"><b>+2</b></span>, and <span style=\"color: green;\"><b>+3</b></span> spectral orders for the observations are outlined <br>\n", |
| 1068 | + "in white, blue, orange, and green, respectively. More information about the `slitlessutils` region files can be found in the <br>[documentation](https://slitlessutils.readthedocs.io/en/latest/regions.html). \n", |
| 1069 | + "\n", |
| 1070 | + "<b>Note</b>: if the figure below does not display correctly, try switching to `%matplotlib inline`. " |
1069 | 1071 | ] |
1070 | 1072 | }, |
1071 | 1073 | { |
|
1074 | 1076 | "metadata": {}, |
1075 | 1077 | "outputs": [], |
1076 | 1078 | "source": [ |
| 1079 | + "# %matplotlib inline\n", |
1077 | 1080 | "i = 0 # which FLT image to display\n", |
1078 | 1081 | "fig, axs = plt.subplots(1, 1, figsize=(9, 9))\n", |
1079 | 1082 | "\n", |
|
1115 | 1118 | "source and grism image. Those spectra are then combined into a single one-dimensional spectrum for each source and saved as a<br>\n", |
1116 | 1119 | "`x1d.fits` file. In this example, we only have one source, so there is a single spectrum.<br>\n", |
1117 | 1120 | "\n", |
1118 | | - "The `x1d` file is a binary table with columns for the wavelength (`lamb`), flux (`flam`), uncertainty (`func`), contamination (`cont`), <br>\n", |
1119 | | - "and number of pixels (`npix`). By default [configuration](https://slitlessutils.readthedocs.io/en/latest/configure.html#global-variables-config), the flux and uncertainty values are in units of <em>erg s<sup>-1</sup> cm<sup>-2</sup> · Å<sup>-1</sup></em> and scaled by <br>\n", |
1120 | | - "10<sup>-17</sup> (`cfg.fluxunits` and `cfg.fluxscale`).\n" |
| 1121 | + "The `x1d` file is a binary table with columns for the wavelength (`WAVELENGTH`), flux (`FLUX`), uncertainty (`UNCERTAINTY`), contamination<br>\n", |
| 1122 | + "(`CONTAMINATION`), and number of pixels (`NMEASUREMENTS`). By default [configuration](https://slitlessutils.readthedocs.io/en/latest/configure.html#global-variables-config), the flux and uncertainty values are in units of <br>\n", |
| 1123 | + "<em>erg s<sup>-1</sup> cm<sup>-2</sup> · Å<sup>-1</sup></em> and scaled by 10<sup>-17</sup> (`cfg.fluxunits` and `cfg.fluxscale`).\n", |
| 1124 | + "\n", |
| 1125 | + "There are several emission lines in VY2-2's spectrum. A list of emission lines is provided in Table 2 of [WFC3 ISR 2015-10](https://www.stsci.edu/files/live/sites/www/files/home/hst/instrumentation/wfc3/documentation/instrument-science-reports-isrs/_documents/2015/WFC3-2015-10.pdf) (Bohlin et al.), <br>\n", |
| 1126 | + "which has been copied over to this notebook in the cell below.\n", |
| 1127 | + "\n" |
1121 | 1128 | ] |
1122 | 1129 | }, |
1123 | 1130 | { |
|
1143 | 1150 | "\n", |
1144 | 1151 | "# create wavelength mask\n", |
1145 | 1152 | "lrange = (8000, 11550) \n", |
1146 | | - "wav = (lrange[0] < dat['lamb']) & (dat['lamb'] < lrange[1])\n", |
| 1153 | + "wav = (lrange[0] < dat['WAVELENGTH']) & (dat['WAVELENGTH'] < lrange[1])\n", |
1147 | 1154 | "\n", |
1148 | 1155 | "# plot spectrum\n", |
1149 | | - "ax.errorbar(dat['lamb'][wav], \n", |
1150 | | - " dat['flam'][wav]*cfg.fluxscale/1e-13, \n", |
1151 | | - " yerr=dat['func'][wav]*cfg.fluxscale/1e-13, \n", |
| 1156 | + "ax.errorbar(dat['WAVELENGTH'][wav], \n", |
| 1157 | + " dat['FLUX'][wav]*cfg.fluxscale/1e-13, \n", |
| 1158 | + " yerr=dat['UNCERTAINTY'][wav]*cfg.fluxscale/1e-13, \n", |
1152 | 1159 | " marker='.', markersize=5)\n", |
1153 | 1160 | "\n", |
1154 | | - "# overlay known emission lines (vacuum)\n", |
1155 | | - "ax.axvline(9069, ls='--', c='k', lw=1) # [SIII]; S²⁺\n", |
1156 | | - "ax.axvline(9531, ls='--', c='k', lw=1) # [SIII]; S²⁺ blended with H I\n", |
1157 | | - "# ax.axvline(9546, ls='--', c='k', lw=1) # H I Pε; n = 8 → 3 blended with [SIII] \n", |
1158 | | - "ax.axvline(10049, ls='--', c='k', lw=1) # H I P7; n = 7 → 3\n", |
1159 | | - "ax.axvline(10830, ls='--', c='k', lw=1) # He I; 2³S → 2³P\n", |
| 1161 | + "# overlay known emission lines\n", |
| 1162 | + "ax.axvline(9070, ls='--', c='k', lw=1) # [SIII]; S²⁺\n", |
| 1163 | + "ax.axvline(9535, ls='--', c='k', lw=1) # [SIII]; S²⁺ blended with H I Pε\n", |
| 1164 | + "ax.axvline(10060, ls='--', c='k', lw=1) # H I P7; n = 7 → 3\n", |
| 1165 | + "ax.axvline(10834, ls='--', c='k', lw=1) # He I; 2³S → 2³P\n", |
1160 | 1166 | "\n", |
1161 | 1167 | "# matplotlib formatting\n", |
1162 | 1168 | "ax.minorticks_on()\n", |
|
1204 | 1210 | "## About this Notebook \n", |
1205 | 1211 | "\n", |
1206 | 1212 | "**Author:** Benjamin Kuhn, WFC3 Team <br>\n", |
1207 | | - "**Last Updated:** 2026-03-19<br>\n", |
| 1213 | + "**Last Updated:** 2026-03-25<br>\n", |
1208 | 1214 | "**Created** 2026-01-15\n", |
1209 | 1215 | "\n", |
1210 | 1216 | "<a id=\"cite\"></a>\n", |
|
1246 | 1252 | "name": "python", |
1247 | 1253 | "nbconvert_exporter": "python", |
1248 | 1254 | "pygments_lexer": "ipython3", |
1249 | | - "version": "3.11.0" |
| 1255 | + "version": "3.12.0" |
1250 | 1256 | } |
1251 | 1257 | }, |
1252 | 1258 | "nbformat": 4, |
|
0 commit comments