示例#1
0
    def getImage(self, ccd, amp=None, imageFactory=None):
        """Return an image of dlnI/dr"""

        ccdNum = ccd.getId().getSerial()

        try:
            if self.kwargs.get("ccd") is not None and not ccdNum in self.kwargs.get("ccd"):
                raise RuntimeError

            dataId = self.kwargs
            if dataId.has_key("ccd"):
                dataId = self.kwargs.copy()
                del dataId["ccd"]

            raw = cgUtils.trimExposure(self.butler.get("raw", ccd=ccdNum, immediate=True, **dataId).convertF(),
                                       subtractBias=True, rotate=True)

            if False:
                msk = raw.getMaskedImage().getMask()
                BAD=msk.getPlaneBitMask("BAD")
                msk |= BAD
                msk[15:-15, 0:-20] &= ~BAD
        except Exception, e:
            if self.verbose and str(e):
                print e

            ccdImage = afwImage.ImageF(*ccd.getAllPixels(self.isTrimmed).getDimensions())
            if self.bin:
                ccdImage = afwMath.binImage(ccdImage, self.bin)

            return ccdImage
示例#2
0
    def getImage(self, ccd, amp=None, imageFactory=None):
        """Return an image of dlnI/dr"""

        ccdNum = ccd.getId().getSerial()

        try:
            if self.kwargs.get("ccd") is not None and ccdNum not in self.kwargs.get("ccd"):
                raise RuntimeError

            dataId = self.kwargs
            if "ccd" in dataId:
                dataId = self.kwargs.copy()
                del dataId["ccd"]

            raw = cgUtils.trimExposure(self.butler.get("raw", ccd=ccdNum, immediate=True,
                                                       **dataId).convertF(),
                                       subtractBias=True, rotate=True)

            if False:
                msk = raw.getMaskedImage().getMask()
                BAD = msk.getPlaneBitMask("BAD")
                msk |= BAD
                msk[15:-15, 0:-20] &= ~BAD
        except Exception as e:
            if self.verbose and str(e):
                print(e)

            ccdImage = afwImage.ImageF(*ccd.getAllPixels(self.isTrimmed).getDimensions())
            if self.bin:
                ccdImage = afwMath.binImage(ccdImage, self.bin)

            return ccdImage

        return fitPatches(raw, bin=self.bin, returnResidualImage=False)[2]
示例#3
0
    def __call__(self, dataId):
        if self.verbose:
            print "Visit %(visit)d CCD%(ccd)03d\r" % dataId

        raw = self.butler.get("raw", immediate=True, **dataId)
        try:
            raw = cgUtils.trimExposure(raw, subtractBias=True, rotate=True)
        except:
            return None

        if False:
            msk=raw.getMaskedImage().getMask()
            BAD=msk.getPlaneBitMask("BAD"); msk |= BAD; msk[15:-15, 20:-20] &= ~BAD

        r, lnGrad, theta = [], [], []
        fitPatches(raw, bin=self.bin, r=r, lnGrad=lnGrad, theta=theta)

        return r, theta, lnGrad
示例#4
0
    def __call__(self, dataId):
        if self.verbose:
            print "Visit %(visit)d CCD%(ccd)03d\r" % dataId

        raw = self.butler.get("raw", immediate=True, **dataId)
        try:
            raw = cgUtils.trimExposure(raw, subtractBias=True, rotate=True)
        except:
            return None

        if False:
            msk = raw.getMaskedImage().getMask()
            BAD = msk.getPlaneBitMask("BAD")
            msk |= BAD
            msk[15:-15, 20:-20] &= ~BAD

        r, lnGrad, theta = [], [], []
        fitPatches(raw, bin=self.bin, r=r, lnGrad=lnGrad, theta=theta)

        return r, theta, lnGrad