Skip to content

Commit

Permalink
Address identically zero background seen in SBC images (#846)
Browse files Browse the repository at this point in the history
* Pass the total object project "footprint" mask attribute to the HAPCatalogs class.
Streamline computations in the compute_background() method of CatalogImage, in particular
use boolean footprint and inverse footprint masks for efficient computation.  Add code
to accommodate images with identically zero backgrounds (e.g., some SBC images) and modify
other portions of the code to handle this particular case.

* - Removed temporary debug code (e.g., output of FITS images).
- Made a threshold (limit on the percent of zeros) a configuration variable.
- Removed all references to exclusion_mask or exclude_zones_mask and replaced
  with footprint_mask or inv_footprint_mask.
- Streamlined some computations.

* Updated one call to compute_background() which did not have the
zero_percent argument.

* New parameter for the build_kernel() method.

* Re-instate the original first parameter for creating the weight masks as
the attribute of the CatalogImage class and based on the WHT extension of
the input data. the local variable wht_image is unnecessary.

* Make sure the image to the HAPPointCatalog has no nans.
  • Loading branch information
mdlpstsci authored Oct 30, 2020
1 parent ddfb6af commit c0b6871
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 125 deletions.
10 changes: 6 additions & 4 deletions drizzlepac/hapsequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,19 @@ def create_catalog_products(total_obj_list, log_level, diagnostic_mode=False, ph
# Make sure this is re-initialized for the new total product
phot_mode = input_phot_mode

# Generate an "n" exposure mask which has the image footprint set to the number
# of exposures which constitute each pixel.
total_product_obj.generate_footprint_mask()

# Instantiate filter catalog product object
total_product_catalogs = HAPCatalogs(total_product_obj.drizzle_filename,
total_product_obj.configobj_pars.get_pars('catalog generation'),
total_product_obj.configobj_pars.get_pars('quality control'),
total_product_obj.mask,
log_level,
types=input_phot_mode,
diagnostic_mode=diagnostic_mode)

# Generate an "n" exposure mask which has the image footprint set to the number
# of exposures which constitute each pixel.
total_product_obj.generate_footprint_mask()

# Identify sources in the input image and delay writing the total detection
# catalog until the photometric measurements have been done on the filter
# images and some of the measurements can be appended to the total catalog
Expand Down Expand Up @@ -220,6 +221,7 @@ def create_catalog_products(total_obj_list, log_level, diagnostic_mode=False, ph
filter_product_catalogs = HAPCatalogs(filter_product_obj.drizzle_filename,
total_product_obj.configobj_pars.get_pars('catalog generation'),
total_product_obj.configobj_pars.get_pars('quality control'),
total_product_obj.mask,
log_level,
types=phot_mode,
diagnostic_mode=diagnostic_mode,
Expand Down
252 changes: 146 additions & 106 deletions drizzlepac/haputils/catalog_utils.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"region_size": 11,
"flag_trim_value": 5,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"region_size": 11,
"flag_trim_value": 5,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"region_size": 11,
"flag_trim_value": 5,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"region_size": 11,
"flag_trim_value": 65368,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"region_size": 11,
"flag_trim_value": 5,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
"region_size": 11,
"flag_trim_value": 5,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"bkg_skew_threshold":0.5,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
"kernel_sd_aspect_ratio": 0.8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
"region_size": 11,
"flag_trim_value": 5,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"bkg_skew_threshold":0.5,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
"kernel_sd_aspect_ratio": 0.8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
"region_size": 11,
"flag_trim_value": 5,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"bkg_skew_threshold":0.5,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
"kernel_sd_aspect_ratio": 0.8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
"region_size": 11,
"flag_trim_value": 5,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"bkg_skew_threshold":0.5,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
"kernel_sd_aspect_ratio": 0.8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
"region_size": 11,
"flag_trim_value": 5,
"simple_bkg": false,
"zero_percent": 25.0,
"negative_threshold": 0.0,
"negative_percent": 15.0,
"nsigma_clip": 3.0,
"maxiters":3,
"bkg_skew_threshold":0.5,
"maxiters": 3,
"bkg_skew_threshold": 0.5,
"dao": {
"bkgsig_sf": 4.0,
"kernel_sd_aspect_ratio": 0.8,
Expand Down

0 comments on commit c0b6871

Please sign in to comment.