Skip to content

Commit

Permalink
added --null_mask_sci option to coadd_nwgint.py
Browse files Browse the repository at this point in the history
  • Loading branch information
menanteau committed Jul 22, 2016
1 parent 1ea8599 commit 93c2fa4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pixcorrect_test.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo "Will Install to: $PRODUCT_DIR"

source $EUPS_DIR/desdm_eups_setup.sh
setup -v scipy 0.14.0+7
setup -v despyfits 0.5.0+0
setup -v despyfits 0.5.1+2
#setup -v -r ~/build-test/despyfits

export PYTHONPATH=$PRODUCT_DIR/python:$PYTHONPATH
Expand Down
25 changes: 21 additions & 4 deletions python/pixcorrect/coadd_nwgint.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class CoaddZipperInterpNullWeight(PixCorrectMultistep):
DEFAULT_TILENAME = False
DEFAULT_TILEID = False
DEFAULT_ME_WGT_KEEPMASK = False
DEFAULT_NULL_MASK_SCI = '0'

# Fix the step_name for passing the command-line arguments to the classes
null_weights.__class__.step_name = config_section
row_zipper.__class__.step_name = config_section


def __call__(self):
"""
Run row_zipper and null_weights in one step, we run the tasks
Expand Down Expand Up @@ -77,6 +77,9 @@ def __call__(self):
logger.info("Running row_zipper on: %s" % input_image)
row_zipper.step_run(self.sci,self.config)
logger.info("Time ZipperInterp : %s" % elapsed_time(t2))

# Null the sci image only if null_mask_sci !=0
self.null_sci(input_image)

output_image = self.config.get(self.config_section, 'out')
# Special write out
Expand Down Expand Up @@ -113,6 +116,18 @@ def update_sci_header(cls,input_image):
cls.sci.header.add_record(record)


def null_sci(cls, input_image):

null_mask_sci = parse_badpix_mask( cls.config.get(cls.config_section, 'null_mask_sci') )
if null_mask_sci !=0:
logger.info('Nulling science image from null_mask_bits')
kill = np.array(cls.sci.mask & null_mask_sci, dtype=bool)
cls.sci.data[kill] = 0.0
else:
logger.info('Science image was not null')

return

def custom_weight(cls,input_image):
# Make custom weight, that will not zero STAR maskbit
logger.info("Will perform special weighting for multi-epoch input on %s" % input_image)
Expand Down Expand Up @@ -183,10 +198,12 @@ def add_step_args(cls, parser):
"""
null_weights.add_step_args(parser)
row_zipper.add_step_args(parser)
parser.add_argument('--custom_weight', action='store_true',default=cls.DEFAULT_CUSTOM_WEIGHT,
help='Run custom weights for STAR and do not write MSK plane for multi-epoch (me)')
#parser.add_argument('--custom_weight', action='store_true',default=cls.DEFAULT_CUSTOM_WEIGHT,
# help='Run custom weights for STAR and do not write MSK plane for multi-epoch (me)')
parser.add_argument('--me_wgt_keepmask', action='store',default=cls.DEFAULT_ME_WGT_KEEPMASK,
help='Run custom weight and preserve bits and do not write MSK plane for multi-epoch (me)')
help='Run custom weight for multi-epoch (me) WGT_ME and preserve KEEPMASK')
parser.add_argument('--null_mask_sci', action='store',default=cls.DEFAULT_NULL_MASK_SCI,
help='Names of mask bits to null (or an integer mask) on the SCI plane')
parser.add_argument('--headfile', action='store', default=cls.DEFAULT_HEADFILE,
help='Headfile (containing most update information)')
parser.add_argument('--hdupcfg', action='store', default=cls.DEFAULT_HDUPCFG,
Expand Down

0 comments on commit 93c2fa4

Please sign in to comment.