Ticket DM-13637


This ticket serves to explain ticket in DM-13637 to help users decide if they want to enable it by setting doPrefilterDefects=True once it get merged. 

CompareWarp decides whether an artifact candidate is ephemeral (and should be clipped) or persistent and should not depending on how many times it appears in the PSF-matched image differences (Warp - SigmaClipped Template Coadd).  The number of times a pixel is an outlier in one of the warps is called the epochCountImage. One failure mode is when a survey is minimally dithered and camera defects line up building up the epochCountImage with these defects.


Where is this a problem:
On the DUD fields there are patches that overlap. Plotting the clipped regions will show patches with minimal clipping.  You might find patches where regions are completely unclipped. If this is the case, you probably want to rerun with this. 


 Solutions:
  1. The best solution would be to add functionality to SourceDetection to ignore specified mask planes. 
  1. Another solution would be to detect without growing,  convert the bad mask plane to spanSets, cut them out of the footprints, then grow the footprints. 
  1. Third option is to pre-filter out the artifact candidates that have < some percentage good pixels.


Results

Overall result is that with the ticket more artifacts are clipped in regions with overlapping defects. 

CLIPPED planes


CLIPPED regions 9813 DEEP:



CLIPPED regions 9697 WIDE:

Note the while the defects are no longer marked clipped this does not strongly affect the wide fields, because the defect overlaps are less frequent. 

Case study:

Case study of HSC-Z, tract=9813, patch=6,7, blinking the following two file shows improvement most everywhere,
/datasets/hsc/repo/rerun/private/yusra/RC2/DM-13637/allBad005/deepCoadd/HSC-Z/9813/6,7.fits
/datasets/hsc/repo/rerun/private/yusra/RC2/DM-14075_v2/deepCoadd/HSC-Z/9813/6,7.fits
with the exception of an edges of a bad amp: