Skip to content

Commit

Permalink
HLA-1370: Fixed a bug from a previous commit for computing statistics (
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlpstsci authored Nov 11, 2024
1 parent 114504f commit 2420032
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drizzlepac/haputils/catalog_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 2420032

Please sign in to comment.