Skip to content

Commit

Permalink
Fixed a bug associated with a previous commit when computing statistics
Browse files Browse the repository at this point in the history
on the illuminated portion only of the drizzled image.  The computation
now uses the footprint_mask computed on the DRZ CTX image which reports
the number of images which contributed to the final pixel value.  If the
CTX > 0, then the pixel is illuminated.
  • Loading branch information
mdlpstsci committed Nov 7, 2024
1 parent c4161f9 commit 6827b1d
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 6827b1d

Please sign in to comment.