示例#1
0
class SkyMeasurementConfig(Config):
    """Configuration for SkyMeasurementTask"""
    skyIter = Field(dtype=int, default=3, doc="k-sigma rejection iterations for sky scale")
    skyRej = Field(dtype=float, default=3.0, doc="k-sigma rejection threshold for sky scale")
    background = ConfigField(dtype=BackgroundConfig, doc="Background measurement")
    xNumSamples = Field(dtype=int, default=4, doc="Number of samples in x for scaling sky frame")
    yNumSamples = Field(dtype=int, default=4, doc="Number of samples in y for scaling sky frame")
    stats = ConfigField(dtype=SkyStatsConfig, doc="Measurement of sky statistics in the samples")
示例#2
0
class RegisterConfig(Config):
    """Configuration for RegisterTask"""
    matchRadius = Field(dtype=float, default=1.0, doc="Matching radius (arcsec)", check=lambda x: x > 0)
    sipOrder = Field(dtype=int, default=4, doc="Order for SIP WCS", check=lambda x: x > 1)
    sipIter = Field(dtype=int, default=3, doc="Rejection iterations for SIP WCS", check=lambda x: x > 0)
    sipRej = Field(dtype=float, default=3.0, doc="Rejection threshold for SIP WCS", check=lambda x: x > 0)
    warper = ConfigField(dtype=Warper.ConfigClass, doc="Configuration for warping")
class SkyCorrectionConfig(Config):
    """Configuration for SkyCorrectionTask"""
    bgModel = ConfigField(dtype=FocalPlaneBackgroundConfig,
                          doc="Background model")
    sky = ConfigurableField(target=SkyMeasurementTask, doc="Sky measurement")
    detection = ConfigurableField(target=measAlg.SourceDetectionTask,
                                  doc="Detection configuration")
    doDetection = Field(dtype=bool,
                        default=True,
                        doc="Detect sources (to find good sky)?")
    detectSigma = Field(dtype=float,
                        default=5.0,
                        doc="Detection PSF gaussian sigma")
    doBgModel = Field(dtype=bool,
                      default=True,
                      doc="Do background model subtraction?")
    doSky = Field(dtype=bool, default=True, doc="Do sky frame subtraction?")
    binning = Field(dtype=int,
                    default=8,
                    doc="Binning factor for constructing focal-plane images")

    def setDefaults(self):
        Config.setDefaults(self)
        self.detection.reEstimateBackground = False
        self.detection.thresholdPolarity = "both"
        self.detection.doTempLocalBackground = False
        self.detection.thresholdType = "pixel_stdev"
        self.detection.thresholdValue = 3.0
class ProcessCoaddsTogetherConfig(Config):
    images = Field(
        doc="Coadd image DatasetType used as input (one for each band)",
        default="deepCoadd_calexp",
        dtype=str,
    )
    ref = Field(
        doc="Coadd catalog DatasetType reference input (one instance across all bands).",
        default="deepCoadd_ref",
        dtype=str,
    )
    output = Field(
        doc="Output catalog DatasetType (one instance across all bands)",
        default=None,   # Must be overridden by derived classes to a DatasetType known to obs_base
        dtype=str,
    )
    deblendReplacer = ConfigField(
        dtype=NoiseReplacerConfig,
        doc=("Details for how to replace neighbors with noise when applying deblender outputs. "
             "Ignored if `useDeblending == False`.")
    )
    deblendCatalog = Field(
        doc=("Catalog DatasetType from which to extract deblended [Heavy]Footprints (one for each band). "
             "Ignored if 'useDeblending == False'."),
        default="deepCoadd_meas",
        dtype=str,
    )
示例#5
0
class FringeConfig(Config):
    """Fringe subtraction options"""
    # TODO DM-28093: change the doc to specify that these are physical labels
    filters = ListField(dtype=str,
                        default=[],
                        doc="Only fringe-subtract these filters")
    # TODO: remove in DM-27177
    useFilterAliases = Field(
        dtype=bool,
        default=False,
        doc="Search filter aliases during check.",
        deprecated=("Removed with no replacement (FilterLabel has no aliases)."
                    "Will be removed after v22."))
    num = Field(dtype=int, default=30000, doc="Number of fringe measurements")
    small = Field(dtype=int,
                  default=3,
                  doc="Half-size of small (fringe) measurements (pixels)")
    large = Field(dtype=int,
                  default=30,
                  doc="Half-size of large (background) measurements (pixels)")
    iterations = Field(dtype=int,
                       default=20,
                       doc="Number of fitting iterations")
    clip = Field(dtype=float, default=3.0, doc="Sigma clip threshold")
    stats = ConfigField(dtype=FringeStatisticsConfig,
                        doc="Statistics for measuring fringes")
    pedestal = Field(dtype=bool, default=False, doc="Remove fringe pedestal?")
