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 CalibConfig(Config): """Configuration for constructing calibs""" clobber = Field(dtype=bool, default=True, doc="Clobber existing processed images?") isr = ConfigurableField(target=IsrTask, doc="ISR configuration") dateObs = Field(dtype=str, default="dateObs", doc="Key for observation date in exposure registry") dateCalib = Field(dtype=str, default="calibDate", doc="Key for calib date in calib registry") filter = Field(dtype=str, default="filter", doc="Key for filter name in exposure/calib registries") combination = ConfigurableField(target=CalibCombineTask, doc="Calib combination configuration") ccdKeys = ListField(dtype=str, default=["ccd"], doc="DataId keywords specifying a CCD") visitKeys = ListField(dtype=str, default=["visit"], doc="DataId keywords specifying a visit") calibKeys = ListField(dtype=str, default=[], doc="DataId keywords specifying a calibration") def setDefaults(self): self.isr.doWrite = False
class MaskObjectsConfig(Config): """Configuration for MaskObjectsTask""" nIter = Field(dtype=int, default=3, doc="Number of iterations") subtractBackground = ConfigurableField(target=measAlg.SubtractBackgroundTask, doc="Background subtraction") detection = ConfigurableField(target=measAlg.SourceDetectionTask, doc="Source detection") detectSigma = Field(dtype=float, default=5.0, doc="Detection threshold (standard deviations)") doInterpolate = Field(dtype=bool, default=True, doc="Interpolate when removing objects?") interpolate = ConfigurableField(target=measAlg.SubtractBackgroundTask, doc="Interpolation") def setDefaults(self): self.detection.reEstimateBackground = False self.detection.doTempLocalBackground = False self.detection.doTempWideBackground = False self.detection.thresholdValue = 2.5 self.subtractBackground.binSize = 1024 self.subtractBackground.useApprox = False self.interpolate.binSize = 256 self.interpolate.useApprox = False def validate(self): if (self.detection.reEstimateBackground or self.detection.doTempLocalBackground or self.detection.doTempWideBackground): raise RuntimeError("Incorrect settings for object masking: reEstimateBackground, " "doTempLocalBackground and doTempWideBackground must be False")
class CoaddDriverConfig(Config): coaddName = Field(dtype=str, default="deep", doc="Name for coadd") select = ConfigurableField( target=WcsSelectImagesTask, doc="Select images to process") makeCoaddTempExp = ConfigurableField( target=MakeCoaddTempExpTask, doc="Warp images to sky") doBackgroundReference = Field( dtype=bool, default=False, doc="Build background reference?") backgroundReference = ConfigurableField( target=NullSelectImagesTask, doc="Build background reference") assembleCoadd = ConfigurableField( target=SafeClipAssembleCoaddTask, doc="Assemble warps into coadd") doDetection = Field(dtype=bool, default=True, doc="Run detection on the coaddition product") detectCoaddSources = ConfigurableField( target=DetectCoaddSourcesTask, doc="Detect sources on coadd") def setDefaults(self): self.makeCoaddTempExp.select.retarget(NullSelectImagesTask) self.assembleCoadd.select.retarget(NullSelectImagesTask) self.assembleCoadd.doWrite = False def validate(self): if self.makeCoaddTempExp.coaddName != self.coaddName: raise RuntimeError( "makeCoaddTempExp.coaddName and coaddName don't match") if self.assembleCoadd.coaddName != self.coaddName: raise RuntimeError( "assembleCoadd.coaddName and coaddName don't match") if self.assembleCoadd.matchingKernelSize != self.makeCoaddTempExp.matchingKernelSize: message = ("assembleCoadd.matchingKernelSize (%s) and makeCoaddTempExp.matchingKernelSize (%s)" " don't match" % (self.assembleCoadd.matchingKernelSize, self.makeCoaddTempExp.matchingKernelSize)) raise RuntimeError(message)
class CoaddDriverConfig(Config): coaddName = Field(dtype=str, default="deep", doc="Name for coadd") select = ConfigurableField(target=WcsSelectImagesTask, doc="Select images to process") makeCoaddTempExp = ConfigurableField(target=MakeCoaddTempExpTask, doc="Warp images to sky") doBackgroundReference = Field(dtype=bool, default=False, doc="Build background reference?") backgroundReference = ConfigurableField(target=NullSelectImagesTask, doc="Build background reference") assembleCoadd = ConfigurableField(target=SafeClipAssembleCoaddTask, doc="Assemble warps into coadd") detectCoaddSources = ConfigurableField(target=DetectCoaddSourcesTask, doc="Detect sources on coadd") doOverwriteCoadd = Field(dtype=bool, default=False, doc="Overwrite coadd?") def setDefaults(self): self.makeCoaddTempExp.select.retarget(NullSelectImagesTask) self.assembleCoadd.select.retarget(NullSelectImagesTask) self.makeCoaddTempExp.doOverwrite = False self.assembleCoadd.doWrite = False self.assembleCoadd.doMatchBackgrounds = False self.makeCoaddTempExp.bgSubtracted = True self.assembleCoadd.badMaskPlanes = [ 'BAD', 'EDGE', 'SAT', 'INTRP', 'NO_DATA' ] def validate(self): if self.makeCoaddTempExp.coaddName != self.coaddName: raise RuntimeError( "makeCoaddTempExp.coaddName and coaddName don't match") if self.assembleCoadd.coaddName != self.coaddName: raise RuntimeError( "assembleCoadd.coaddName and coaddName don't match")
class IngestConfig(Config): """Configuration for IngestTask""" parse = ConfigurableField(target=ParseTask, doc="File parsing") register = ConfigurableField(target=RegisterTask, doc="Registry entry") allowError = Field(dtype=bool, default=False, doc="Allow error in ingestion?") clobber = Field(dtype=bool, default=False, doc="Clobber existing file?")
class DirectMatchConfigWithoutLoader(Config): """Configuration for DirectMatchTask when an already-initialized refObjLoader will be passed to this task.""" matchRadius = Field(dtype=float, default=0.25, doc="Matching radius, arcsec") sourceSelection = ConfigurableField(target=ScienceSourceSelectorTask, doc="Selection of science sources") referenceSelection = ConfigurableField(target=ReferenceSourceSelectorTask, doc="Selection of reference sources")
class MeasureCrosstalkConfig(Config): extract = ConfigurableField( target=CrosstalkExtractTask, doc="Task to measure pixel ratios.", ) solver = ConfigurableField( target=CrosstalkSolveTask, doc="Task to convert ratio lists to crosstalk coefficients.", )
class FringeConfig(CalibConfig): """Configuration for fringe construction""" stats = ConfigurableField(target=CalibStatsTask, doc="Background statistics configuration") subtractBackground = ConfigurableField( target=measAlg.SubtractBackgroundTask, doc="Background configuration") detection = ConfigurableField(target=measAlg.SourceDetectionTask, doc="Detection configuration") detectSigma = Field(dtype=float, default=1.0, doc="Detection PSF gaussian sigma")
class MultiBandDriverConfig(Config): coaddName = Field(dtype=str, default="deep", doc="Name of coadd") detectCoaddSources = ConfigurableField(target=DetectCoaddSourcesTask, doc="Detect sources on coadd") mergeCoaddDetections = ConfigurableField(target=MergeDetectionsTask, doc="Merge detections") measureCoaddSources = ConfigurableField( target=MeasureMergedCoaddSourcesTask, doc="Measure merged detections") mergeCoaddMeasurements = ConfigurableField(target=MergeMeasurementsTask, doc="Merge measurements") forcedPhotCoadd = ConfigurableField( target=ForcedPhotCoaddTask, doc="Forced measurement on coadded images") clobberDetections = Field(dtype=bool, default=False, doc="Clobber existing detections?") clobberMergedDetections = Field(dtype=bool, default=False, doc="Clobber existing merged detections?") clobberMeasurements = Field(dtype=bool, default=False, doc="Clobber existing measurements?") clobberMergedMeasurements = Field( dtype=bool, default=False, doc="Clobber existing merged measurements?") clobberForcedPhotometry = Field(dtype=bool, default=False, doc="Clobber existing forced photometry?") reprocessing = Field( dtype=bool, default=False, doc= ("Are we reprocessing?\n\n" "This exists as a workaround for large deblender footprints causing large memory use " "and/or very slow processing. We refuse to deblend those footprints when running on a cluster " "and return to reprocess on a machine with larger memory or more time " "if we consider those footprints important to recover."), ) def setDefaults(self): Config.setDefaults(self) self.forcedPhotCoadd.references.retarget(MultiBandReferencesTask) def validate(self): for subtask in ("mergeCoaddDetections", "measureCoaddSources", "mergeCoaddMeasurements", "forcedPhotCoadd"): coaddName = getattr(self, subtask).coaddName if coaddName != self.coaddName: raise RuntimeError( "%s.coaddName (%s) doesn't match root coaddName (%s)" % (subtask, coaddName, self.coaddName))
class DynamicDetectionConfig(SourceDetectionConfig): """Configuration for DynamicDetectionTask """ prelimThresholdFactor = Field( dtype=float, default=0.5, doc= "Fraction of the threshold to use for first pass (to find sky objects)" ) skyObjects = ConfigurableField(target=SkyObjectsTask, doc="Generate sky objects") doBackgroundTweak = Field( dtype=bool, default=True, doc="Tweak background level so median PSF flux of sky objects is zero?" ) minNumSources = Field( dtype=int, default=10, doc="Minimum number of sky sources in statistical sample; " "if below this number, we refuse to modify the threshold.") def setDefaults(self): SourceDetectionConfig.setDefaults(self) self.skyObjects.nSources = 1000 # For good statistics
class DeblendCoaddSourcesMultiConfig(DeblendCoaddSourcesBaseConfig): multibandDeblend = ConfigurableField( target=MultibandDeblendTask, doc="Task to deblend an images in multiple bands" ) coadds = InputDatasetField( doc="Exposure on which to run deblending", nameTemplate="{inputCoaddName}Coadd_calexp", storageClass="ExposureF", dimensions=("tract", "patch", "abstract_filter", "skymap") ) outputSchema = InitOutputDatasetField( doc="Output of the schema used in deblending task", nameTemplate="{outputCoaddName}Coadd_deblendedModel_schema", storageClass="SourceCatalog" ) fluxCatalogs = OutputDatasetField( doc="Flux catalogs produced by multiband deblending, not written " "if conserve flux is turned off", nameTemplate="{outputCoaddName}Coadd_deblendedFlux", storageClass="SourceCatalog", dimensions=("tract", "patch", "abstract_filter", "skymap") ) templateCatalogs = OutputDatasetField( doc="Template catalogs produced by multiband deblending", nameTemplate="{outputCoaddName}Coadd_deblendedModel", storageClass="SourceCatalog", dimensions=("tract", "patch", "abstract_filter", "skymap") ) def setDefaults(self): super().setDefaults() self.quantum.dimensions = ("tract", "patch", "skymap")
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")
def makeField(cls, doc): """Make a `lsst.pex.config.ConfigurableField` for this task. Parameters ---------- doc : `str` Help text for the field. Returns ------- configurableField : `lsst.pex.config.ConfigurableField` A `~ConfigurableField` for this task. Examples -------- Provides a convenient way to specify this task is a subtask of another task. Here is an example of use: .. code-block:: python class OtherTaskConfig(lsst.pex.config.Config): aSubtask = ATaskClass.makeField("brief description of task") """ return ConfigurableField(doc=doc, target=cls)
class FlatConfig(CalibConfig): """Configuration for flat construction""" iterations = Field(dtype=int, default=10, doc="Number of iterations for scale determination") stats = ConfigurableField(target=CalibStatsTask, doc="Background statistics configuration")
class SingleFrameDriverConfig(Config): processCcd = ConfigurableField( target=ProcessCcdTask, doc="CCD processing task") ignoreCcdList = ListField(dtype=int, default=[], doc="List of CCDs to ignore when processing") ccdKey = Field(dtype=str, default="ccd", doc="DataId key corresponding to a single sensor")
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
class MeasurementDebuggerConfig(Config): sourceId = ListField(dtype=int, default=[], doc="List of source identifiers to measure") outputName = Field(dtype=str, default="catalog.fits", doc="Output name for source catalog") measurement = ConfigurableField(target=SourceMeasurementTask, doc="Measurements")
class ApdbMetricConfig(MetricConfig, pipelineConnections=ApdbMetricConnections): """A base class for APDB metric task configs. """ dbLoader = ConfigurableField( target=DirectApdbLoader, doc="Task for loading a database from `dbInfo`. Its run method must " "take one object of the dataset type indicated by `dbInfo` and return " "a Struct with an 'apdb' member.")
class ForcedPhotCcdDiaDriverConfig(Config): ignoreCcdList = ListField(dtype=int, default=[], doc="List of CCDs to ignore when processing") ccdKey = Field(dtype=str, default="detector", doc="DataId key corresponding to a single sensor") forced = ConfigurableField(target=ForcedPhotCcdDiaTask, doc="CCD processing task")
class AssociationDriverConfig(Config): coaddName = Field(dtype=str, default="deep", doc="Name of coadd") maxFootprintArea = Field(dtype=int, default=5000, doc="Maximum area of footprints") defaultFootprintRadius = Field( dtype=int, default=40, doc="Use this radius to define the footprint if too large") associator = ConfigurableField( target=SimpleAssociationTask, doc="Task used to associate DiaSources with DiaObjects.", ) ccdKey = Field(dtype=str, default='detector', doc="Name of ccd to give to butler") select = ConfigurableField( doc="Image selection subtask.", target=WcsSelectImagesTask, )
def makeField(cls, doc): """Make an lsst.pex.config.ConfigurableField """ def applyWrapper(config, **kwargs): """Construct a Gaussian PSF @param[in] config: an instance of GaussianPsfFactory """ return config.apply(**kwargs) return ConfigurableField(doc=doc, target=applyWrapper, ConfigClass=cls)
class OneTransformConfig(Config): """A Config representing a single ``Transform`` in a compound ``Transform``. See Also -------- lsst.afw.geom.MultiTransformConfig """ transform = ConfigurableField( doc="Transform factory", target=identityFactory, )
class DarkConfig(CalibConfig): """Configuration for dark construction""" doRepair = Field(dtype=bool, default=True, doc="Repair artifacts?") psfFwhm = Field(dtype=float, default=3.0, doc="Repair PSF FWHM (pixels)") psfSize = Field(dtype=int, default=21, doc="Repair PSF size (pixels)") crGrow = Field(dtype=int, default=2, doc="Grow radius for CR (pixels)") repair = ConfigurableField(target=RepairTask, doc="Task to repair artifacts") def setDefaults(self): CalibConfig.setDefaults(self) self.combination.mask.append("CR")
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
class MeasureCrosstalkConfig(Config): """Configuration for MeasureCrosstalkTask.""" isr = ConfigurableField( target=IsrTask, doc="Instrument signature removal task to use to process data.") threshold = Field( dtype=float, default=30000, doc="Minimum level of source pixels for which to measure crosstalk.") doRerunIsr = Field( dtype=bool, default=True, doc="Rerun the ISR, even if postISRCCD files are available?") badMask = ListField( dtype=str, default=["SAT", "BAD", "INTRP"], doc="Mask planes to ignore when identifying source pixels.") rejIter = Field( dtype=int, default=3, doc="Number of rejection iterations for final coefficient calculation." ) rejSigma = Field( dtype=float, default=2.0, doc="Rejection threshold (sigma) for final coefficient calculation.") isTrimmed = Field( dtype=bool, default=True, doc="Have the amplifiers been trimmed before measuring CT?") def setDefaults(self): Config.setDefaults(self) # Set ISR processing to run up until we would be applying the CT # correction. Applying subsequent stages may corrupt the signal. self.isr.doWrite = False self.isr.doOverscan = True self.isr.doAssembleCcd = True self.isr.doBias = True self.isr.doVariance = False # This isn't used in the calculation below. self.isr.doLinearize = True # This is the last ISR step we need. self.isr.doCrosstalk = False self.isr.doBrighterFatter = False self.isr.doDark = False self.isr.doStrayLight = False self.isr.doFlat = False self.isr.doFringe = False self.isr.doApplyGains = False self.isr.doDefect = True # Masking helps remove spurious pixels. self.isr.doSaturationInterpolation = False self.isr.growSaturationFootprintSize = 0 # We want the saturation spillover: it's good signal.
class SourceTableDriverConfig(Config): writeSourceTable = ConfigurableField( target=WriteSourceTableTask, doc="Task to make parquet table for full src catalog", ) transformSourceTable = ConfigurableField( target=TransformSourceTableTask, doc="Transform Source Table to DPDD specification", ) ignoreCcdList = ListField( dtype=int, default=[], doc="List of CCDs to ignore when processing", ) ccdKey = Field( dtype=str, default="ccd", doc="DataId key corresponding to a single sensor", ) def setDefaults(self): self.writeSourceTable.doApplyExternalPhotoCalib = True self.writeSourceTable.doApplyExternalSkyWcs = True
class ScaleVarianceConfig(Config): background = ConfigurableField(target=SubtractBackgroundTask, doc="Background subtraction") maskPlanes = ListField( dtype=str, default=["DETECTED", "DETECTED_NEGATIVE", "BAD", "SAT", "NO_DATA", "INTRP"], doc="Mask planes for pixels to ignore when scaling variance", ) limit = Field(dtype=float, default=10.0, doc="Maximum variance scaling value to permit") def setDefaults(self): self.background.binSize = 32 self.background.useApprox = False self.background.undersampleStyle = "REDUCE_INTERP_ORDER" self.background.ignoredPixelMask = ["DETECTED", "DETECTED_NEGATIVE", "BAD", "SAT", "NO_DATA", "INTRP"]
class DonutDriverConfig(Config): fitDonut = ConfigurableField( target = FitDonutTask, doc = "Donut fitting task" ) ignoreCcdList = ListField( dtype = int, default = [], doc = "List of CCDs to ignore when processing" ) ccdKey = Field( dtype = str, default = "ccd", doc = "DataId key corresponding to a single sensor" )
def makeField(cls, doc): """!Make an lsst.pex.config.ConfigurableField for this task Provides a convenient way to specify this task is a subtask of another task. Here is an example of use: \code class OtherTaskConfig(lsst.pex.config.Config) aSubtask = ATaskClass.makeField("a brief description of what this task does") \endcode @param[in] cls this class @param[in] doc help text for the field @return a lsst.pex.config.ConfigurableField for this task """ return ConfigurableField(doc=doc, target=cls)