Ejemplo n.º 1
0
 def __init__(self, schema, **kwargs):
     Task.__init__(self, **kwargs)
     self.schema = schema
     self._keys = dict((
         f,
         self.schema.addField(f, type="Flag", doc="Propagated from visits"))
                       for f in self.config.flags)
Ejemplo n.º 2
0
 def __init__(self, schema, isSingleFrame=False, **kwargs):
     Task.__init__(self, **kwargs)
     self.schema = schema
     self.isSingleFrame = isSingleFrame
     if not self.isSingleFrame:
         primaryDoc = (
             "true if source has no children and is in the inner region of a coadd patch "
             "and is in the inner region of a coadd tract "
             "and is not \"detected\" in a pseudo-filter (see config.pseudoFilterList)"
         )
         self.isPatchInnerKey = self.schema.addField(
             "detect_isPatchInner",
             type="Flag",
             doc="true if source is in the inner region of a coadd patch",
         )
         self.isTractInnerKey = self.schema.addField(
             "detect_isTractInner",
             type="Flag",
             doc="true if source is in the inner region of a coadd tract",
         )
     else:
         primaryDoc = "true if source has no children and is not a sky source"
     self.isPrimaryKey = self.schema.addField(
         "detect_isPrimary",
         type="Flag",
         doc=primaryDoc,
     )
 def __init__(self, columnName=None, schema=None, doc=None, **kwargs):
     Task.__init__(self, **kwargs)
     assert columnName is not None, "columnName not provided"
     assert schema is not None, "schema not provided"
     self.columnName = columnName
     self.key = schema.addField(self.columnName + "_reserved",
                                type="Flag",
                                doc=doc)
Ejemplo n.º 4
0
    def __init__(self, butler=None, schema=None, **kwargs):
        """Initialize the task.

        BaseReferencesTask and its subclasses take two keyword arguments beyond the usual Task arguments:
         - schema: the Schema of the reference catalog
         - butler: a butler that will allow the task to load its Schema from disk.
        At least one of these arguments must be present; if both are, schema takes precedence.
        """
        Task.__init__(self, **kwargs)
Ejemplo n.º 5
0
    def __init__(self, schema, isSingleFrame=False, **kwargs):
        Task.__init__(self, **kwargs)
        self.schema = schema
        self.isSingleFrame = isSingleFrame
        self.includeDeblend = False
        if not self.isSingleFrame:
            primaryDoc = (
                "true if source has no children and is in the inner region of a coadd patch "
                "and is in the inner region of a coadd tract "
                "and is not \"detected\" in a pseudo-filter (see config.pseudoFilterList)"
            )
            self.isPatchInnerKey = self.schema.addField(
                "detect_isPatchInner",
                type="Flag",
                doc="true if source is in the inner region of a coadd patch",
            )
            self.isTractInnerKey = self.schema.addField(
                "detect_isTractInner",
                type="Flag",
                doc="true if source is in the inner region of a coadd tract",
            )
        else:
            primaryDoc = "true if source has no children and is not a sky source"
        self.isPrimaryKey = self.schema.addField(
            "detect_isPrimary",
            type="Flag",
            doc=primaryDoc,
        )

        if "deblend_nChild" in schema.getNames():
            self.includeDeblend = True
            self.isDeblendedSourceKey = self.schema.addField(
                "detect_isDeblendedSource",
                type="Flag",
                doc=primaryDoc +
                " and is either an unblended isolated source or a "
                "deblended child from a parent with 'deblend_nChild' > 1")
            self.fromBlendKey = self.schema.addField(
                "detect_fromBlend",
                type="Flag",
                doc=
                "This source is deblended from a parent with more than one child."
            )
            self.isIsolatedKey = self.schema.addField(
                "detect_isIsolated",
                type="Flag",
                doc="This source is not a part of a blend.")
            if "deblend_scarletFlux" in schema.getNames():
                self.isDeblendedModelKey = self.schema.addField(
                    "detect_isDeblendedModelSource",
                    type="Flag",
                    doc=primaryDoc + " and is a deblended child")
            else:
                self.isDeblendedModelKey = None
Ejemplo n.º 6
0
    def __init__(self, butler=None, refObjLoader=None, **kwargs):
        Task.__init__(self, **kwargs)
        if not refObjLoader:
            if butler:
                if not isinstance(self.config, DirectMatchConfig):
                    raise RuntimeError("DirectMatchTask must be initialized with DirectMatchConfig "
                                       "if a refObjLoader is not supplied at initialization")
                self.makeSubtask("refObjLoader", butler=butler)
            else:
                self.refObjLoader = None

        else:
            self.refObjLoader = refObjLoader
        self.makeSubtask("sourceSelection")
        self.makeSubtask("referenceSelection")
Ejemplo n.º 7
0
    def __init__(self, butler=None, refObjLoader=None, **kwargs):
        """!Ctor

        Either a 'butler' or 'refObjLoader' is required.

        @param butler  Data butler, or None
        @param refObjLoader  For loading reference objects (lsst.meas.algorithms.LoadReferenceObjectsTask), or
            None
        @param kwargs  Other keyword arguments required for instantiating a Task (e.g., 'config')
        """
        Task.__init__(self, **kwargs)
        if not refObjLoader:
            self.makeSubtask("refObjLoader", butler=butler)
        else:
            self.refObjLoader = refObjLoader
