From 2420032df3682cbd5493f7c5e7dd87d8cc7e37cf Mon Sep 17 00:00:00 2001 From: mdlpstsci <mdelapena@stsci.edu> Date: Mon, 11 Nov 2024 13:01:21 -0500 Subject: [PATCH] HLA-1370: Fixed a bug from a previous commit for computing statistics (#1910) --- drizzlepac/haputils/catalog_utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drizzlepac/haputils/catalog_utils.py b/drizzlepac/haputils/catalog_utils.py index 54016f766..ffef2e5e8 100755 --- a/drizzlepac/haputils/catalog_utils.py +++ b/drizzlepac/haputils/catalog_utils.py @@ -275,14 +275,13 @@ def compute_background(self, box_size, win_size, # this for SBC. if (self.imghdu[0].header['DETECTOR'].upper() == "SBC"): num_of_zeros = np.count_nonzero(imgdata[self.footprint_mask] == 0) - num_of_nonzeros = num_of_illuminated_pixels - num_of_zeros # If there are too many background zeros in the image # (> number_of_zeros_in_background_threshold), set the background median to # zero and the background rms to the real rms of the non-zero values in the image. if num_of_zeros / float(num_of_illuminated_pixels) * 100.0 > zero_percent: self.bkg_median = 0.0 - self.bkg_rms_median = stats.tstd(num_of_nonzeros, limits=[0, None], inclusive=[False, True]) + self.bkg_rms_median = stats.tstd(imgdata[self.footprint_mask], limits=[0, None], inclusive=[False, True]) self.bkg_background_ra = np.full_like(imgdata, 0.0) self.bkg_rms_ra = np.full_like(imgdata, self.bkg_rms_median) self.bkg_type = 'zero_background'