示例#6
0
class MergeDetectionsConfig(PipelineTaskConfig, pipelineConnections=MergeDetectionsConnections):
    """!
    @anchor MergeDetectionsConfig_

    @brief Configuration parameters for the MergeDetectionsTask.
    """
    minNewPeak = Field(dtype=float, default=1,
                       doc="Minimum distance from closest peak to create a new one (in arcsec).")

    maxSamePeak = Field(dtype=float, default=0.3,
                        doc="When adding new catalogs to the merge, all peaks less than this distance "
                        " (in arcsec) to an existing peak will be flagged as detected in that catalog.")
    cullPeaks = ConfigField(dtype=CullPeaksConfig, doc="Configuration for how to cull peaks.")

    skyFilterName = Field(dtype=str, default="sky",
                          doc="Name of `filter' used to label sky objects (e.g. flag merge_peak_sky is set)\n"
                          "(N.b. should be in MergeMeasurementsConfig.pseudoFilterList)")
    skyObjects = ConfigurableField(target=SkyObjectsTask, doc="Generate sky objects")
    priorityList = ListField(dtype=str, default=[],
                             doc="Priority-ordered list of bands for the merge.")
    coaddName = Field(dtype=str, default="deep", doc="Name of coadd")

    def setDefaults(self):
        Config.setDefaults(self)
        self.skyObjects.avoidMask = ["DETECTED"]  # Nothing else is available in our custom mask

    def validate(self):
        super().validate()
        if len(self.priorityList) == 0:
            raise RuntimeError("No priority list provided")
示例#7
0
class ProcessFocusConfig(Config):
    focus = ConfigField(dtype=FocusConfig, doc="Focus determination")
    zemax = DictField(keytype=str, itemtype=str, default={},
                      doc="Mapping from filter name to zemax configuration filename")
    isr = ConfigurableField(target=SubaruIsrTask, doc="Instrument Signature Removal")
    installPsf = ConfigurableField(target=InstallGaussianPsfTask, doc="Install a simple PSF model")
    background = ConfigField(dtype=measAlg.estimateBackground.ConfigClass, doc="Background removal")
    detectAndMeasure = ConfigurableField(target=DetectAndMeasureTask, doc="Source detection and measurement")
    starSelector = ConfigurableField(target=measAlg.ObjectSizeStarSelectorTask,
                                     doc="Star selection algorithm")
    doWrite = Field(dtype=bool, default=True, doc="Write processed image?")

    def setDefaults(self):
        """These defaults are suitable for HSC, but may be useful
        for other cameras if the focus code is employed elsewhere.
        """
        Config.setDefaults(self)
        zemaxBase = os.path.join(os.environ["OBS_SUBARU_DIR"], "hsc", "zemax_config%d_0.0.dat")
        self.zemax = dict([(f, zemaxBase % n) for f,n in [
                    ('g', 9), ('r', 1), ('i', 3), ('z', 5), ('y', 7),
                    ('N921', 5), ('N816', 3), ('N1010', 7), ('N387', 9), ('N515', 9),
                    ]])
        self.load(os.path.join(os.environ["OBS_SUBARU_DIR"], "config", "hsc", "isr.py"))
        self.installPsf.fwhm = 9 # pixels
        self.installPsf.width = 31 # pixels
        self.detectAndMeasure.detection.includeThresholdMultiplier = 3.0
        self.detectAndMeasure.measurement.algorithms.names.add("base_GaussianCentroid")
        self.detectAndMeasure.measurement.slots.centroid = "base_GaussianCentroid"
        # set up simple shape, if available (because focus calibrations are for that)
        # If it's not available, we'll crash later; but we don't want to crash here (brings everything down)!
        if haveSimpleShape:
            self.detectAndMeasure.measurement.algorithms.names.add("ext_simpleShape_SimpleShape")
            self.detectAndMeasure.measurement.algorithms["ext_simpleShape_SimpleShape"].sigma = 5.0 # pixels

        # set up background estimate
        self.background.ignoredPixelMask = ['EDGE', 'NO_DATA', 'DETECTED', 'DETECTED_NEGATIVE', 'BAD']
        self.detectAndMeasure.detection.background.algorithm='LINEAR'
        self.detectAndMeasure.doDeblend = False
        self.starSelector.badFlags = ["base_PixelFlags_flag_edge",
                                      "base_PixelFlags_flag_interpolatedCenter",
                                      "base_PixelFlags_flag_saturatedCenter",
                                      "base_PixelFlags_flag_bad",
                                      ]
        self.starSelector.sourceFluxField = "base_GaussianFlux_flux"
        self.starSelector.widthMax = 20.0
        self.starSelector.widthStdAllowed = 5.0
