From fb41d96119521d2f1dc984cafc86581272c81292 Mon Sep 17 00:00:00 2001 From: Michele De La Pena Date: Thu, 16 May 2024 09:16:58 -0400 Subject: [PATCH 1/3] Added the "modest" sized sources (segments < kernel size) to the deblending list as these sources need deblending too. During the update to ease the burden of deblending enormously large sources where the largest sources are ignored, the modest sized sources did not get added to the deblending list as an oversight. --- CHANGELOG.rst | 5 +++++ drizzlepac/haputils/catalog_utils.py | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 87f36cfa5..4916313ae 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,11 @@ number of the code change for that issue. These PRs can be viewed at: 3.7.1 (unreleased) ====================== +- Added the modest and smaller sized segments (segments < kernel size) to + the list of segments to be deblended. These segments were inadvertently + left off the deblending list when the code was updated to handle enormously + large segments. [#] + - Exclude single filter images from the generation of the total detection image to minimize cosmic ray contamination, unless there are only single filter images in the visit. [#1797] diff --git a/drizzlepac/haputils/catalog_utils.py b/drizzlepac/haputils/catalog_utils.py index b72bbcf31..28cca6df5 100755 --- a/drizzlepac/haputils/catalog_utils.py +++ b/drizzlepac/haputils/catalog_utils.py @@ -2794,6 +2794,10 @@ def _evaluate_segmentation_image(self, segm_img, image_data, big_island_only=Fal segm_img.big_segments = None big_segments = np.where(segm_img.areas >= deb_limit)[0] + 1 # Segment labels are 1-based + # Get the labels of the modest sized segments as these should also be + # deblended as necessary + modest_segments = np.where(segm_img.areas < deb_limit)[0] + 1 + # The biggest_source may be > max_biggest_source indicating there are "big islands" # and is_poor_quality should be set to True. The is_poor_quality is only an indicator that # a different kernel type or background computation could be tried for improved results. @@ -2841,10 +2845,17 @@ def _evaluate_segmentation_image(self, segm_img, image_data, big_island_only=Fal segm_img.big_segments = big_segments else: segm_img.big_segments = None - log.info("Total number of sources suitable for deblending: {}".format(len(big_segments))) + log.info("Total number of big sources suitable for deblending: {}".format(len(big_segments))) else: log.info("There are no big segments larger than the deblending limit.") + # Add the modest sized segments to the deblending array + if modest_segments.size > 0 and segm_img.big_segments is not None: + segm_img.big_segments = np.concatenate((segm_img.big_segments, modest_segments)) + elif modest_segments.size > 0: + segm_img.big_segments = modest_segments + log.info("Total number of all sources suitable for deblending: {}".format(len(segm_img.big_segments))) + # Always compute the source_fraction so the value can be reported. Setting the # big_island_only parameter allows control over whether the source_fraction should # or should not be ignored. From 21ca8eb4e62ea95526e162036fe3a87a8bb44b0b Mon Sep 17 00:00:00 2001 From: Michele De La Pena Date: Thu, 16 May 2024 09:23:28 -0400 Subject: [PATCH 2/3] Updated Git PR number. --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4916313ae..59b181919 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -23,7 +23,7 @@ number of the code change for that issue. These PRs can be viewed at: - Added the modest and smaller sized segments (segments < kernel size) to the list of segments to be deblended. These segments were inadvertently left off the deblending list when the code was updated to handle enormously - large segments. [#] + large segments. [#1801] - Exclude single filter images from the generation of the total detection image to minimize cosmic ray contamination, unless there are only single From 8fd0c3c110dcd061b8980e3be2d7a1610fa0f7c2 Mon Sep 17 00:00:00 2001 From: Michele De La Pena Date: Thu, 16 May 2024 10:19:25 -0400 Subject: [PATCH 3/3] Added SKIP to a PyTest which should NOT be executed in automated testing as it can take too much time to execute. Further, the test was designed for generating statistics, after the fact, on the quality of the alignment (via RMS) during the processing. --- tests/hap/test_alignpipe_randomlist.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/hap/test_alignpipe_randomlist.py b/tests/hap/test_alignpipe_randomlist.py index 39dc138ec..99fecb4fa 100644 --- a/tests/hap/test_alignpipe_randomlist.py +++ b/tests/hap/test_alignpipe_randomlist.py @@ -56,6 +56,7 @@ def pytest_generate_tests(metafunc): @pytest.mark.bigdata @pytest.mark.slow @pytest.mark.unit +@pytest.mark.skip(reason="Test designed to run *large* numbers of datasets for alignment statistics.") def test_alignpipe_randomlist(tmpdir, dataset): """ Tests which validate whether mosaics can be aligned to an astrometric standard.