diff --git a/DP2/102_Visit_and_tract_metadata.ipynb b/DP2/102_Visit_and_tract_metadata.ipynb index 9bcd8967..48093d58 100644 --- a/DP2/102_Visit_and_tract_metadata.ipynb +++ b/DP2/102_Visit_and_tract_metadata.ipynb @@ -22,7 +22,7 @@ "Data Release: Data Preview 2\\\n", "Container Size: Large\\\n", "LSST Science Pipelines version: r29.2.0\\\n", - "Last verified to run: 2026-04-08\\\n", + "Last verified to run: 2026-05-01\\\n", "Repository: [github.com/lsst/tutorial-notebooks](https://github.com/lsst/tutorial-notebooks)\\\n", "DOI: [10.11578/rubin/dc.20250909.20](https://doi.org/10.11578/rubin/dc.20250909.20)" ] @@ -185,7 +185,9 @@ "* `airmass`: Airmass of the telescope pointing.\n", "* `expTime`: Exposure time, in seconds.\n", "* `expMidptMJD`: Time at the middle of the exposure, in modified Julian date (MJD).\n", - "* `obsStartMJD`: Time at the start of the exposure, in MJD." + "* `obsStartMJD`: Time at the start of the exposure, in MJD.\n", + "* `mean_seeing`: Initial estimate of seeing, averaged over all detectors, in arcseconds.\n", + "* `mean_maglim`: Initial estimate of PSF magnitude limit, averaged over all detectors, in mags." ] }, { @@ -205,7 +207,7 @@ "metadata": {}, "outputs": [], "source": [ - "visits_table = ascii.read(file_path + 'dp2_visits_table.ecsv')\n", + "visits_table = ascii.read(file_path + 'dp2_visits_table_with_iq.ecsv')\n", "print('Number of visits: ', len(visits_table))\n", "visits_table[:5]" ] @@ -451,12 +453,56 @@ "> **Figure 5:** The binned cumulative distribution of visit airmass by filter (see figure legend). The x-axis has been cropped to show only airmass $\\leq 1.6$." ] }, + { + "cell_type": "markdown", + "id": "827a3b55-a35f-4790-82aa-17881385996f", + "metadata": {}, + "source": [ + "### 2.5. Initial IQ estimates\n", + "\n", + "Plot the initial estimates of seeing and magnitude limit, averaged over all detectors, per visit per filter." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "30a948a9-ff53-4382-91c1-0fe3a2dadfa2", + "metadata": {}, + "outputs": [], + "source": [ + "fig, ax = plt.subplots(1, 2, figsize=(10, 4), sharey=True)\n", + "for f, filt in enumerate(filter_names):\n", + " tx = np.where(visits_table['band'] == filt)[0]\n", + " ax[0].hist(visits_table['mean_seeing'][tx], histtype='step', bins=75,\n", + " cumulative=True, log=True,\n", + " linestyle=filter_linestyles[filt], color=filter_colors[filt], label=filt)\n", + " ax[1].hist(visits_table['mean_maglim'][tx], histtype='step', bins=75,\n", + " cumulative=True, log=True,\n", + " linestyle=filter_linestyles[filt], color=filter_colors[filt], label=filt)\n", + " del tx\n", + "ax[1].legend(loc='upper left', ncol=2)\n", + "ax[0].set_xlabel('Mean Seeing [arcsec]')\n", + "ax[1].set_xlabel('Mean Magnitude Limit [mag]')\n", + "ax[0].set_ylabel('Number of visits per filter')\n", + "plt.subplots_adjust(wspace=0)\n", + "plt.suptitle('Binned cumulative distribution of initial visit image quality estimates, by filter')\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "id": "3f2140cd-d224-425e-a72f-1c887de1acdf", + "metadata": {}, + "source": [ + "> **Figure 6:** The binned cumulative distribution of initial estimates for the mean seeing (left) and mean magnitude limit (right) per visit (averaged over all detectors), by filter." + ] + }, { "cell_type": "markdown", "id": "f6b75f4c-4063-4b58-adbc-e8f8db4ae30e", "metadata": {}, "source": [ - "### 2.5. Sky distribution\n", + "### 2.6. Sky distribution\n", "\n", "Use the `healpy` package to print the area of one 19-sided HEALPix.\n", "It is similar to the LSSTCam field of view (FOV) of 9.6 square degrees." @@ -506,7 +552,7 @@ "id": "c7147dc2-8c53-4d5a-b9d7-f607ada424b4", "metadata": {}, "source": [ - "> **Figure 6:** A 2D histogram illustrating the distribution of DP2 visits on the sky (for all filters, combined)." + "> **Figure 7:** A 2D histogram illustrating the distribution of DP2 visits on the sky (for all filters, combined)." ] }, { @@ -567,7 +613,7 @@ "id": "9a9f5399-336e-4a79-be40-29030fec5833", "metadata": {}, "source": [ - "> **Figure 7:** Similar to Figure 6, but for $g$-band visits only." + "> **Figure 8:** Similar to Figure 6, but for $g$-band visits only." ] }, { @@ -610,7 +656,17 @@ "\n", "* `tractId`: A unique integer identifier; the tract number.\n", "* `filters_list`: A string of up to six characters containing the filters with a deep coadd image in the tract (e.g., `gi`, `ugr`, `ugrizy`).\n", - "* `vertices_deg`: A list of the sky coordinates for the tract's four corners. For north-up east-left alignment (RA increases left), the order of the corners are: south-east (lower-left), south-west (lower-right), north-west (upper-right), north-east (upper-left)." + "* `vertices_deg`: A list of the sky coordinates for the tract's four corners. For north-up east-left alignment (RA increases left), the order of the corners are: south-east (lower-left), south-west (lower-right), north-west (upper-right), north-east (upper-left).\n", + "* `psf_maglim`: The $5\\sigma$ PSF magnitude limit in the $r$ and $i$ bands, in AB magnitudes.\n", + "* `psf_size`: The PSF characteristic width as computed from the determinant radius, in the $r$ and $i$ bands, in pixels.\n", + "\n", + "The two image quality (IQ) parameters, the magnitude limit and PSF size, are evaluated from the survey property maps at the center of the tract:\n", + "* `deepCoadd_psf_maglim_consolidated_map_weighted_mean`\n", + "* `deepCoadd_psf_size_consolidated_map_weighted_mean`\n", + "\n", + "The `psf_size` is the $\\sigma$ in pixels, and can be approximately converted to arcseconds with a pixel scale of $\\sim0.2$ arcsec/pixel.\n", + "To convert the `psf_size` to a FWHM in arcseconds, use:\n", + "$FWHM = 0.2 \\sigma \\times 2 \\sqrt{2 \\ln(2)} = 2.3548 \\times 0.2 \\sigma$" ] }, { @@ -631,7 +687,7 @@ "metadata": {}, "outputs": [], "source": [ - "tracts_table = ascii.read(file_path + 'dp2_tracts_table.ecsv')\n", + "tracts_table = ascii.read(file_path + 'dp2_tracts_table_with_iq.ecsv')\n", "print('Number of deep coadd tracts: ', len(tracts_table))\n", "print('Maximum sky area covered by deep coadd tracts: ', int(len(tracts_table) * 1.66**2),\n", " ' square degrees.')" @@ -711,12 +767,85 @@ "del tally" ] }, + { + "cell_type": "markdown", + "id": "963a3d2b-b17d-4edb-bfc3-1635df985896", + "metadata": {}, + "source": [ + "Some tracts are not fully filled by deep coadd images, and have a `nan` value for the PSF magnitude limit or PSF size.\n", + "Print the total number (and fraction) of $r$- and $i$-band tracts that have sufficient data for the PSF magnitude limit to be estimated." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "55083a39-f0da-4e33-a192-9e4d1e642b73", + "metadata": {}, + "outputs": [], + "source": [ + "for filt in ['r', 'i']:\n", + " tally = 0\n", + " tally2 = 0\n", + " for f, flist in enumerate(tracts_table['filters_list']):\n", + " if flist.find(filt) >= 0:\n", + " tally += 1\n", + " if np.isfinite(tracts_table['psf_maglim_' + filt][f]):\n", + " tally2 += 1\n", + " print(filt, tally, tally2, np.round(tally2/tally, 2))\n", + "del tally" + ] + }, + { + "cell_type": "markdown", + "id": "4fd69847-90ba-40f1-bac2-392d3166fb06", + "metadata": {}, + "source": [ + "### 3.3. IQ parameters\n", + "\n", + "Plot histograms of the tract image quality (IQ) parameters provided in the table." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "db014376-ccb3-4534-a78d-4a3983289288", + "metadata": {}, + "outputs": [], + "source": [ + "fig, ax = plt.subplots(1, 2, figsize=(10, 4), sharey=True)\n", + "for f, filt in enumerate(['r', 'i']):\n", + " tx1 = np.where(np.isfinite(tracts_table['psf_maglim_' + filt]))[0]\n", + " tx2 = np.where(np.isfinite(tracts_table['psf_size_' + filt]))[0]\n", + " ax[0].hist(tracts_table['psf_maglim_' + filt][tx1], histtype='step',\n", + " bins=75, cumulative=True, log=True,\n", + " linestyle=filter_linestyles[filt], color=filter_colors[filt], label=filt)\n", + " ax[1].hist(0.2 * 2.3548 * tracts_table['psf_size_' + filt][tx2], histtype='step',\n", + " bins=75, cumulative=True, log=True,\n", + " linestyle=filter_linestyles[filt], color=filter_colors[filt], label=filt)\n", + " del tx1, tx2\n", + "ax[1].legend(loc='upper left', ncol=2)\n", + "ax[0].set_xlabel('PSF Magnitude Limit [mag]')\n", + "ax[1].set_xlabel('PSF FWHM [arcsec]')\n", + "ax[0].set_ylabel('Number of tracts per filter')\n", + "plt.subplots_adjust(wspace=0)\n", + "plt.suptitle('Binned cumulative distribution of tract image quality parameters')\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "id": "34c9b18d-3a40-40d3-9296-847184865e48", + "metadata": {}, + "source": [ + "> **Figure 9:** The binned cumulative distribution of tract IQ parameters, the PSF magnitude limit (left) and the PSF FWHM (right) in the $r$- and $i$-filters." + ] + }, { "cell_type": "markdown", "id": "dfda2aae-4f25-4f99-a4ac-85a4126e64fb", "metadata": {}, "source": [ - "### 3.3. Sky distribution\n", + "### 3.4. Sky distribution\n", "\n", "Use the tract vertices to draw one polygon per tract." ] @@ -745,7 +874,7 @@ "id": "709d29e0-ef46-458e-977b-c3166b6804dd", "metadata": {}, "source": [ - "> **Figure 8:** All of the DP2 tracts for which deep coadd images will exist, in any filter." + "> **Figure 10:** All of the DP2 tracts for which deep coadd images will exist, in any filter." ] }, { @@ -753,7 +882,7 @@ "id": "f567d17d-18dd-4981-ae5a-841b39e27185", "metadata": {}, "source": [ - "Create a plot that is similar to the one above, but for only tracts that will have a $y$-band deep coadd image." + "Create a plot that is similar to the one above, but for only tracts that will have an $r$-band deep coadd image." ] }, { @@ -763,7 +892,7 @@ "metadata": {}, "outputs": [], "source": [ - "show_filter = 'y'\n", + "show_filter = 'r'\n", "fig, ax = plt.subplots(figsize=(8, 6))\n", "sp = skyproj.McBrydeSkyproj(ax=ax)\n", "for i, vertices in enumerate(tracts_table['vertices_deg']):\n", @@ -784,7 +913,47 @@ "id": "331076de-c131-43a3-b1e7-889185625e10", "metadata": {}, "source": [ - "> **Figure 9:** The DP2 tracts for which $y$-band deep coadd images will exist." + "> **Figure 11:** The DP2 tracts for which $r$-band deep coadd images will exist." + ] + }, + { + "cell_type": "markdown", + "id": "9df06a00-79f1-4d55-9d47-3aef60528fbe", + "metadata": {}, + "source": [ + "Create a plot that is similar to the one above, but only for tracts with $r$-band for which the $r$-band magnitude limit is $>23$ mag." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1645927e-6e3c-42f0-a61e-1a7cbde2e64b", + "metadata": {}, + "outputs": [], + "source": [ + "show_filter = 'r'\n", + "fig, ax = plt.subplots(figsize=(8, 6))\n", + "sp = skyproj.McBrydeSkyproj(ax=ax)\n", + "for i, vertices in enumerate(tracts_table['vertices_deg']):\n", + " flist = str(tracts_table['filters_list'][i])\n", + " if flist.find(show_filter) >= 0:\n", + " if (tracts_table['psf_maglim_r'][i] > 23.0):\n", + " ras = vertices.transpose()[0]\n", + " decs = vertices.transpose()[1]\n", + " sp.draw_polygon(ras, decs, edgecolor=filter_colors[show_filter],\n", + " alpha=0.5, linewidth=0.5, facecolor=None)\n", + "sp.ax.set_xlabel(\"Right Ascension\", fontsize=14)\n", + "sp.ax.set_ylabel(\"Declination\", fontsize=14)\n", + "plt.show()\n", + "del sp, show_filter" + ] + }, + { + "cell_type": "markdown", + "id": "a1d65a2c-4809-4ecc-9e55-1d703b1794d5", + "metadata": {}, + "source": [ + "> **Figure 12:** The DP2 tracts for which $r$-band deep coadd images will exist, and have a magnitude limit fainter than 23 mag." ] }, { @@ -1087,7 +1256,7 @@ "id": "599638e6-f98f-46cf-88e1-350287fc23e9", "metadata": {}, "source": [ - "> **Figure 10:** A 2D histogram illustrating the distribution of DP2 visits on the sky (for all filters, combined), similar to Figure 6 but plotted in blue-scale. Boxes are drawn to represent each skymap tract that will have at least one patch with a deep coadd image (similar to Figure 8). Overplotted are the coordinates of the three target coordinates (1 as a yellow star; 2 as a green triangle; 3 as a magenta square)." + "> **Figure 13:** A 2D histogram illustrating the distribution of DP2 visits on the sky (for all filters, combined), similar to Figure 6 but plotted in blue-scale. Boxes are drawn to represent each skymap tract that will have at least one patch with a deep coadd image (similar to Figure 8). Overplotted are the coordinates of the three target coordinates (1 as a yellow star; 2 as a green triangle; 3 as a magenta square)." ] }, { @@ -1235,7 +1404,7 @@ "id": "5676c6ae-313e-406e-9998-d514a4bde4e8", "metadata": {}, "source": [ - "> **Figure 11:** Similar to Figure 10, this plot shows the distribution of DP2 visits (blue-scale), with boxes drawn for DP2 tracts, and with the locations of the DP1 fields marked." + "> **Figure 14:** Similar to Figure 10, this plot shows the distribution of DP2 visits (blue-scale), with boxes drawn for DP2 tracts, and with the locations of the DP1 fields marked." ] }, {