示例#8
0
class HscFlatCombineConfig(CalibCombineConfig):
    vignette = ConfigField(dtype=VignetteConfig, doc="Vignetting parameters in focal plane coordinates")
    badAmpCcdList = ListField(dtype=int, default=[], doc="List of CCD serial numbers for bad amplifiers")
    badAmpList = ListField(dtype=int, default=[], doc="List of amp serial numbers in CCD")
    maskPlane = Field(dtype=str, default="NO_DATA", doc="Mask plane to set")

    def validate(self):
        CalibCombineConfig.validate(self)
        if len(self.badAmpCcdList) != len(self.badAmpList):
            raise RuntimeError("Length of badAmpCcdList and badAmpList don't match")
示例#9
0
class FringeConfig(Config):
    """Fringe subtraction options"""
    filters = ListField(dtype=str, default=[], doc="Only fringe-subtract these filters")
    num = Field(dtype=int, default=30000, doc="Number of fringe measurements")
    small = Field(dtype=int, default=3, doc="Half-size of small (fringe) measurements (pixels)")
    large = Field(dtype=int, default=30, doc="Half-size of large (background) measurements (pixels)")
    iterations = Field(dtype=int, default=20, doc="Number of fitting iterations")
    clip = Field(dtype=float, default=3.0, doc="Sigma clip threshold")
    stats = ConfigField(dtype=FringeStatisticsConfig, doc="Statistics for measuring fringes")
    pedestal = Field(dtype=bool, default=False, doc="Remove fringe pedestal?")
示例#10
0
class SkyCorrectionConfig(pipeBase.PipelineTaskConfig, pipelineConnections=SkyCorrectionConnections):
    """Configuration for SkyCorrectionTask"""
    bgModel = ConfigField(dtype=FocalPlaneBackgroundConfig, doc="Background model")
    bgModel2 = ConfigField(dtype=FocalPlaneBackgroundConfig, doc="2nd Background model")
    sky = ConfigurableField(target=SkyMeasurementTask, doc="Sky measurement")
    maskObjects = ConfigurableField(target=MaskObjectsTask, doc="Mask Objects")
    doMaskObjects = Field(dtype=bool, default=True, doc="Mask objects to find good sky?")
    doBgModel = Field(dtype=bool, default=True, doc="Do background model subtraction?")
    doBgModel2 = Field(dtype=bool, default=True, doc="Do cleanup background model subtraction?")
    doSky = Field(dtype=bool, default=True, doc="Do sky frame subtraction?")
    binning = Field(dtype=int, default=8, doc="Binning factor for constructing focal-plane images")
    calexpType = Field(dtype=str, default="calexp",
                       doc="Should be set to fakes_calexp if you want to process calexps with fakes in.")

    def setDefaults(self):
        Config.setDefaults(self)
        self.bgModel2.doSmooth = True
        self.bgModel2.minFrac = 0.5
        self.bgModel2.xSize = 256
        self.bgModel2.ySize = 256
        self.bgModel2.smoothScale = 1.0
示例#11
0
class DummyConfig(Config):
    ppdb = ConfigField(dtype=PpdbConfig, doc="Mandatory field")
示例#12
0
 class TestConfig(Config):
     field = ConfigField(dtype=InnerConfig, doc="")
