From c92c6624f24a738da15932a55c102b870be9d412 Mon Sep 17 00:00:00 2001 From: Eric Morganson <ericm@illinois.edu> Date: Thu, 14 Jul 2016 17:01:24 +0000 Subject: [PATCH] Marriner Updates 20160713 --- python/pixcorrect/PixCorrectDriver.py | 4 ++-- python/pixcorrect/corr_util.py | 2 +- python/pixcorrect/fix_columns.py | 11 +++++------ python/pixcorrect/make_mask.py | 6 ++++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/python/pixcorrect/PixCorrectDriver.py b/python/pixcorrect/PixCorrectDriver.py index 2423478..2d6669e 100644 --- a/python/pixcorrect/PixCorrectDriver.py +++ b/python/pixcorrect/PixCorrectDriver.py @@ -119,8 +119,8 @@ def main(cls): logging.basicConfig(format="%(asctime)s %(levelname)s:\t%(message)s", level=logging.WARNING) - global logger - logger = logging.getLogger() + #global logger + #logger = logging.getLogger() if args.verbose > 0: verbosity = logging.INFO if args.verbose==1 else logging.DEBUG logger.setLevel(verbosity) diff --git a/python/pixcorrect/corr_util.py b/python/pixcorrect/corr_util.py index 4d059f6..ad2500e 100644 --- a/python/pixcorrect/corr_util.py +++ b/python/pixcorrect/corr_util.py @@ -18,7 +18,7 @@ from pixcorrect import proddir # constants - +global logger logger = logging.getLogger('pixcorrect') # exception classes diff --git a/python/pixcorrect/fix_columns.py b/python/pixcorrect/fix_columns.py index 863c16e..f93fbdb 100644 --- a/python/pixcorrect/fix_columns.py +++ b/python/pixcorrect/fix_columns.py @@ -119,14 +119,14 @@ def __call__(cls, image, bpm): - `image`: DESImage to fix. - `bpm`: DESBPMImage for this CCD """ - #Modified 6/19/2016 + #Modified 7/7/2016 #Use clipLine to fit column slope #Change NEIGHBORS from 10 to 6 #Change VAR_TOLERANCE from 0.5 to 0.25 #Remove lower limit on correction #Change mask bit usage #Correct all correctable pixels, but use only "good" pixels to compute correction - + logger.info('Fixing columns') NEIGHBORS = 6 # Number of comparison columns to seek @@ -138,8 +138,7 @@ def __call__(cls, image, bpm): #fraction of the average number of sky pixels in the reference columns #If the pixel values of a column vary in a bi-stable way, the high pixels may be #interpreted as "objects" and the high variance may not be noticed. - COUNT_TOL = 0.80 - + COUNT_TOL = 0.85 if image.mask is None: raise FixColumnsError('Input image does not have mask') @@ -184,7 +183,7 @@ def __call__(cls, image, bpm): if col_var <= 0.0: logger.info("Error in clipped line fit for column {:d}".format(icol)) continue - + # Now want to collect stats on up to NEIGHBORS nearby columns norm_stats = [] ilow = icol @@ -249,7 +248,7 @@ def __call__(cls, image, bpm): if col_n < COUNT_TOL*norm_n: logger.info('Too few sky pixels to fix column {:d}'.format(icol)) continue - + #Valid correction. Calculate correction & error estimate norm_mean = np.sum(mean*wt)/np.sum(wt) correction = norm_mean - col_mean diff --git a/python/pixcorrect/make_mask.py b/python/pixcorrect/make_mask.py index 05e8813..a313a9d 100644 --- a/python/pixcorrect/make_mask.py +++ b/python/pixcorrect/make_mask.py @@ -79,7 +79,7 @@ def __call__(cls, image, bpm_im, saturate, clear): except: return 1 - # Enable the following kluge code to work with old style BPM's + #====Temporary kluge until we get the new BPMS #Replace CORR with BIAS_COL #bitmask = BPMDEF_CORR #mark = (bpm_im.mask & bitmask) != 0 @@ -140,7 +140,9 @@ def __call__(cls, image, bpm_im, saturate, clear): for icol in biascols: #Clear FUNKY_COL bit if set for all pixels in this column #The reason for clearing the bit is that the FUNKY_COL detection is - #sensitive to hot bias pixels and may flag those columns by "mistake" + #sensitive to hot bias pixels and may flag those columns by "mistake" + #First clear BAD BPM bit if set because of funky column + image.mask[:,icol][bpm_im.mask[:,icol]==BPMDEF_FUNKY_COL] &= ~BADPIX_BPM bpm_im.mask[:,icol] -= (bpm_im.mask[:,icol] & BPMDEF_FUNKY_COL ) #Correctable columns have exactly 1 BIAS_HOT pixel if N_BIAS_HOT[icol] == 1: