From 22925fb2118431ca6a3aaecf51bbe19cd0878e34 Mon Sep 17 00:00:00 2001 From: Michele De La Pena Date: Mon, 20 May 2024 11:53:47 -0400 Subject: [PATCH] Deleted the deprecated parameter, dao_threshold, in astrometric_utils.py/extract_sources(). Removed parameter from any calling functions. --- CHANGELOG.rst | 4 ++++ drizzlepac/haputils/align_utils.py | 1 - drizzlepac/haputils/astrometric_utils.py | 9 +-------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 87f36cfa5..bbc640926 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,10 @@ number of the code change for that issue. These PRs can be viewed at: 3.7.1 (unreleased) ====================== +- Addressed bugs caught by SonarQube static code analysis. Interface + changes listed here: Removed the deprecated parameter, dao_threshold, from + astrometric_utils.py/extract_sources(). [#nnnn] + - 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/align_utils.py b/drizzlepac/haputils/align_utils.py index fce047371..aca1a90fe 100755 --- a/drizzlepac/haputils/align_utils.py +++ b/drizzlepac/haputils/align_utils.py @@ -714,7 +714,6 @@ def find_alignment_sources(self, output=True, dqname='DQ', crclean=False, outroot=outroot, kernel=self.kernel, segment_threshold=self.threshold[chip], - dao_threshold=self.bkg_rms_mean[chip], fwhm=self.kernel_fwhm, **extract_pars) if crclean and crmap is not None: diff --git a/drizzlepac/haputils/astrometric_utils.py b/drizzlepac/haputils/astrometric_utils.py index c223c5387..a55f60118 100644 --- a/drizzlepac/haputils/astrometric_utils.py +++ b/drizzlepac/haputils/astrometric_utils.py @@ -958,8 +958,7 @@ def build_gaussian_kernel(fwhm, npixels): def extract_sources(img, dqmask=None, fwhm=3.0, kernel=None, photmode=None, - segment_threshold=None, dao_threshold=None, - dao_nsigma=3.0, source_box=7, + segment_threshold=None, dao_nsigma=3.0, source_box=7, classify=True, centering_mode="starfind", nlargest=None, outroot=None, plot=False, vmax=None, deblend=False, log_level=logutil.logging.INFO): @@ -988,10 +987,6 @@ def extract_sources(img, dqmask=None, fwhm=3.0, kernel=None, photmode=None, segment_threshold : ndarray or None Value from the image which serves as the limit for determining sources. If None, compute a default value of (background+5*rms(background)). - dao_threshold : float, optional - [Deprecated] This parameter is not used. In fact, it now gets computed - internally using the ``sigma_clipped_bkg()`` function which uses the - ``dao_nsigma`` parameter. dao_nsigma : float This number gets used to determine the threshold for detection of point sources. The threshold gets computed using a simple ``mean + dao_nsigma * rms``, @@ -1456,7 +1451,6 @@ def generate_source_catalog(image, dqname="DQ", output=False, fwhm=3.0, bkg_ra, bkg_median, bkg_rms_ra, bkg_rms_median = compute_2d_background(imgarr, box_size, win_size) threshold = nsigma * bkg_rms_ra - dao_threshold = nsigma * bkg_rms_median (kernel, kernel_psf), kernel_fwhm = build_auto_kernel(imgarr - bkg_ra, whtarr, threshold=threshold, @@ -1470,7 +1464,6 @@ def generate_source_catalog(image, dqname="DQ", output=False, fwhm=3.0, outroot=outroot, kernel=kernel, photmode=photmode, segment_threshold=threshold, - dao_threshold=dao_threshold, fwhm=kernel_fwhm, **detector_pars) del crmap source_cats[chip] = seg_tab