示例#13
0
class SkyCorrectionConfig(pipeBase.PipelineTaskConfig, Config):
    """Configuration for SkyCorrectionTask"""

    rawLinker = pipeBase.InputDatasetField(
        doc=
        "Raw data to provide exp-visit linkage to connect calExp inputs to camera/sky calibs.",
        name="raw",
        scalar=False,
        storageClass="ExposureU",
        dimensions=["instrument", "exposure", "detector"],
    )

    calExpArray = pipeBase.InputDatasetField(
        doc="Input exposures to process",
        name="calexp",
        scalar=False,
        storageClass="ExposureF",
        dimensions=["instrument", "visit", "detector"],
    )
    calBkgArray = pipeBase.InputDatasetField(
        doc="Input background files to use",
        name="calexpBackground",
        scalar=False,
        storageClass="Background",
        dimensions=["instrument", "visit", "detector"],
    )

    camera = pipeBase.InputDatasetField(
        doc="Input camera to use.",
        name="camera",
        scalar=True,
        storageClass="TablePersistableCamera",
        dimensions=["instrument", "calibration_label"],
    )
    skyCalibs = pipeBase.InputDatasetField(
        doc="Input sky calibrations to use.",
        name="sky",
        scalar=False,
        storageClass="ExposureF",
        dimensions=[
            "instrument", "physical_filter", "detector", "calibration_label"
        ],
    )

    calExpCamera = pipeBase.OutputDatasetField(
        doc="Output camera image.",
        name='calexp_camera',
        scalar=True,
        storageClass="ImageF",
        dimensions=["instrument", "visit"],
    )
    skyCorr = pipeBase.OutputDatasetField(
        doc="Output sky corrected images.",
        name='skyCorr',
        scalar=False,
        storageClass="Background",
        dimensions=["instrument", "visit", "detector"],
    )

    bgModel = ConfigField(dtype=FocalPlaneBackgroundConfig,
                          doc="Background model")
    bgModel2 = ConfigField(dtype=FocalPlaneBackgroundConfig,
                           doc="2nd Background model")
    sky = ConfigurableField(target=SkyMeasurementTask, doc="Sky measurement")
    maskObjects = ConfigurableField(target=MaskObjectsTask, doc="Mask Objects")
    doMaskObjects = Field(dtype=bool,
                          default=True,
                          doc="Mask objects to find good sky?")
    doBgModel = Field(dtype=bool,
                      default=True,
                      doc="Do background model subtraction?")
    doBgModel2 = Field(dtype=bool,
                       default=True,
                       doc="Do cleanup background model subtraction?")
    doSky = Field(dtype=bool, default=True, doc="Do sky frame subtraction?")
    binning = Field(dtype=int,
                    default=8,
                    doc="Binning factor for constructing focal-plane images")
    calexpType = Field(
        dtype=str,
        default="calexp",
        doc=
        "Should be set to fakes_calexp if you want to process calexps with fakes in."
    )

    def setDefaults(self):
        Config.setDefaults(self)
        self.bgModel2.doSmooth = True
        self.bgModel2.minFrac = 0.5
        self.bgModel2.xSize = 256
        self.bgModel2.ySize = 256
        self.bgModel2.smoothScale = 1.0

        self.quantum.dimensions = ("instrument", "visit")
示例#14
0
 class TestConfig(Config):
     field = ConfigField(dtype=ApdbConfig,
                         default=self._dummyApdbConfig(), doc="")
示例#15
0
 class TestConfig(Config):
     field1 = Field(dtype=int, doc="")
     field2 = ConfigField(dtype=ApdbConfig,
                          default=self._dummyApdbConfig(), doc="")
     field3 = Field(dtype=str, doc="")
