Coverage for python/lsst/obs/decam/isr.py : 30%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # LSST Data Management System # Copyright 2012-2015 LSST Corporation. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. #
dtype=str, doc="Names of the backplanes for CCDs showing bias jump due to " + "the simultaneous readout of the smaller ancillary CCDs.", default=['DECAM_BKP3', 'DECAM_BKP5', 'DECAM_BKP1', 'DECAM_BKP4'], ) dtype=int, doc="The y distance of the bias jump location measured in units " + "of pixels from the readout corner; this should be the y " + "dimension of the smaller ancillary CCDs.", default=2098, ) dtype=int, doc="Number of edge pixels to be flagged as untrustworthy.", default=35, )
"""No conversion necessary. """ return exp
"""Mask defects and edges, interpolate over defects in place
Mask defect pixels using mask plane BAD and interpolate over them. Mask the potentially problematic glowing edges as SUSPECT.
Parameters ---------- ccdExposure : `lsst.afw.image.Exposure` exposure to process defectBaseList : `list` a list of defects to mask and interpolate
Returns ------- ccdExposure : `lsst.afw.image.Exposure` exposure corrected in place """ IsrTask.maskAndInterpDefect(self, ccdExposure, defectBaseList) maskedImage = ccdExposure.getMaskedImage() goodBBox = maskedImage.getBBox() # This makes a bbox numEdgeSuspect pixels smaller than the image on each side goodBBox.grow(-self.config.numEdgeSuspect) # Mask pixels outside goodBBox as SUSPECT SourceDetectionTask.setEdgeBits( maskedImage, goodBBox, maskedImage.getMask().getPlaneBitMask("SUSPECT") )
"""Apply overscan correction in place
If the input exposure is on the readout backplanes listed in config.overscanBiasJumpBKP, cut the amplifier in two vertically and correct each piece separately.
Parameters ---------- exposure: `lsst.afw.image.Exposure` exposure to process; must include both DataSec and BiasSec pixels amp: `lsst.afw.table.AmpInfoRecord` amplifier device data
Returns ------- exposure: `lsst.afw.image.Exposure` exposure corrected in place with updated metadata """ if not (exposure.getMetadata().exists('FPA') and exposure.getMetadata().getScalar('FPA') in self.config.overscanBiasJumpBKP): IsrTask.overscanCorrection(self, exposure, amp) return
dataBox = amp.getRawDataBBox() overscanBox = amp.getRawHorizontalOverscanBBox()
if amp.getReadoutCorner() in (afwTable.LL, afwTable.LR): yLower = self.config.overscanBiasJumpLocation yUpper = dataBox.getHeight() - yLower else: yUpper = self.config.overscanBiasJumpLocation yLower = dataBox.getHeight() - yUpper
lowerDataBBox = afwGeom.Box2I(dataBox.getBegin(), afwGeom.Extent2I(dataBox.getWidth(), yLower)) upperDataBBox = afwGeom.Box2I(dataBox.getBegin() + afwGeom.Extent2I(0, yLower), afwGeom.Extent2I(dataBox.getWidth(), yUpper)) lowerOverscanBBox = afwGeom.Box2I(overscanBox.getBegin(), afwGeom.Extent2I(overscanBox.getWidth(), yLower)) upperOverscanBBox = afwGeom.Box2I(overscanBox.getBegin() + afwGeom.Extent2I(0, yLower), afwGeom.Extent2I(overscanBox.getWidth(), yUpper))
maskedImage = exposure.getMaskedImage() lowerDataView = maskedImage.Factory(maskedImage, lowerDataBBox) upperDataView = maskedImage.Factory(maskedImage, upperDataBBox)
expImage = exposure.getMaskedImage().getImage() lowerOverscanImage = expImage.Factory(expImage, lowerOverscanBBox) upperOverscanImage = expImage.Factory(expImage, upperOverscanBBox)
sctrl = afwMath.StatisticsControl() sctrl.setNumSigmaClip(self.config.overscanNumSigmaClip)
overscanCorrection( ampMaskedImage=lowerDataView, overscanImage=lowerOverscanImage, fitType=self.config.overscanFitType, order=self.config.overscanOrder, statControl=sctrl, ) overscanCorrection( ampMaskedImage=upperDataView, overscanImage=upperOverscanImage, fitType=self.config.overscanFitType, order=self.config.overscanOrder, statControl=sctrl, )
# Note that overscan correction has been done in exposure metadata metadata = exposure.getMetadata() metadata.set('OVERSCAN', 'Overscan corrected on {0}'.format( dt.datetime.now().strftime("%Y-%m-%dT%H:%M:%S"))) exposure.setMetadata(metadata) |