Skip to content

Commit 9887328

Browse files
committed
update dp2 102 to use iq
1 parent 4b07cd5 commit 9887328

1 file changed

Lines changed: 138 additions & 14 deletions

File tree

DP2/102_Visit_and_tract_metadata.ipynb

Lines changed: 138 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"Data Release: Data Preview 2\\\n",
2323
"Container Size: Large\\\n",
2424
"LSST Science Pipelines version: r29.2.0\\\n",
25-
"Last verified to run: 2026-04-08\\\n",
25+
"Last verified to run: 2026-05-01\\\n",
2626
"Repository: [github.com/lsst/tutorial-notebooks](https://github.com/lsst/tutorial-notebooks)\\\n",
2727
"DOI: [10.11578/rubin/dc.20250909.20](https://doi.org/10.11578/rubin/dc.20250909.20)"
2828
]
@@ -185,7 +185,9 @@
185185
"* `airmass`: Airmass of the telescope pointing.\n",
186186
"* `expTime`: Exposure time, in seconds.\n",
187187
"* `expMidptMJD`: Time at the middle of the exposure, in modified Julian date (MJD).\n",
188-
"* `obsStartMJD`: Time at the start of the exposure, in MJD."
188+
"* `obsStartMJD`: Time at the start of the exposure, in MJD.\n",
189+
"* `mean_seeing`: Initial estimate of seeing, averaged over all detectors, in arcseconds.\n",
190+
"* `mean_maglim`: Initial estimate of PSF magnitude limit, averaged over all detectors, in mags."
189191
]
190192
},
191193
{
@@ -205,7 +207,7 @@
205207
"metadata": {},
206208
"outputs": [],
207209
"source": [
208-
"visits_table = ascii.read(file_path + 'dp2_visits_table.ecsv')\n",
210+
"visits_table = ascii.read(file_path + 'dp2_visits_table_with_iq.ecsv')\n",
209211
"print('Number of visits: ', len(visits_table))\n",
210212
"visits_table[:5]"
211213
]
@@ -451,12 +453,56 @@
451453
"> **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$."
452454
]
453455
},
456+
{
457+
"cell_type": "markdown",
458+
"id": "827a3b55-a35f-4790-82aa-17881385996f",
459+
"metadata": {},
460+
"source": [
461+
"### 2.5. Initial IQ estimates\n",
462+
"\n",
463+
"Plot the initial estimates of seeing and magnitude limit, averaged over all detectors, per visit per filter."
464+
]
465+
},
466+
{
467+
"cell_type": "code",
468+
"execution_count": null,
469+
"id": "30a948a9-ff53-4382-91c1-0fe3a2dadfa2",
470+
"metadata": {},
471+
"outputs": [],
472+
"source": [
473+
"fig, ax = plt.subplots(1, 2, figsize=(10, 4), sharey=True)\n",
474+
"for f, filt in enumerate(filter_names):\n",
475+
" tx = np.where(visits_table['band'] == filt)[0]\n",
476+
" ax[0].hist(visits_table['mean_seeing'][tx], histtype='step', bins=75,\n",
477+
" cumulative=True, log=True,\n",
478+
" linestyle=filter_linestyles[filt], color=filter_colors[filt], label=filt)\n",
479+
" ax[1].hist(visits_table['mean_maglim'][tx], histtype='step', bins=75,\n",
480+
" cumulative=True, log=True,\n",
481+
" linestyle=filter_linestyles[filt], color=filter_colors[filt], label=filt)\n",
482+
" del tx\n",
483+
"ax[1].legend(loc='upper left', ncol=2)\n",
484+
"ax[0].set_xlabel('Mean Seeing [arcsec]')\n",
485+
"ax[1].set_xlabel('Mean Magnitude Limit [mag]')\n",
486+
"ax[0].set_ylabel('Number of visits per filter')\n",
487+
"plt.subplots_adjust(wspace=0)\n",
488+
"plt.suptitle('Binned cumulative distribution of initial visit image quality estimates, by filter')\n",
489+
"plt.show()"
490+
]
491+
},
492+
{
493+
"cell_type": "markdown",
494+
"id": "3f2140cd-d224-425e-a72f-1c887de1acdf",
495+
"metadata": {},
496+
"source": [
497+
"> **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."
498+
]
499+
},
454500
{
455501
"cell_type": "markdown",
456502
"id": "f6b75f4c-4063-4b58-adbc-e8f8db4ae30e",
457503
"metadata": {},
458504
"source": [
459-
"### 2.5. Sky distribution\n",
505+
"### 2.6. Sky distribution\n",
460506
"\n",
461507
"Use the `healpy` package to print the area of one 19-sided HEALPix.\n",
462508
"It is similar to the LSSTCam field of view (FOV) of 9.6 square degrees."
@@ -506,7 +552,7 @@
506552
"id": "c7147dc2-8c53-4d5a-b9d7-f607ada424b4",
507553
"metadata": {},
508554
"source": [
509-
"> **Figure 6:** A 2D histogram illustrating the distribution of DP2 visits on the sky (for all filters, combined)."
555+
"> **Figure 7:** A 2D histogram illustrating the distribution of DP2 visits on the sky (for all filters, combined)."
510556
]
511557
},
512558
{
@@ -567,7 +613,7 @@
567613
"id": "9a9f5399-336e-4a79-be40-29030fec5833",
568614
"metadata": {},
569615
"source": [
570-
"> **Figure 7:** Similar to Figure 6, but for $g$-band visits only."
616+
"> **Figure 8:** Similar to Figure 6, but for $g$-band visits only."
571617
]
572618
},
573619
{
@@ -610,7 +656,17 @@
610656
"\n",
611657
"* `tractId`: A unique integer identifier; the tract number.\n",
612658
"* `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",
613-
"* `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)."
659+
"* `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",
660+
"* `psf_maglim`: The $5\\sigma$ PSF magnitude limit in the $r$ and $i$ bands, in AB magnitudes.\n",
661+
"* `psf_size`: The PSF characteristic width as computed from the determinant radius, in the $r$ and $i$ bands, in pixels.\n",
662+
"\n",
663+
"The magnitude limit and PSF size columns are evaluated from the survey property maps at the center of the tract:\n",
664+
"* `deepCoadd_psf_maglim_consolidated_map_weighted_mean`\n",
665+
"* `deepCoadd_psf_size_consolidated_map_weighted_mean`\n",
666+
"\n",
667+
"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",
668+
"To convert the `psf_size` to a FWHM in arcseconds, use:\n",
669+
"$FWHM = 0.2 \\sigma \\times 2 \\sqrt{2 \\ln(2)}$"
614670
]
615671
},
616672
{
@@ -631,7 +687,7 @@
631687
"metadata": {},
632688
"outputs": [],
633689
"source": [
634-
"tracts_table = ascii.read(file_path + 'dp2_tracts_table.ecsv')\n",
690+
"tracts_table = ascii.read(file_path + 'dp2_tracts_table_with_iq.ecsv')\n",
635691
"print('Number of deep coadd tracts: ', len(tracts_table))\n",
636692
"print('Maximum sky area covered by deep coadd tracts: ', int(len(tracts_table) * 1.66**2),\n",
637693
" ' square degrees.')"
@@ -711,6 +767,34 @@
711767
"del tally"
712768
]
713769
},
770+
{
771+
"cell_type": "markdown",
772+
"id": "963a3d2b-b17d-4edb-bfc3-1635df985896",
773+
"metadata": {},
774+
"source": [
775+
"Some tracts are not fully filled by deep coadd images, and have a `nan` value for the PSF magnitude limit or PSF size.\n",
776+
"Print the total number (and fraction) of $r$- and $i$-band tracts that have sufficient data for the PSF magnitude limit to be estimated."
777+
]
778+
},
779+
{
780+
"cell_type": "code",
781+
"execution_count": null,
782+
"id": "55083a39-f0da-4e33-a192-9e4d1e642b73",
783+
"metadata": {},
784+
"outputs": [],
785+
"source": [
786+
"for filt in ['r', 'i']:\n",
787+
" tally = 0\n",
788+
" tally2 = 0\n",
789+
" for f, flist in enumerate(tracts_table['filters_list']):\n",
790+
" if flist.find(filt) >= 0:\n",
791+
" tally += 1\n",
792+
" if np.isfinite(tracts_table['psf_maglim_' + filt][f]):\n",
793+
" tally2 += 1\n",
794+
" print(filt, tally, tally2, np.round(tally2/tally, 2))\n",
795+
"del tally"
796+
]
797+
},
714798
{
715799
"cell_type": "markdown",
716800
"id": "dfda2aae-4f25-4f99-a4ac-85a4126e64fb",
@@ -745,15 +829,15 @@
745829
"id": "709d29e0-ef46-458e-977b-c3166b6804dd",
746830
"metadata": {},
747831
"source": [
748-
"> **Figure 8:** All of the DP2 tracts for which deep coadd images will exist, in any filter."
832+
"> **Figure 9:** All of the DP2 tracts for which deep coadd images will exist, in any filter."
749833
]
750834
},
751835
{
752836
"cell_type": "markdown",
753837
"id": "f567d17d-18dd-4981-ae5a-841b39e27185",
754838
"metadata": {},
755839
"source": [
756-
"Create a plot that is similar to the one above, but for only tracts that will have a $y$-band deep coadd image."
840+
"Create a plot that is similar to the one above, but for only tracts that will have an $r$-band deep coadd image."
757841
]
758842
},
759843
{
@@ -763,7 +847,7 @@
763847
"metadata": {},
764848
"outputs": [],
765849
"source": [
766-
"show_filter = 'y'\n",
850+
"show_filter = 'r'\n",
767851
"fig, ax = plt.subplots(figsize=(8, 6))\n",
768852
"sp = skyproj.McBrydeSkyproj(ax=ax)\n",
769853
"for i, vertices in enumerate(tracts_table['vertices_deg']):\n",
@@ -784,7 +868,47 @@
784868
"id": "331076de-c131-43a3-b1e7-889185625e10",
785869
"metadata": {},
786870
"source": [
787-
"> **Figure 9:** The DP2 tracts for which $y$-band deep coadd images will exist."
871+
"> **Figure 10:** The DP2 tracts for which $r$-band deep coadd images will exist."
872+
]
873+
},
874+
{
875+
"cell_type": "markdown",
876+
"id": "9df06a00-79f1-4d55-9d47-3aef60528fbe",
877+
"metadata": {},
878+
"source": [
879+
"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."
880+
]
881+
},
882+
{
883+
"cell_type": "code",
884+
"execution_count": null,
885+
"id": "1645927e-6e3c-42f0-a61e-1a7cbde2e64b",
886+
"metadata": {},
887+
"outputs": [],
888+
"source": [
889+
"show_filter = 'r'\n",
890+
"fig, ax = plt.subplots(figsize=(8, 6))\n",
891+
"sp = skyproj.McBrydeSkyproj(ax=ax)\n",
892+
"for i, vertices in enumerate(tracts_table['vertices_deg']):\n",
893+
" flist = str(tracts_table['filters_list'][i])\n",
894+
" if flist.find(show_filter) >= 0:\n",
895+
" if (tracts_table['psf_maglim_r'][i] > 23.0):\n",
896+
" ras = vertices.transpose()[0]\n",
897+
" decs = vertices.transpose()[1]\n",
898+
" sp.draw_polygon(ras, decs, edgecolor=filter_colors[show_filter],\n",
899+
" alpha=0.5, linewidth=0.5, facecolor=None)\n",
900+
"sp.ax.set_xlabel(\"Right Ascension\", fontsize=14)\n",
901+
"sp.ax.set_ylabel(\"Declination\", fontsize=14)\n",
902+
"plt.show()\n",
903+
"del sp, show_filter"
904+
]
905+
},
906+
{
907+
"cell_type": "markdown",
908+
"id": "a1d65a2c-4809-4ecc-9e55-1d703b1794d5",
909+
"metadata": {},
910+
"source": [
911+
"> **Figure 11:** The DP2 tracts for which $r$-band deep coadd images will exist, and have a magnitude limit fainter than 23 mag."
788912
]
789913
},
790914
{
@@ -1087,7 +1211,7 @@
10871211
"id": "599638e6-f98f-46cf-88e1-350287fc23e9",
10881212
"metadata": {},
10891213
"source": [
1090-
"> **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)."
1214+
"> **Figure 12:** 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)."
10911215
]
10921216
},
10931217
{
@@ -1235,7 +1359,7 @@
12351359
"id": "5676c6ae-313e-406e-9998-d514a4bde4e8",
12361360
"metadata": {},
12371361
"source": [
1238-
"> **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."
1362+
"> **Figure 13:** 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."
12391363
]
12401364
},
12411365
{

0 commit comments

Comments
 (0)