class BaseConvolvedFluxConfig(Config):
    # convolution
    seeing = ListField(dtype=float, default=[3.5, 5.0, 6.5], doc="list of target seeings (FWHM, pixels)")
    kernelScale = Field(dtype=float, default=4.0, doc="scaling factor of kernel sigma for kernel size")
    # aperture flux
    aperture = ConfigField(dtype=ApertureFluxConfig, doc="Aperture photometry parameters")
    # Kron flux
    kronRadiusName = Field(dtype=str, default="ext_photometryKron_KronFlux_radius",
                           doc="name of Kron radius field in reference")
    maxSincRadius = Field(dtype=float, default=10.0,
                          doc="Largest aperture for which to use the sinc aperture code for Kron (pixels)")
    kronRadiusForFlux = Field(dtype=float, default=2.5, doc="Number of Kron radii for Kron flux")
    registerForApCorr = Field(dtype=bool, default=True,
                              doc="Register measurements for aperture correction?\n"
                                  "The aperture correction registration is done when the plugin is\n"
                                  "instantiated because the column names are derived from the configuration\n"
                                  "rather than being static. Sometimes you want to turn this off, e.g.,\n"
                                  "when you will use aperture corrections derived from somewhere else\n"
                                  "through the 'proxy' mechanism.")

    def setDefaults(self):
        Config.setDefaults(self)
        # Don't need the full set of apertures because the larger ones aren't affected by the convolution
        self.aperture.radii = [3.3, 4.5, 6.0]

    def getBaseNameForSeeing(self, seeing, name=PLUGIN_NAME):
        """Return base name for measurement, given seeing

        Parameters
        ----------
        seeing : `float`
            The seeing value; it is required that the `ConvolvedFluxConfig.seeing` list
            include this value.
        name : `str`, optional
            The name of the plugin.

        Returns
        -------
        baseName : `str`
            Base name for measurement with nominated seeing.
        """
        indices = [ii for ii, target in enumerate(self.seeing) if seeing == target]
        if len(indices) != 1:
            raise RuntimeError("Unable to uniquely identify index for seeing %f: %s" % (seeing, indices))
        return name + "_%d" % (indices[0],)

    def getApertureResultName(self, seeing, radius, name=PLUGIN_NAME):
        """Return name for aperture measurement result

        Parameters
        ----------
        seeing : `float`
            The seeing value; it is required that the `ConvolvedFluxConfig.seeing` list
            include this value.
        radius : `float`
            The aperture radius. If this doesn't correspond to a value in the
            `ConvolvedFluxConfig.aperture.radii` then the returned name may not be useful.
        name : `str`, optional
            The name of the plugin.

        Returns
        -------
        resultName : `str`
            Result name for aperture measurement with nominated seeing and radius.
        """
        baseName = self.getBaseNameForSeeing(seeing, name=name)
        return lsst.meas.base.CircularApertureFluxAlgorithm.makeFieldPrefix(baseName, radius)

    def getKronResultName(self, seeing, name=PLUGIN_NAME):
        """Return name for Kron measurement result

        Parameters
        ----------
        seeing : `float`
            The seeing value; it is required that the `ConvolvedFluxConfig.seeing` list
            include this value.
        name : `str`, optional
            The name of the plugin.

        Returns
        -------
        resultName : `str`
            Result name for Kron measurement with nominated seeing.
        """
        return self.getBaseNameForSeeing(seeing, name=name) + "_kron"

    def getAllApertureResultNames(self, name=PLUGIN_NAME):
        """Return all names for aperture measurements

        Parameters
        ----------
        name : `str`, optional
            The name of the plugin.

        Returns
        -------
        results : `list` of `str`
            List of names for aperture measurements (for all seeings)
        """
        return [lsst.meas.base.CircularApertureFluxAlgorithm.makeFieldPrefix(seeingName, radius) for
                seeingName in [name + "_%d" % (ii,) for ii in range(len(self.seeing))] for
                radius in self.aperture.radii]

    def getAllKronResultNames(self, name=PLUGIN_NAME):
        """Return all names for Kron measurements

        Parameters
        ----------
        name : `str`, optional
            The name of the plugin.

        Returns
        -------
        results : `list` of `str`
            List of names for Kron measurements (for all seeings)
        """
        return [name + "_%d_kron" % (ii,) for ii in range(len(self.seeing))]

    def getAllResultNames(self, name=PLUGIN_NAME):
        """Return all names for measurements

        Parameters
        ----------
        name : `str`, optional
            The name of the plugin.

        Returns
        -------
        results : `list` of `str`
            List of names for measurements (for all seeings and apertures and Kron)
        """
        return self.getAllApertureResultNames(name=name) + self.getAllKronResultNames(name=name)
class MuonConfig(Config):
    # TODO: strip this down to remove bloat
#    detection = ConfigField(dtype=SourceDetectionTask.ConfigClass, doc="Detection config")
    background = ConfigField(dtype=BackgroundConfig, doc="Background subtraction config")