diff --git a/DP2/100_How_to_use_RSP_tools/103_Image_access_and_display/103_4_Image_display_with_Firefly.ipynb b/DP2/100_How_to_use_RSP_tools/103_Image_access_and_display/103_4_Image_display_with_Firefly.ipynb index 318eb6cf..8772a67f 100644 --- a/DP2/100_How_to_use_RSP_tools/103_Image_access_and_display/103_4_Image_display_with_Firefly.ipynb +++ b/DP2/100_How_to_use_RSP_tools/103_Image_access_and_display/103_4_Image_display_with_Firefly.ipynb @@ -22,7 +22,7 @@ "Data Release: [Data Preview 2](https://dp2.lsst.io/)\\\n", "Container Size: Large\\\n", "LSST Science Pipelines version: v30.0.11\\\n", - "Last verified to run: 2026-08-18\\\n", + "Last verified to run: 2026-10-11\\\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)" ] @@ -81,8 +81,7 @@ "\n", "Import the `Butler` module from the `lsst.daf.butler` package, the `geom` module from `lsst.geom`\n", "(for converting sky coordinates to pixel positions), the `display` module from the `lsst.afw`\n", - "package (for image display), the `get_legacy_deep_coadd_mask_planes` function from `lsst.images`\n", - "(for mapping new mask plane names to legacy names), and the `firefly_client.plot` module (for\n", + "package (for image display), and the `firefly_client.plot` module (for\n", "FireflyClient)." ] }, @@ -97,7 +96,6 @@ "from lsst.daf.butler import Butler\n", "import lsst.geom as geom\n", "import lsst.afw.display as afwDisplay\n", - "from lsst.images import get_legacy_deep_coadd_mask_planes\n", "import firefly_client.plot as ffplt\n", "from astropy.coordinates import SkyCoord\n", "import astropy.units as u" @@ -337,9 +335,8 @@ "outputs": [], "source": [ "mask = deep_coadd.mask\n", - "new_to_old_names = {v.name: k for k, v in get_legacy_deep_coadd_mask_planes().items()}\n", "for mask_key in mask.schema.names:\n", - " print('{}: {}'.format(mask_key, afw_display.getMaskPlaneColor(new_to_old_names[mask_key])))" + " print(\"{}: {}\".format(mask_key, afw_display.getMaskPlaneColor(mask_key)))" ] }, { diff --git a/DP2/100_How_to_use_RSP_tools/103_Image_access_and_display/103_5_Image_display_with_matplotlib.ipynb b/DP2/100_How_to_use_RSP_tools/103_Image_access_and_display/103_5_Image_display_with_matplotlib.ipynb index b06072a3..ae1ed0b9 100644 --- a/DP2/100_How_to_use_RSP_tools/103_Image_access_and_display/103_5_Image_display_with_matplotlib.ipynb +++ b/DP2/100_How_to_use_RSP_tools/103_Image_access_and_display/103_5_Image_display_with_matplotlib.ipynb @@ -22,7 +22,7 @@ "Data Release: [Data Preview 2](https://dp2.lsst.io/)\\\n", "Container Size: Large\\\n", "LSST Science Pipelines version: r30.0.11\\\n", - "Last verified to run: 2026-08-18\\\n", + "Last verified to run: 2026-10-11\\\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)" ] @@ -95,7 +95,6 @@ "source": [ "from lsst.daf.butler import Butler\n", "import lsst.afw.display as afw_display\n", - "from lsst.images import get_legacy_deep_coadd_mask_planes\n", "from astropy.coordinates import SkyCoord\n", "import astropy.units as u\n", "import matplotlib.pyplot as plt\n", @@ -470,10 +469,7 @@ "A mask is composed of a set of \"mask planes\", 2D binary bit maps corresponding to pixels that are masked for various reasons.\n", "\n", "The display framework renders each plane (each bit) of the mask in a different color.\n", - "View the mapping between the mask plane and the color using the following code.\n", - "\n", - "> **Notice:** One of the changes with DP2's [new image types]() is more informative mask names. However, the old mask names and colors are still being used by `afw.display`. The following is a temporary workaround to print new names with the colors defined by `display`. Once this is fixed, mask plane definitions will be able to be printed with \n", - "`print(\"Mask plane bit definitions:\\n\", display1.getMaskPlaneColor())`." + "View the mapping between the mask plane and the color using the following code." ] }, { @@ -484,10 +480,8 @@ "outputs": [], "source": [ "mask = deep_coadd.mask\n", - "new_to_old_convert = {v.name: k for k, v in get_legacy_deep_coadd_mask_planes().items()}\n", - "for new_name in mask.schema.names:\n", - " print('{} {}'.format(new_name,\n", - " display1.getMaskPlaneColor(new_to_old_convert[new_name])))" + "for mask_key in mask.schema.names:\n", + " print(\"{}: {}\".format(mask_key, display1.getMaskPlaneColor(mask_key)))" ] }, { diff --git a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb index c4d7e54a..b9ed6322 100644 --- a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb +++ b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb @@ -24,7 +24,7 @@ "Data Release: [Data Preview 2](https://dp2.lsst.io)\\\n", "Container Size: Large\\\n", "LSST Science Pipelines version: r30.0.11\\\n", - "Last verified to run: 2026-08-18\\\n", + "Last verified to run: 2026-10-11\\\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)" ] @@ -784,6 +784,25 @@ "print(mask.schema)" ] }, + { + "cell_type": "markdown", + "id": "9bf7764f-88e4-4da6-9181-7eb82206ed7e", + "metadata": {}, + "source": [ + "Print the color that `afw_display` uses for each mask key." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1850631b-46c0-4232-9c26-46facd4fca57", + "metadata": {}, + "outputs": [], + "source": [ + "for mask_key in mask.schema.names:\n", + " print(\"{}: {}\".format(mask_key, afw_display.getMaskPlaneColor(mask_key)))" + ] + }, { "cell_type": "markdown", "id": "0d4a01e2-c7cc-4a51-ae63-d1aca98aa7a4", diff --git a/DP2/200_Data_products/202_Images/202_5_Pixel_mask_planes.ipynb b/DP2/200_Data_products/202_Images/202_5_Pixel_mask_planes.ipynb index e22a1067..e1f499fd 100644 --- a/DP2/200_Data_products/202_Images/202_5_Pixel_mask_planes.ipynb +++ b/DP2/200_Data_products/202_Images/202_5_Pixel_mask_planes.ipynb @@ -22,7 +22,7 @@ "Data Release: [Data Preview 2](https://dp2.lsst.io/)\\\n", "Container Size: Large\\\n", "LSST Science Pipelines version: r30.0.11\\\n", - "Last verified to run: 2026-09-09\\\n", + "Last verified to run: 2026-10-11\\\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)" ] @@ -407,6 +407,25 @@ "afw_display.setMaskTransparency(0)" ] }, + { + "cell_type": "markdown", + "id": "ea821824-5f9d-4957-b313-de88c2e8ed89", + "metadata": {}, + "source": [ + "Print the color that `afw_display` uses for each mask plane." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "512267c0-620a-4055-b013-1034516bcd37", + "metadata": {}, + "outputs": [], + "source": [ + "for mask_key in mask.schema.names:\n", + " print(\"{}: {}\".format(mask_key, afw_display.getMaskPlaneColor(mask_key)))" + ] + }, { "cell_type": "markdown", "id": "74769e74", diff --git a/DP2/300_Science_demos/309_Low_surface_brightness/309_1_Visualizing_LSB_features.ipynb b/DP2/300_Science_demos/309_Low_surface_brightness/309_1_Visualizing_LSB_features.ipynb index 4e3b404d..342f6aea 100644 --- a/DP2/300_Science_demos/309_Low_surface_brightness/309_1_Visualizing_LSB_features.ipynb +++ b/DP2/300_Science_demos/309_Low_surface_brightness/309_1_Visualizing_LSB_features.ipynb @@ -22,7 +22,7 @@ "Data Release: [Data Preview 2](https://dp2.lsst.io/) \\\n", "Container Size: large \\\n", "LSST Science Pipelines version: r30.0.11 \\\n", - "Last verified to run: 2026-08-27 \\\n", + "Last verified to run: 2026-10-11 \\\n", "Repository: [github.com/lsst/tutorial-notebooks](https://github.com/lsst/tutorial-notebooks)" ] }, @@ -68,7 +68,7 @@ "source": [ "### 1.1. Import packages\n", "\n", - "`lsst.daf.butler` provides data access; `lsst.geom` handles sky-coordinate and pixel-geometry operations; `lsst.afw.display` renders images with an astronomically appropriate stretch. Standard scientific Python packages (`numpy`, `matplotlib`, `astropy`) handle array operations, visualization, and coordinate arithmetic. `lsst.images.get_legacy_deep_coadd_mask_planes` maps mask plane names back to their legacy equivalents, and `lsst.images.Box` builds pixel bounding boxes for cutout retrieval." + "`lsst.daf.butler` provides data access; `lsst.geom` handles sky-coordinate and pixel-geometry operations; `lsst.afw.display` renders images with an astronomically appropriate stretch. Standard scientific Python packages (`numpy`, `matplotlib`, `astropy`) handle array operations, visualization, and coordinate arithmetic. `lsst.images.Box` builds pixel bounding boxes for cutout retrieval." ] }, { @@ -85,7 +85,7 @@ "import lsst.geom as geom\n", "import lsst.afw.display as afwDisplay\n", "from lsst.daf.butler import Butler\n", - "from lsst.images import Box, get_legacy_deep_coadd_mask_planes" + "from lsst.images import Box" ] }, { @@ -115,7 +115,7 @@ "id": "lsb312-sky-arr-md", "metadata": {}, "source": [ - "`build_sky_arr` masks detected sources and detector artifacts (`DETECTED`, `SAT`, `BRIGHT_OBJECT` etc.) by setting those pixels to `NaN`, so that sky statistics are not biased by bright compact objects." + "`build_sky_arr` masks detected sources and detector artifacts (`DETECTED`, `SATURATED`, `COSMIC_RAY` etc.) by setting those pixels to `NaN`, so that sky statistics are not biased by bright compact objects." ] }, { @@ -128,7 +128,7 @@ "def build_sky_arr(\n", " coadd,\n", " arr,\n", - " bad_planes=(\"SAT\", \"NO_DATA\", \"BAD\", \"CR\", \"BRIGHT_OBJECT\"),\n", + " bad_planes=(\"NO_DATA\", \"SATURATED\", \"COSMIC_RAY\"),\n", " source_planes=(\"DETECTED\",),\n", "):\n", " \"\"\"Return arr with artifact and source pixels set to NaN.\n", @@ -140,26 +140,21 @@ " arr : ndarray, shape (ny, nx)\n", " Pixel array to mask, typically the image or variance plane.\n", " bad_planes : tuple of str, optional\n", - " Legacy mask plane names treated as artifacts.\n", + " Mask plane names treated as artifacts.\n", " source_planes : tuple of str, optional\n", - " Legacy mask plane names treated as detected sources.\n", + " Mask plane names treated as detected sources.\n", "\n", " Returns\n", " -------\n", " masked_arr : ndarray, shape (ny, nx)\n", " Copy of arr with artifact, source, and non-finite pixels set to NaN.\n", " \"\"\"\n", - "\n", - " legacy_to_new = {\n", - " v.name: k for k, v in get_legacy_deep_coadd_mask_planes().items()\n", - " }\n", " mask = coadd.mask\n", " schema_names = {plane.name for plane in mask.schema}\n", " exclude = np.zeros(arr.shape, dtype=bool)\n", " for plane in list(bad_planes) + list(source_planes):\n", - " new_plane = legacy_to_new.get(plane, plane)\n", - " if new_plane in schema_names:\n", - " exclude |= mask.get(new_plane).astype(bool)\n", + " if plane in schema_names:\n", + " exclude |= mask.get(plane).astype(bool)\n", " return np.where(exclude | ~np.isfinite(arr), np.nan, arr)" ] }, diff --git a/DP2/300_Science_demos/309_Low_surface_brightness/309_2_LSB_feature_detection.ipynb b/DP2/300_Science_demos/309_Low_surface_brightness/309_2_LSB_feature_detection.ipynb index ded9b31b..52d9b227 100644 --- a/DP2/300_Science_demos/309_Low_surface_brightness/309_2_LSB_feature_detection.ipynb +++ b/DP2/300_Science_demos/309_Low_surface_brightness/309_2_LSB_feature_detection.ipynb @@ -22,7 +22,7 @@ "Data Release: [Data Preview 2](https://dp2.lsst.io/)\\\n", "Container Size: large\\\n", "LSST Science Pipelines version: r30.0.11\\\n", - "Last verified to run: 2026-08-27\\\n", + "Last verified to run: 2026-10-11\\\n", "Repository: [github.com/lsst/tutorial-notebooks](https://github.com/lsst/tutorial-notebooks)" ] }, @@ -62,7 +62,7 @@ "\n", "### 1.1. Import packages\n", "\n", - "`lsst.daf.butler` and `lsst.geom` access the data; `lsst.afw.display` renders images with an astronomically appropriate stretch. `astropy.visualization` provides `ImageNormalize` and `AsinhStretch` for display; `scipy.ndimage.uniform_filter` powers the normalized convolution inside `adaptive_smooth`. Standard scientific Python packages (`numpy`, `matplotlib`) handle array operations and figures. `lsst.images.get_legacy_deep_coadd_mask_planes` maps mask plane names back to their legacy equivalents, and `lsst.images.Box` builds pixel bounding boxes for cutout retrieval." + "`lsst.daf.butler` and `lsst.geom` access the data; `lsst.afw.display` renders images with an astronomically appropriate stretch. `astropy.visualization` provides `ImageNormalize` and `AsinhStretch` for display; `scipy.ndimage.uniform_filter` powers the normalized convolution inside `adaptive_smooth`. Standard scientific Python packages (`numpy`, `matplotlib`) handle array operations and figures. `lsst.images.Box` builds pixel bounding boxes for cutout retrieval." ] }, { @@ -79,7 +79,7 @@ "\n", "import lsst.geom as geom\n", "from lsst.daf.butler import Butler\n", - "from lsst.images import Box, get_legacy_deep_coadd_mask_planes" + "from lsst.images import Box" ] }, { @@ -139,7 +139,7 @@ "def build_sky_arr(\n", " coadd,\n", " arr,\n", - " bad_planes=(\"SAT\", \"NO_DATA\", \"BAD\", \"CR\", \"BRIGHT_OBJECT\"),\n", + " bad_planes=(\"NO_DATA\", \"SATURATED\", \"COSMIC_RAY\"),\n", " source_planes=(\"DETECTED\",),\n", "):\n", " \"\"\"Return arr with artifact and source pixels set to NaN.\n", @@ -151,25 +151,21 @@ " arr : ndarray, shape (ny, nx)\n", " Pixel array to mask, typically the image or variance plane.\n", " bad_planes : tuple of str, optional\n", - " Legacy mask plane names treated as artifacts.\n", + " Mask plane names treated as artifacts.\n", " source_planes : tuple of str, optional\n", - " Legacy mask plane names treated as detected sources.\n", + " Mask plane names treated as detected sources.\n", "\n", " Returns\n", " -------\n", " masked_arr : ndarray, shape (ny, nx)\n", " Copy of arr with artifact, source, and non-finite pixels set to NaN.\n", " \"\"\"\n", - " legacy_to_new = {\n", - " v.name: k for k, v in get_legacy_deep_coadd_mask_planes().items()\n", - " }\n", " mask = coadd.mask\n", " schema_names = {plane.name for plane in mask.schema}\n", " exclude = np.zeros(arr.shape, dtype=bool)\n", " for plane in list(bad_planes) + list(source_planes):\n", - " new_plane = legacy_to_new.get(plane, plane)\n", - " if new_plane in schema_names:\n", - " exclude |= mask.get(new_plane).astype(bool)\n", + " if plane in schema_names:\n", + " exclude |= mask.get(plane).astype(bool)\n", " return np.where(exclude | ~np.isfinite(arr), np.nan, arr)" ] }, diff --git a/DP2/300_Science_demos/309_Low_surface_brightness/309_3_Tidal_feature_visualization.ipynb b/DP2/300_Science_demos/309_Low_surface_brightness/309_3_Tidal_feature_visualization.ipynb index 8e503c7f..6b143cc8 100644 --- a/DP2/300_Science_demos/309_Low_surface_brightness/309_3_Tidal_feature_visualization.ipynb +++ b/DP2/300_Science_demos/309_Low_surface_brightness/309_3_Tidal_feature_visualization.ipynb @@ -22,7 +22,7 @@ "Data Release: [Data Preview 2](https://dp2.lsst.io/)\\\n", "Container Size: large\\\n", "LSST Science Pipelines version: r30.0.11\\\n", - "Last verified to run: 2026-08-27\\\n", + "Last verified to run: 2026-10-11\\\n", "Repository: [github.com/lsst/tutorial-notebooks](https://github.com/lsst/tutorial-notebooks)" ] }, @@ -65,7 +65,7 @@ "\n", "### 1.1. Import packages\n", "\n", - "`lsst.daf.butler` and `lsst.geom` access the data and handle sky-coordinate and pixel-geometry operations. `astropy.visualization` provides `ImageNormalize` and `AsinhStretch`, which apply a non-linear stretch that compresses the bright galaxy nucleus while preserving faint diffuse structure. Standard scientific Python packages (`numpy`, `matplotlib`) handle array operations and figures. `lsst.images.get_legacy_deep_coadd_mask_planes` maps mask plane names back to their legacy equivalents, and `lsst.images.Box` builds pixel bounding boxes for cutout retrieval." + "`lsst.daf.butler` and `lsst.geom` access the data and handle sky-coordinate and pixel-geometry operations. `astropy.visualization` provides `ImageNormalize` and `AsinhStretch`, which apply a non-linear stretch that compresses the bright galaxy nucleus while preserving faint diffuse structure. Standard scientific Python packages (`numpy`, `matplotlib`) handle array operations and figures. `lsst.images.Box` builds pixel bounding boxes for cutout retrieval." ] }, { @@ -81,7 +81,7 @@ "\n", "import lsst.geom as geom\n", "from lsst.daf.butler import Butler\n", - "from lsst.images import Box, get_legacy_deep_coadd_mask_planes" + "from lsst.images import Box" ] }, { @@ -137,7 +137,7 @@ "def build_sky_arr(\n", " coadd,\n", " arr,\n", - " bad_planes=(\"SAT\", \"NO_DATA\", \"BAD\", \"CR\", \"BRIGHT_OBJECT\"),\n", + " bad_planes=(\"NO_DATA\", \"SATURATED\", \"COSMIC_RAY\"),\n", " source_planes=(\"DETECTED\",),\n", "):\n", " \"\"\"Return arr with artifact and source pixels set to NaN.\n", @@ -149,25 +149,21 @@ " arr : ndarray, shape (ny, nx)\n", " Pixel array to mask, typically the image or variance plane.\n", " bad_planes : tuple of str, optional\n", - " Legacy mask plane names treated as artifacts.\n", + " Mask plane names treated as artifacts.\n", " source_planes : tuple of str, optional\n", - " Legacy mask plane names treated as detected sources.\n", + " Mask plane names treated as detected sources.\n", "\n", " Returns\n", " -------\n", " masked_arr : ndarray, shape (ny, nx)\n", " Copy of arr with artifact, source, and non-finite pixels set to NaN.\n", " \"\"\"\n", - " legacy_to_new = {\n", - " v.name: k for k, v in get_legacy_deep_coadd_mask_planes().items()\n", - " }\n", " mask = coadd.mask\n", " schema_names = {plane.name for plane in mask.schema}\n", " exclude = np.zeros(arr.shape, dtype=bool)\n", " for plane in list(bad_planes) + list(source_planes):\n", - " new_plane = legacy_to_new.get(plane, plane)\n", - " if new_plane in schema_names:\n", - " exclude |= mask.get(new_plane).astype(bool)\n", + " if plane in schema_names:\n", + " exclude |= mask.get(plane).astype(bool)\n", " return np.where(exclude | ~np.isfinite(arr), np.nan, arr)" ] },