Ejemplo n.º 1
0
    def removeSource(self, id):
        """!
        Remove the heavy footprint of a given source and replace with previous noise

        @param[in]  id   id for current source to insert from original footprint dict

        Also restore the mask plane.
        """
        # remove a single source
        # (Replace this source's pixels by noise again.)
        # Do this by finding the source's top-level ancestor
        mi = self.exposure.getMaskedImage()
        im = mi.getImage()
        mask = mi.getMask()

        # use the same algorithm as in remove Source to find the heavy noise footprint
        # which will undo what insertSource(id) does
        usedid = id
        while self.footprints[usedid][
                0] != 0 and not usedid in self.heavies.keys():
            usedid = self.footprints[usedid][0]
        # Re-insert the noise pixels
        fp = self.heavyNoise[usedid]
        fp.insert(im)
        # Clear the THISDET mask plane.
        afwDet.clearMaskFromFootprint(mask, fp, self.thisbitmask)
        afwDet.setMaskFromFootprint(mask, fp, self.otherbitmask)
Ejemplo n.º 2
0
    def removeSource(self, id):
        """!
        Remove the heavy footprint of a given source and replace with previous noise

        @param[in]  id   id for current source to insert from original footprint dict

        Also restore the mask plane.
        """
        # remove a single source
        # (Replace this source's pixels by noise again.)
        # Do this by finding the source's top-level ancestor
        mi = self.exposure.getMaskedImage()
        im = mi.getImage()
        mask = mi.getMask()

        # use the same algorithm as in remove Source to find the heavy noise footprint
        # which will undo what insertSource(id) does
        usedid = id
        while self.footprints[usedid][0] != 0 and not usedid in self.heavies.keys():
            usedid = self.footprints[usedid][0]
        # Re-insert the noise pixels
        fp = self.heavyNoise[usedid]
        fp.insert(im)
        # Clear the THISDET mask plane.
        afwDet.clearMaskFromFootprint(mask, fp, self.thisbitmask)
        afwDet.setMaskFromFootprint(mask, fp, self.otherbitmask)
Ejemplo n.º 3
0
 def insertSource(self, exposure, sourcei):
     # Copy this source's pixels into the image
     mi = exposure.getMaskedImage()
     im = mi.getImage()
     mask = mi.getMask()
     fp = self.heavies[sourcei]
     fp.insert(im)
     afwDet.setMaskFromFootprint(mask, fp, self.thisbitmask)
     afwDet.clearMaskFromFootprint(mask, fp, self.otherbitmask)
Ejemplo n.º 4
0
 def insertSource(self, exposure, sourcei):
     # Copy this source's pixels into the image
     mi = exposure.getMaskedImage()
     im = mi.getImage()
     mask = mi.getMask()
     fp = self.heavies[sourcei]
     fp.insert(im)
     afwDet.setMaskFromFootprint(mask, fp, self.thisbitmask)
     afwDet.clearMaskFromFootprint(mask, fp, self.otherbitmask)
Ejemplo n.º 5
0
 def removeSource(self, exposure, sources, source):
     # remove a single source
     # (Replace this source's pixels by noise again.)
     # Do this by finding the source's top-level ancestor
     mi = exposure.getMaskedImage()
     im = mi.getImage()
     mask = mi.getMask()
     ancestor = source
     j = 0
     while ancestor.getParent():
         ancestor = sources.find(ancestor.getParent())
         j += 1
         if not ancestor or j == 100:
             raise RuntimeError('Source hierarchy too deep, or (more likely) your Source table is botched.')
     # Re-insert the noise pixels
     fp = self.heavyNoise[ancestor.getId()]
     fp.insert(im)
     # Clear the THISDET mask plane.
     afwDet.clearMaskFromFootprint(mask, fp, self.thisbitmask)
     afwDet.setMaskFromFootprint(mask, fp, self.otherbitmask)
Ejemplo n.º 6
0
 def removeSource(self, exposure, sources, source):
     # remove a single source
     # (Replace this source's pixels by noise again.)
     # Do this by finding the source's top-level ancestor
     mi = exposure.getMaskedImage()
     im = mi.getImage()
     mask = mi.getMask()
     ancestor = source
     j = 0
     while ancestor.getParent():
         ancestor = sources.find(ancestor.getParent())
         j += 1
         if not ancestor or j == 100:
             raise RuntimeError(
                 'Source hierarchy too deep, or (more likely) your Source table is botched.'
             )
     # Re-insert the noise pixels
     fp = self.heavyNoise[ancestor.getId()]
     fp.insert(im)
     # Clear the THISDET mask plane.
     afwDet.clearMaskFromFootprint(mask, fp, self.thisbitmask)
     afwDet.setMaskFromFootprint(mask, fp, self.otherbitmask)
Ejemplo n.º 7
0
    def insertSource(self, id):
        """!
        Insert the heavy footprint of a given source into the exposure

        @param[in]  id   id for current source to insert from original footprint dict

        Also adjusts the mask plane to show the source of this footprint.
        """
        # Copy this source's pixels into the image
        mi = self.exposure.getMaskedImage()
        im = mi.getImage()
        mask = mi.getMask()
        # usedid can point either to this source, or to the first parent in the
        # parent chain which has a heavy footprint (or to the topmost parent,
        # which always has one)
        usedid = id
        while self.footprints[usedid][0] != 0 and not usedid in self.heavies.keys():
            usedid = self.footprints[usedid][0]
        fp = self.heavies[usedid]
        fp.insert(im)
        afwDet.setMaskFromFootprint(mask, fp, self.thisbitmask)
        afwDet.clearMaskFromFootprint(mask, fp, self.otherbitmask)
Ejemplo n.º 8
0
    def insertSource(self, id):
        """!
        Insert the heavy footprint of a given source into the exposure

        @param[in]  id   id for current source to insert from original footprint dict

        Also adjusts the mask plane to show the source of this footprint.
        """
        # Copy this source's pixels into the image
        mi = self.exposure.getMaskedImage()
        im = mi.getImage()
        mask = mi.getMask()
        # usedid can point either to this source, or to the first parent in the
        # parent chain which has a heavy footprint (or to the topmost parent,
        # which always has one)
        usedid = id
        while self.footprints[usedid][
                0] != 0 and not usedid in self.heavies.keys():
            usedid = self.footprints[usedid][0]
        fp = self.heavies[usedid]
        fp.insert(im)
        afwDet.setMaskFromFootprint(mask, fp, self.thisbitmask)
        afwDet.clearMaskFromFootprint(mask, fp, self.otherbitmask)