class MakeWarpConfig(pipeBase.PipelineTaskConfig, MakeCoaddTempExpConfig): calExpList = pipeBase.InputDatasetField( doc= "Input exposures to be resampled and optionally PSF-matched onto a SkyMap projection/patch", name="calexp", storageClass="ExposureF", dimensions=("instrument", "visit", "detector")) backgroundList = pipeBase.InputDatasetField( doc= "Input backgrounds to be added back into the calexp if bgSubtracted=False", name="calexpBackground", storageClass="Background", dimensions=("instrument", "visit", "detector")) skyCorrList = pipeBase.InputDatasetField( doc= "Input Sky Correction to be subtracted from the calexp if doApplySkyCorr=True", name="skyCorr", storageClass="Background", dimensions=("instrument", "visit", "detector")) skyMap = pipeBase.InputDatasetField( doc= "Input definition of geometry/bbox and projection/wcs for warped exposures", nameTemplate="{coaddName}Coadd_skyMap", storageClass="SkyMap", dimensions=("skymap", ), scalar=True) direct = pipeBase.OutputDatasetField(doc=( "Output direct warped exposure (previously called CoaddTempExp), produced by resampling ", "calexps onto the skyMap patch geometry."), nameTemplate= "{coaddName}Coadd_directWarp", storageClass="ExposureF", dimensions=("tract", "patch", "skymap", "visit", "instrument"), scalar=True) psfMatched = pipeBase.OutputDatasetField(doc=( "Output PSF-Matched warped exposure (previously called CoaddTempExp), produced by resampling ", "calexps onto the skyMap patch geometry and PSF-matching to a model PSF." ), nameTemplate= "{coaddName}Coadd_psfMatchedWarp", storageClass="ExposureF", dimensions=("tract", "patch", "skymap", "visit", "instrument"), scalar=True) def setDefaults(self): super().setDefaults() self.formatTemplateNames({"coaddName": "deep"}) self.quantum.dimensions = ("tract", "patch", "skymap", "visit") def validate(self): super().validate() # TODO: Remove this constraint after DM-17062 if self.doApplyUberCal: raise RuntimeError( "Gen3 MakeWarpTask cannot apply meas_mosaic or jointcal results." "Please set doApplyUbercal=False.")
class ConfigWithDatasets(pexConfig.Config): input1 = pipeBase.InputDatasetField(name="in1", dimensions=["label"], storageClass="SCA", doc="") input2 = pipeBase.InputDatasetField( name="in2", dimensions=["label", "abstract_filter"], storageClass="SCB", scalar=True, doc="") output = pipeBase.OutputDatasetField( name="out", dimensions=["abstract_filter", "skypix"], storageClass="SCC", scalar=False, doc="") initInput = pipeBase.InitInputDatasetField(name="init_input", storageClass="SCX", doc="") initOutput = pipeBase.InitOutputDatasetField(name="init_output", storageClass="SCY", doc="")
class AddConfig(pipeBase.PipelineTaskConfig): addend = pexConfig.Field(doc="amount to add", dtype=int, default=3) input = pipeBase.InputDatasetField(name="add_input", dimensions=["instrument", "visit"], storageClass="Catalog", doc="Input dataset type for this task") output = pipeBase.OutputDatasetField( name="add_output", dimensions=["instrument", "visit"], storageClass="Catalog", doc="Output dataset type for this task") def setDefaults(self): # set dimensions of a quantum, this task uses per-visit quanta and it # expects dataset dimensions to be the same self.quantum.dimensions = ["instrument", "visit"] self.quantum.sql = None
class CharacterizeImageConfig(pipeBase.PipelineTaskConfig): # Gen3 IO options exposure = pipeBase.InputDatasetField( doc="Input exposure data", name="postISRCCD", scalar=True, storageClass="ExposureF", dimensions=["instrument", "visit", "detector"], ) characterized = pipeBase.OutputDatasetField( doc="Output characterized data.", name="icExp", scalar=True, storageClass="ExposureF", dimensions=["instrument", "visit", "detector"], ) sourceCat = pipeBase.OutputDatasetField( doc="Output source catalog.", name="icSrc", scalar=True, storageClass="SourceCatalog", dimensions=["instrument", "visit", "detector"], ) backgroundModel = pipeBase.OutputDatasetField( doc="Output background model.", name="icExpBackground", scalar=True, storageClass="Background", dimensions=["instrument", "visit", "detector"], ) outputSchema = pipeBase.InitOutputDatasetField( doc="Schema of the catalog produced by CharacterizeImage", name="icSrc_schema", storageClass="SourceCatalog", ) """!Config for CharacterizeImageTask""" doMeasurePsf = pexConfig.Field( dtype=bool, default=True, doc= "Measure PSF? If False then for all subsequent operations use either existing PSF " "model when present, or install simple PSF model when not (see installSimplePsf " "config options)") doWrite = pexConfig.Field( dtype=bool, default=True, doc="Persist results?", ) doWriteExposure = pexConfig.Field( dtype=bool, default=True, doc= "Write icExp and icExpBackground in addition to icSrc? Ignored if doWrite False.", ) psfIterations = pexConfig.RangeField( dtype=int, default=2, min=1, doc="Number of iterations of detect sources, measure sources, " "estimate PSF. If useSimplePsf is True then 2 should be plenty; " "otherwise more may be wanted.", ) background = pexConfig.ConfigurableField( target=SubtractBackgroundTask, doc="Configuration for initial background estimation", ) detection = pexConfig.ConfigurableField(target=SourceDetectionTask, doc="Detect sources") doDeblend = pexConfig.Field(dtype=bool, default=True, doc="Run deblender input exposure") deblend = pexConfig.ConfigurableField( target=SourceDeblendTask, doc="Split blended source into their components") measurement = pexConfig.ConfigurableField( target=SingleFrameMeasurementTask, doc="Measure sources") doApCorr = pexConfig.Field( dtype=bool, default=True, doc="Run subtasks to measure and apply aperture corrections") measureApCorr = pexConfig.ConfigurableField( target=MeasureApCorrTask, doc="Subtask to measure aperture corrections") applyApCorr = pexConfig.ConfigurableField( target=ApplyApCorrTask, doc="Subtask to apply aperture corrections") # If doApCorr is False, and the exposure does not have apcorrections already applied, the # active plugins in catalogCalculation almost certainly should not contain the characterization plugin catalogCalculation = pexConfig.ConfigurableField( target=CatalogCalculationTask, doc="Subtask to run catalogCalculation plugins on catalog") useSimplePsf = pexConfig.Field( dtype=bool, default=True, doc= "Replace the existing PSF model with a simplified version that has the same sigma " "at the start of each PSF determination iteration? Doing so makes PSF determination " "converge more robustly and quickly.", ) installSimplePsf = pexConfig.ConfigurableField( target=InstallGaussianPsfTask, doc="Install a simple PSF model", ) refObjLoader = pexConfig.ConfigurableField( target=LoadIndexedReferenceObjectsTask, doc="reference object loader", ) ref_match = pexConfig.ConfigurableField( target=RefMatchTask, doc= "Task to load and match reference objects. Only used if measurePsf can use matches. " "Warning: matching will only work well if the initial WCS is accurate enough " "to give good matches (roughly: good to 3 arcsec across the CCD).", ) measurePsf = pexConfig.ConfigurableField( target=MeasurePsfTask, doc="Measure PSF", ) repair = pexConfig.ConfigurableField( target=RepairTask, doc="Remove cosmic rays", ) checkUnitsParseStrict = pexConfig.Field( doc= "Strictness of Astropy unit compatibility check, can be 'raise', 'warn' or 'silent'", dtype=str, default="raise", ) def setDefaults(self): super().setDefaults() # just detect bright stars; includeThresholdMultipler=10 seems large, # but these are the values we have been using self.detection.thresholdValue = 5.0 self.detection.includeThresholdMultiplier = 10.0 # do not deblend, as it makes a mess self.doDeblend = False # measure and apply aperture correction; note: measuring and applying aperture # correction are disabled until the final measurement, after PSF is measured self.doApCorr = True # minimal set of measurements needed to determine PSF self.measurement.plugins.names = [ "base_PixelFlags", "base_SdssCentroid", "base_SdssShape", "base_GaussianFlux", "base_PsfFlux", "base_CircularApertureFlux", ] self.quantum.dimensions = ("instrument", "visit", "detector") def validate(self): if self.doApCorr and not self.measurePsf: raise RuntimeError( "Must measure PSF to measure aperture correction, " "because flags determined by PSF measurement are used to identify " "sources used to measure aperture correction")
class InsertFakesConfig(PipelineTaskConfig): """Config for inserting fake sources Notes ----- The default column names are those from the University of Washington sims database. """ raColName = pexConfig.Field( doc="RA column name used in the fake source catalog.", dtype=str, default="raJ2000", ) decColName = pexConfig.Field( doc="Dec. column name used in the fake source catalog.", dtype=str, default="decJ2000", ) doCleanCat = pexConfig.Field( doc="If true removes bad sources from the catalog.", dtype=bool, default=True, ) diskHLR = pexConfig.Field( doc= "Column name for the disk half light radius used in the fake source catalog.", dtype=str, default="DiskHalfLightRadius", ) bulgeHLR = pexConfig.Field( doc= "Column name for the bulge half light radius used in the fake source catalog.", dtype=str, default="BulgeHalfLightRadius", ) magVar = pexConfig.Field( doc= "The column name for the magnitude calculated taking variability into account. In the format " "``filter name``magVar, e.g. imagVar for the magnitude in the i band.", dtype=str, default="%smagVar", ) nDisk = pexConfig.Field( doc= "The column name for the sersic index of the disk component used in the fake source catalog.", dtype=str, default="disk_n", ) nBulge = pexConfig.Field( doc= "The column name for the sersic index of the bulge component used in the fake source catalog.", dtype=str, default="bulge_n", ) aDisk = pexConfig.Field( doc= "The column name for the semi major axis length of the disk component used in the fake source" "catalog.", dtype=str, default="a_d", ) aBulge = pexConfig.Field( doc= "The column name for the semi major axis length of the bulge component.", dtype=str, default="a_b", ) bDisk = pexConfig.Field( doc= "The column name for the semi minor axis length of the disk component.", dtype=str, default="b_d", ) bBulge = pexConfig.Field( doc= "The column name for the semi minor axis length of the bulge component used in the fake source " "catalog.", dtype=str, default="b_b", ) paDisk = pexConfig.Field( doc= "The column name for the PA of the disk component used in the fake source catalog.", dtype=str, default="pa_disk", ) paBulge = pexConfig.Field( doc= "The column name for the PA of the bulge component used in the fake source catalog.", dtype=str, default="pa_bulge", ) fakeType = pexConfig.Field( doc= "What type of fake catalog to use, snapshot (includes variability in the magnitudes calculated " "from the MJD of the image), static (no variability) or filename for a user defined fits" "catalog.", dtype=str, default="static", ) calibFluxRadius = pexConfig.Field( doc="Radius for the calib flux (in pixels).", dtype=float, default=12.0, ) image = pipeBase.InputDatasetField( doc="Image into which fakes are to be added.", nameTemplate="{CoaddName}Coadd", scalar=True, storageClass="ExposureF", dimensions=("Tract", "Patch", "AbstractFilter", "SkyMap")) fakeCat = pipeBase.InputDatasetField( doc="Catalog of fake sources to draw inputs from.", nameTemplate="{CoaddName}Coadd_fakeSourceCat", scalar=True, storageClass="Parquet", dimensions=("Tract", "SkyMap")) imageWithFakes = pipeBase.OutputDatasetField( doc="Image with fake sources added.", nameTemplate="fakes_{CoaddName}Coadd", scalar=True, storageClass="ExposureF", dimensions=("Tract", "Patch", "AbstractFilter", "SkyMap")) coaddName = pexConfig.Field( doc="The name of the type of coadd used", dtype=str, default="deep", ) def setDefaults(self): super().setDefaults() self.quantum.dimensions = ("Tract", "Patch", "AbstractFilter", "SkyMap") self.formatTemplateNames({"CoaddName": "deep"})
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")
class ProcessCcdWithFakesConfig(PipelineTaskConfig): """Config for inserting fake sources Notes ----- The default column names are those from the UW sims database. """ useUpdatedCalibs = pexConfig.Field( doc="Use updated calibs and wcs from jointcal?", dtype=bool, default=False, ) exposure = pipeBase.InputDatasetField( doc="Exposure into which fakes are to be added.", name="calexp", scalar=True, storageClass="ExposureF", dimensions=("Instrument", "Visit", "Detector")) fakeCat = pipeBase.InputDatasetField( doc="Catalog of fake sources to draw inputs from.", nameTemplate="{CoaddName}Coadd_fakeSourceCat", scalar=True, storageClass="Parquet", dimensions=("Tract", "SkyMap")) wcs = pipeBase.InputDatasetField( doc="WCS information for the input exposure.", name="jointcal_wcs", scalar=True, storageClass="TablePersistableWcs", dimensions=("Tract", "SkyMap", "Instrument", "Visit", "Detector")) photoCalib = pipeBase.InputDatasetField( doc="Calib information for the input exposure.", name="jointcal_photoCalib", scalar=True, storageClass="TablePersistablePhotoCalib", dimensions=("Tract", "SkyMap", "Instrument", "Visit", "Detector")) outputExposure = pipeBase.OutputDatasetField( doc="Exposure with fake sources added.", name="fakes_calexp", scalar=True, storageClass="ExposureF", dimensions=("Instrument", "Visit", "Detector")) outputCat = pipeBase.OutputDatasetField( doc= "Source catalog produced in calibrate task with fakes also measured.", name="src", storageClass="SourceCatalog", dimensions=("Instrument", "Visit", "Detector"), scalar=True) coaddName = pexConfig.Field( doc="The name of the type of coadd used", dtype=str, default="deep", ) insertFakes = pexConfig.ConfigurableField( target=InsertFakesTask, doc="Configuration for the fake sources") detection = pexConfig.ConfigurableField(target=SourceDetectionTask, doc="The detection task to use.") deblend = pexConfig.ConfigurableField(target=SourceDeblendTask, doc="The deblending task to use.") measurement = pexConfig.ConfigurableField( target=SingleFrameMeasurementTask, doc="The measurement task to use") applyApCorr = pexConfig.ConfigurableField( target=ApplyApCorrTask, doc="The apply aperture correction task to use.") catalogCalculation = pexConfig.ConfigurableField( target=CatalogCalculationTask, doc="The catalog calculation ask to use.") def setDefaults(self): self.detection.reEstimateBackground = False super().setDefaults() self.quantum.dimensions = ("Instrument", "Visit", "Detector") self.measurement.plugins["base_PixelFlags"].masksFpAnywhere.append( "FAKE") self.measurement.plugins["base_PixelFlags"].masksFpCenter.append( "FAKE")
class MergeMeasurementsConfig(pipeBase.PipelineTaskConfig): """! @anchor MergeMeasurementsConfig_ @brief Configuration parameters for the MergeMeasurementsTask """ # Gen 3 options inputSchema = pipeBase.InitInputDatasetField( doc="Schema for the input measurement catalogs.", nameTemplate="{inputCoaddName}Coadd_meas_schema", storageClass="SourceCatalog", ) outputSchema = pipeBase.InitOutputDatasetField( doc="Schema for the output merged measurement catalog.", nameTemplate="{outputCoaddName}Coadd_ref_schema", storageClass="SourceCatalog", ) catalogs = pipeBase.InputDatasetField( doc="Input catalogs to merge.", nameTemplate="{inputCoaddName}Coadd_meas", scalar=False, storageClass="SourceCatalog", dimensions=["abstract_filter", "skymap", "tract", "patch"], ) mergedCatalog = pipeBase.OutputDatasetField( doc="Output merged catalog.", nameTemplate="{outputCoaddName}Coadd_ref", scalar=True, storageClass="SourceCatalog", dimensions=["skymap", "tract", "patch"], ) # Task configuration options pseudoFilterList = pexConfig.ListField( dtype=str, default=["sky"], doc="Names of filters which may have no associated detection\n" "(N.b. should include MergeDetectionsConfig.skyFilterName)" ) snName = pexConfig.Field( dtype=str, default="base_PsfFlux", doc="Name of flux measurement for calculating the S/N when choosing the reference band." ) minSN = pexConfig.Field( dtype=float, default=10., doc="If the S/N from the priority band is below this value (and the S/N " "is larger than minSNDiff compared to the priority band), use the band with " "the largest S/N as the reference band." ) minSNDiff = pexConfig.Field( dtype=float, default=3., doc="If the difference in S/N between another band and the priority band is larger " "than this value (and the S/N in the priority band is less than minSN) " "use the band with the largest S/N as the reference band" ) flags = pexConfig.ListField( dtype=str, doc="Require that these flags, if available, are not set", default=["base_PixelFlags_flag_interpolatedCenter", "base_PsfFlux_flag", "ext_photometryKron_KronFlux_flag", "modelfit_CModel_flag", ] ) priorityList = pexConfig.ListField( dtype=str, default=[], doc="Priority-ordered list of bands for the merge." ) coaddName = pexConfig.Field( dtype=str, default="deep", doc="Name of coadd" ) def validate(self): super().validate() if len(self.priorityList) == 0: raise RuntimeError("No priority list provided") def setDefaults(self): super().setDefaults() self.formatTemplateNames({"inputCoaddName": "deep", "outputCoaddName": "deep"}) self.quantum.dimensions = ("skymap", "tract", "patch")