Ejemplo n.º 8
0
    def __init__(self, butler=None, refObjLoader=None, **kwargs):
        Task.__init__(self, **kwargs)
        if not refObjLoader:
            if butler:
                if not isinstance(self.config, DirectMatchConfig):
                    raise RuntimeError("DirectMatchTask must be initialized with DirectMatchConfig "
                                       "if a refObjLoader is not supplied at initialization")
                self.makeSubtask("refObjLoader", butler=butler)
            else:
                self.refObjLoader = None

        else:
            self.refObjLoader = refObjLoader
        self.makeSubtask("sourceSelection")
        self.makeSubtask("referenceSelection")
Ejemplo n.º 9
0
 def __init__(self, schema, **kwargs):
     Task.__init__(self, **kwargs)
     self.schema = schema
     self.isPatchInnerKey = self.schema.addField(
         "detect.is-patch-inner", type="Flag",
         doc="true if source is in the inner region of a coadd patch",
     )
     self.isTractInnerKey = self.schema.addField(
         "detect.is-tract-inner", type="Flag",
         doc="true if source is in the inner region of a coadd tract",
     )
     self.isPrimaryKey = self.schema.addField(
         "detect.is-primary", type="Flag",
         doc="true if source has no children and is in the inner region of a coadd patch " \
             + "and is in the inner region of a coadd tract",
     )
Ejemplo n.º 10
0
 def __init__(self, schema, **kwargs):
     Task.__init__(self, **kwargs)
     self.schema = schema
     self.isPatchInnerKey = self.schema.addField(
         "detect_isPatchInner", type="Flag", doc="true if source is in the inner region of a coadd patch"
     )
     self.isTractInnerKey = self.schema.addField(
         "detect_isTractInner", type="Flag", doc="true if source is in the inner region of a coadd tract"
     )
     self.isPrimaryKey = self.schema.addField(
         "detect_isPrimary",
         type="Flag",
         doc="true if source has no children and is in the inner region of a coadd patch "
         + "and is in the inner region of a coadd tract "
         'and is not "detected" in a pseudo-filter (see config.pseudoFilterList)',
     )
    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")
Ejemplo n.º 12
0
 def __init__(self, schema, **kwargs):
     Task.__init__(self, **kwargs)
     self.schema = schema
     self.isPatchInnerKey = self.schema.addField(
         "detect_isPatchInner",
         type="Flag",
         doc="true if source is in the inner region of a coadd patch",
     )
     self.isTractInnerKey = self.schema.addField(
         "detect_isTractInner",
         type="Flag",
         doc="true if source is in the inner region of a coadd tract",
     )
     self.isPrimaryKey = self.schema.addField(
         "detect_isPrimary", type="Flag",
         doc="true if source has no children and is in the inner region of a coadd patch " \
             + "and is in the inner region of a coadd tract "
               "and is not \"detected\" in a pseudo-filter (see config.pseudoFilterList)",
     )
    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")
Ejemplo n.º 14
0
    def __init__(self, butler=None, refObjLoader=None, **kwargs):
        """!Ctor

        Either a 'butler' or 'refObjLoader' is required.

        @param butler  Data butler, or None
        @param refObjLoader  For loading reference objects (lsst.meas.algorithms.LoadReferenceObjectsTask), or
            None
        @param kwargs  Other keyword arguments required for instantiating a Task (e.g., 'config')
        """
        Task.__init__(self, **kwargs)
        if not refObjLoader:
            if not isinstance(self.config, DirectMatchConfig):
                raise RuntimeError("DirectMatchTask must be initialized with DirectMatchConfig "
                                   "if a refObjLoader is not supplied at initialization")
            self.makeSubtask("refObjLoader", butler=butler)
        else:
            self.refObjLoader = refObjLoader
        self.makeSubtask("sourceSelection")
        self.makeSubtask("referenceSelection")
Ejemplo n.º 15
0
 def __init__(self, *args, **kwargs):
     Task.__init__(self, *args, **kwargs)
     self.makeSubtask("background")
Ejemplo n.º 16
0
 def __init__(self):
     Task.__init__(self)
Ejemplo n.º 17
0
 def __init__(self, *args, **kwargs):
     Task.__init__(self, *args, **kwargs)
     self.makeSubtask("stats")
Ejemplo n.º 18
0
 def __init__(self, *args, **kwargs):
     Task.__init__(self, *args, **kwargs)
     self.makeSubtask("stats")
Ejemplo n.º 19
0
 def __init__(self, config: ComputeVisitRegionsConfig, *, butler: Butler,
              **kwargs: Any):
     Task.__init__(self, config=config, **kwargs)
     self.butler = butler
     self.instrumentMap = {}
Ejemplo n.º 20
0
 def __init__(self, schema, **kwargs):
     Task.__init__(self, **kwargs)
     self.schema = schema
     self._keys = dict((f, self.schema.addField(f, type="Flag", doc="Propagated from visits")) for
                       f in self.config.flags)
Ejemplo n.º 21
0
 def __init__(self, config: GroupExposuresConfig, **kwargs: Any):
     Task.__init__(self, config=config, **kwargs)
 def __init__(self, columnName=None, schema=None, doc=None, **kwargs):
     Task.__init__(self, **kwargs)
     assert columnName is not None, "columnName not provided"
     assert schema is not None, "schema not provided"
     self.columnName = columnName
     self.key = schema.addField(self.columnName + "_reserved", type="Flag", doc=doc)