def __init__(self, schema, **kwds):
        """!Construct a MeasureApCorrTask

        For every name in lsst.meas.base.getApCorrNameSet():
        - If the corresponding flux fields exist in the schema:
            - Add a new field apcorr_{name}_used
            - Add an entry to the self.toCorrect dict
        - Otherwise silently skip the name
        """
        Task.__init__(self, **kwds)
        self.refFluxKeys = FluxKeys(self.config.refFluxName, schema)
        self.toCorrect = {}  # dict of flux field name prefix: FluxKeys instance
        for name in getApCorrNameSet():
            try:
                self.toCorrect[name] = FluxKeys(name, schema)
            except KeyError:
                # if a field in the registry is missing, just ignore it.
                pass
        self.makeSubtask("sourceSelector")
    def __init__(self, schema, **kwds):
        """!Construct a MeasureApCorrTask

        For every name in lsst.meas.base.getApCorrNameSet():
        - If the corresponding flux fields exist in the schema:
            - Add a new field apcorr_{name}_used
            - Add an entry to the self.toCorrect dict
        - Otherwise silently skip the name
        """
        Task.__init__(self, **kwds)
        self.refFluxKeys = FluxKeys(self.config.refFluxName, schema)
        self.toCorrect = {}  # dict of flux field name prefix: FluxKeys instance
        for name in getApCorrNameSet():
            try:
                self.toCorrect[name] = FluxKeys(name, schema)
            except KeyError:
                # if a field in the registry is missing, just ignore it.
                pass
        self.makeSubtask("sourceSelector")
Exemple #3
0
    def buildApCorrMap(self, detector):
        """Build an ApCorrMap with random linearly-varying fields for all
        flux fields registered for aperture correction.

        These flux field names are used only as strings; there is no
        connection to any actual algorithms with those names or the PSF model.
        """
        order = self.config.apCorrOrder

        def makeRandomBoundedField():
            """Make an upper-left triangular coefficient array appropriate
            for a 2-d polynomial."""
            array = np.zeros((order + 1, order + 1), dtype=float)
            for n in range(order + 1):
                array[n, 0:order + 1 - n] = self.rng.randn(order + 1 - n)
            return lsst.afw.math.ChebyshevBoundedField(bbox, array)

        bbox = detector.getBBox()
        apCorrMap = lsst.afw.image.ApCorrMap()
        for name in getApCorrNameSet():
            apCorrMap.set(name + "_flux", makeRandomBoundedField())
            apCorrMap.set(name + "_fluxSigma", makeRandomBoundedField())
        return apCorrMap
    def buildApCorrMap(self, detector):
        """Build an ApCorrMap with random linearly-varying fields for all
        flux fields registered for aperture correction.

        These flux field names are used only as strings; there is no
        connection to any actual algorithms with those names or the PSF model.
        """
        order = self.config.apCorrOrder

        def makeRandomBoundedField():
            """Make an upper-left triangular coefficient array appropriate
            for a 2-d polynomial."""
            array = np.zeros((order + 1, order + 1), dtype=float)
            for n in range(order + 1):
                array[n, 0:order + 1 - n] = self.rng.randn(order + 1 - n)
            return lsst.afw.math.ChebyshevBoundedField(bbox, array)

        bbox = detector.getBBox()
        apCorrMap = lsst.afw.image.ApCorrMap()
        for name in getApCorrNameSet():
            apCorrMap.set(name + "_instFlux", makeRandomBoundedField())
            apCorrMap.set(name + "_instFluxErr", makeRandomBoundedField())
        return apCorrMap