From d064e2a319a33b836873a8cce425f6b6481d8669 Mon Sep 17 00:00:00 2001 From: "Warren J. Hack" Date: Thu, 29 Oct 2020 16:45:52 -0400 Subject: [PATCH] Fix problem defining masks for use in point catalog generation (#850) * Fix problem defining masks for use in point catalog generation * Remove un-used wht_scale computation --- drizzlepac/haputils/catalog_utils.py | 5 ++--- drizzlepac/haputils/quality_analysis.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drizzlepac/haputils/catalog_utils.py b/drizzlepac/haputils/catalog_utils.py index d6b18e100..bb7d92a30 100644 --- a/drizzlepac/haputils/catalog_utils.py +++ b/drizzlepac/haputils/catalog_utils.py @@ -657,7 +657,7 @@ def __init__(self, image, param_dict, param_dict_qc, diagnostic_mode, tp_sources self.tp_sources = tp_sources # create mask to reject any sources located less than 10 pixels from a image/chip edge - wht_image = self.image.data.copy() + wht_image = np.nan_to_num(self.image.data, 0.0) binary_inverted_wht = np.where(wht_image == 0, 1, 0) self.exclusion_mask = ndimage.binary_dilation(binary_inverted_wht, iterations=10) @@ -839,8 +839,7 @@ def identify_sources(self, **pars): # Compute separate threshold for each 'region' reg_rms = self.image.bkg_rms_ra * np.sqrt(mask['mask'] / mask['rel_weight'].max()) reg_rms_median = np.nanmedian(reg_rms[reg_rms > 0]) - wht_scale = np.nanmedian(np.sqrt(mask['mask'] / mask['rel_weight'].max())) - log.info("Mask {}: rel = {}, wht_scale = {}".format(mask['wht_limit'], mask['rel_weight'].max(), wht_scale)) + log.info("Mask {}: rel = {}".format(mask['wht_limit'], mask['rel_weight'].max())) # find ALL the sources!!! if self.param_dict["starfinder_algorithm"] == "dao": diff --git a/drizzlepac/haputils/quality_analysis.py b/drizzlepac/haputils/quality_analysis.py index 1ec2e1772..48a8c11a8 100644 --- a/drizzlepac/haputils/quality_analysis.py +++ b/drizzlepac/haputils/quality_analysis.py @@ -525,7 +525,7 @@ def run_all(input, files, catalogs=None, log_level=logutil.logging.NOTSET): if catalogs is not None: try: - if not 'json_files' in locals(): # create empty list if there's an exception thrown by determine_alignment_residuals + if not 'json_files' in locals(): # create empty list if there's an exception thrown by determine_alignment_residuals json_files = [] gaia_files = determine_gaia_residuals(catalogs, json_timestamp=json_timestamp,