class DecorrelateALKernelSpatialConfig(pexConfig.Config): """Configuration parameters for the DecorrelateALKernelSpatialTask. """ decorrelateConfig = pexConfig.ConfigField( dtype=DecorrelateALKernelConfig, doc= 'DecorrelateALKernel config to use when running on complete exposure (non spatially-varying)', ) decorrelateMapReduceConfig = pexConfig.ConfigField( dtype=DecorrelateALKernelMapReduceConfig, doc= 'DecorrelateALKernelMapReduce config to use when running on each sub-image (spatially-varying)', ) ignoreMaskPlanes = pexConfig.ListField( dtype=str, doc="""Mask planes to ignore for sigma-clipped statistics""", default=("INTRP", "EDGE", "DETECTED", "SAT", "CR", "BAD", "NO_DATA", "DETECTED_NEGATIVE")) def setDefaults(self): self.decorrelateMapReduceConfig.gridStepX = self.decorrelateMapReduceConfig.gridStepY = 40 self.decorrelateMapReduceConfig.cellSizeX = self.decorrelateMapReduceConfig.cellSizeY = 41 self.decorrelateMapReduceConfig.borderSizeX = self.decorrelateMapReduceConfig.borderSizeY = 8 self.decorrelateMapReduceConfig.reducer.reduceOperation = 'average'
class PipelineConfig(pexConfig.Config): # pipeline definition configuration definition = pexConfig.ConfigField("definition", PipelineDefinitionConfig) # deployment configuration deploy = pexConfig.ConfigField("deployment info", DeployConfig) # job number runCount = pexConfig.Field("job definition", int)
class ReferenceSourceSelectorConfig(pexConfig.Config): doMagLimit = pexConfig.Field(dtype=bool, default=False, doc="Apply magnitude limit?") doFlags = pexConfig.Field(dtype=bool, default=False, doc="Apply flag limitation?") doUnresolved = pexConfig.Field(dtype=bool, default=False, doc="Apply unresolved limitation?") doSignalToNoise = pexConfig.Field(dtype=bool, default=False, doc="Apply signal-to-noise limit?") doMagError = pexConfig.Field(dtype=bool, default=False, doc="Apply magnitude error limit?") magLimit = pexConfig.ConfigField(dtype=MagnitudeLimit, doc="Magnitude limit to apply") flags = pexConfig.ConfigField(dtype=RequireFlags, doc="Flags to require") unresolved = pexConfig.ConfigField(dtype=RequireUnresolved, doc="Star/galaxy separation to apply") signalToNoise = pexConfig.ConfigField(dtype=SignalToNoiseLimit, doc="Signal-to-noise limit to apply") magError = pexConfig.ConfigField(dtype=MagnitudeErrorLimit, doc="Magnitude error limit to apply") colorLimits = pexConfig.ConfigDictField( keytype=str, itemtype=ColorLimit, default={}, doc="Color limits to apply; key is used as a label only")
class WorkflowConfig(pexConfig.Config): # name of this workflow shortName = pexConfig.Field("name of this workflow", str) # platform configuration file platform = pexConfig.ConfigField("platform configuration file", plat.PlatformConfig) # plugin type configurationType = pexConfig.Field("plugin type", str) # plugin class name configurationClass = pexConfig.Field("orca plugin class", str) # configuration configuration = pexConfig.ConfigChoiceField("configuration", typemap) # this usually isn't used, but is here because the design calls for this # possibility. # database name database = pexConfig.ConfigChoiceField( "database", fake.FakeTypeMap(data.DatabaseConfig)) # task task = pexConfig.ConfigChoiceField("task", fake.FakeTypeMap(task.TaskConfig)) # monitor configuration monitor = pexConfig.ConfigField("monitor configuration", mon.MonitorConfig)
class ScienceSourceSelectorConfig(pexConfig.Config): """Configuration for selecting science sources""" doFluxLimit = pexConfig.Field(dtype=bool, default=False, doc="Apply flux limit?") doFlags = pexConfig.Field(dtype=bool, default=False, doc="Apply flag limitation?") doUnresolved = pexConfig.Field(dtype=bool, default=False, doc="Apply unresolved limitation?") doSignalToNoise = pexConfig.Field(dtype=bool, default=False, doc="Apply signal-to-noise limit?") doIsolated = pexConfig.Field(dtype=bool, default=False, doc="Apply isolated limitation?") fluxLimit = pexConfig.ConfigField(dtype=FluxLimit, doc="Flux limit to apply") flags = pexConfig.ConfigField(dtype=RequireFlags, doc="Flags to require") unresolved = pexConfig.ConfigField(dtype=RequireUnresolved, doc="Star/galaxy separation to apply") signalToNoise = pexConfig.ConfigField(dtype=SignalToNoiseLimit, doc="Signal-to-noise limit to apply") isolated = pexConfig.ConfigField(dtype=RequireIsolated, doc="Isolated criteria to apply") def setDefaults(self): pexConfig.Config.setDefaults(self) self.flags.bad = [ "base_PixelFlags_flag_edge", "base_PixelFlags_flag_saturated", "base_PsfFlux_flags" ] self.signalToNoise.fluxField = "base_PsfFlux_instFlux" self.signalToNoise.errField = "base_PsfFlux_instFluxErr"
class GetCoaddAsMultiTractTemplateConfig(pexConfig.Config): templateBorderSize = pexConfig.Field( dtype=int, default=20, doc= "Number of pixels to grow the requested template image to account for warping" ) coaddName = pexConfig.Field( doc="coadd name: typically one of 'deep', 'goodSeeing', or 'dcr'", dtype=str, default="deep", ) warpType = pexConfig.Field( doc="Warp type of the coadd template: one of 'direct' or 'psfMatched'", dtype=str, default="direct", ) coaddPsf = pexConfig.ConfigField( doc="Configuration for CoaddPsf", dtype=CoaddPsfConfig, ) warp = pexConfig.ConfigField( dtype=afwMath.Warper.ConfigClass, doc="warper configuration", ) statistic = pexConfig.Field( dtype=str, doc="How to combine tracts that overlap", default="MEAN", )
class NoiseCoaddConfig(pexConfig.Config): saveDebugImages = pexConfig.Field( dtype=bool, doc="Save warped intermediate images?", default=False, ) imageShape = pexConfig.ListField( dtype=int, doc="Constant value of variance pixels", length=2, default=(256, 256), ) imageSigma = pexConfig.Field( dtype=float, doc="Sigma of Gaussian noise for image pixels", default=1.0, ) variance = pexConfig.Field( dtype=float, doc="Constant value of variance pixels", default=1.0, ) warp = pexConfig.ConfigField( dtype=afwMath.Warper.ConfigClass, doc="Policy to control warping.", ) coadd = pexConfig.ConfigField( dtype=coaddChiSq.Coadd.ConfigClass, doc="Policy to control coadd.", )
class PlatformConfig(pexConfig.Config): # directory configuration dir = pexConfig.ConfigField("directory info", DirectoryConfig) # hardware configuration hw = pexConfig.ConfigField("hardware info", HwConfig) # deployment configuration deploy = pexConfig.ConfigField("deploy", DeployConfig)
class ExampleSuperTaskConfig(supertask.SuperTaskConfig): input1 = pexConfig.ConfigField(dtype=supertask.InputDatasetConfig, doc="Input for this task") input2 = pexConfig.ConfigField(dtype=supertask.InputDatasetConfig, doc="Input for this task") output1 = pexConfig.ConfigField(dtype=supertask.OutputDatasetConfig, doc="Output for this task") output2 = pexConfig.ConfigField(dtype=supertask.OutputDatasetConfig, doc="Output for this task")
class Observatory(pexConfig.Config): """Configuration of the LSST observatory. """ telescope = pexConfig.ConfigField("The LSST telescope configuration.", Telescope) dome = pexConfig.ConfigField("The LSST dome configuration.", Dome) rotator = pexConfig.ConfigField("The LSST rotator configuration.", Rotator) camera = pexConfig.ConfigField("The LSST camera configuration.", Camera) filters = pexConfig.ConfigField("The LSST filters configuration.", Filters) slew = pexConfig.ConfigField("The LSST slew configuration.", Slew) optics_loop_corr = pexConfig.ConfigField( "The LSST optics loop corrections.", OpticsLoopCorr) park = pexConfig.ConfigField( "The LSST observatory park position configuration.", Park) obs_var = pexConfig.ConfigField( "The observatory variational model configuration", ObservatoryVariation) def setDefaults(self): """Set defaults for the observatory configuration. """ pass def load(self, config_files): """Load the configuration override files. Parameters ---------- config_files : list[str] A set of configuration override files. """ load_config(self.telescope, config_files) load_config(self.dome, config_files) load_config(self.rotator, config_files) load_config(self.camera, config_files) load_config(self.filters, config_files) load_config(self.slew, config_files) load_config(self.optics_loop_corr, config_files) load_config(self.park, config_files) load_config(self.obs_var, config_files) def save_as(self, save_dir=''): """Save the configuration objects to separate files. Parameters ---------- save_dir : str The directory in which to save the configuration files. """ self.telescope.save(os.path.join(save_dir, "telescope.py")) self.dome.save(os.path.join(save_dir, "dome.py")) self.rotator.save(os.path.join(save_dir, "rotator.py")) self.camera.save(os.path.join(save_dir, "camera.py")) self.filters.save(os.path.join(save_dir, "filters.py")) self.slew.save(os.path.join(save_dir, "slew.py")) self.optics_loop_corr.save( os.path.join(save_dir, "optics_loop_corr.py")) self.park.save(os.path.join(save_dir, "park.py")) self.obs_var.save(os.path.join(save_dir, "obs_variation.py"))
class TaskConfig(pexConfig.Config): # script directory scriptDir = pexConfig.Field("script directory", str) # pre script (run before any jobs) preScript = pexConfig.ConfigField("pre script", ScriptConfig) # pre job script (run before each job) preJob = pexConfig.ConfigField("pre job", JobTemplateConfig) # post job script (run after each job) postJob = pexConfig.ConfigField("post job", JobTemplateConfig) # worker job configuration workerJob = pexConfig.ConfigField("worker job", JobTemplateConfig) # DAG generator script to use to create DAG submission file generator = pexConfig.ConfigChoiceField("generator", typemap)
class MakeCoaddTempExpConfig(CoaddBaseTask.ConfigClass): """Config for MakeCoaddTempExpTask """ warpAndPsfMatch = pexConfig.ConfigurableField( target=WarpAndPsfMatchTask, doc="Task to warp and PSF-match calexp", ) doWrite = pexConfig.Field( doc="persist <coaddName>Coadd_<warpType>Warp", dtype=bool, default=True, ) doOverwrite = pexConfig.Field( doc= "overwrite <coaddName>Coadd_<warpType>Warp; If False, continue if the file exists on disk", dtype=bool, default=True, ) bgSubtracted = pexConfig.Field( doc="Work with a background subtracted calexp?", dtype=bool, default=True, ) coaddPsf = pexConfig.ConfigField( doc="Configuration for CoaddPsf", dtype=CoaddPsfConfig, )
class ExecuteConfig(pexConfig.Config): # directory configuration dir = pexConfig.ConfigField("directories", DirectoryConfig) # environment used to execute programs environment = pexConfig.Field("environment", str) # task name task = pexConfig.Field("task", str)
class AllocationConfig(pexConfig.Config): """A pex_config file describing the platform specific information required to fill out a scheduler file which will be used to submit a scheduler request. """ # this is done on two levels instead of one for future expansion of this # config class, which may require local attributes to be specified. platform = pexConfig.ConfigField("platform allocation information", AllocatedPlatformConfig)
class CoaddConfig(pex_config.Config): saveDebugImages = pex_config.Field( doc="Save intermediate images?", dtype=bool, default=False, ) bboxMin = pex_config.ListField( doc="Lower left corner of bounding box used to subframe to all input" "images", dtype=int, default=(0, 0), length=2, ) bboxSize = pex_config.ListField( doc="Size of bounding box used to subframe all input images; 0 0 for " "full input images", dtype=int, default=(0, 0), length=2, ) coaddZeroPoint = pex_config.Field( dtype=float, doc="Photometric zero point of coadd (mag).", default=27.0, ) coadd = pex_config.ConfigField(dtype=Coadd.ConfigClass, doc="")
class IsrQaConfig(pexConfig.Config): saveStats = pexConfig.Field( dtype=bool, doc="Calculate ISR statistics while processing?", default=True, ) flatness = pexConfig.ConfigField( dtype=IsrQaFlatnessConfig, doc="Flatness statistics configuration.", ) doWriteOss = pexConfig.Field( dtype=bool, doc="Write overscan subtracted image?", default=False, ) doThumbnailOss = pexConfig.Field( dtype=bool, doc="Write overscan subtracted thumbnail?", default=False, ) doWriteFlattened = pexConfig.Field( dtype=bool, doc="Write image after flat-field correction?", default=False, ) doThumbnailFlattened = pexConfig.Field( dtype=bool, doc="Write thumbnail after flat-field correction?", default=False, ) thumbnailBinning = pexConfig.Field( dtype=int, doc="Thumbnail binning factor.", default=4, ) thumbnailStdev = pexConfig.Field( dtype=float, doc= "Number of sigma below the background to set the thumbnail minimum.", default=3.0, ) thumbnailRange = pexConfig.Field( dtype=float, doc="Total range in sigma for thumbnail mapping.", default=5.0, ) thumbnailQ = pexConfig.Field( dtype=float, doc="Softening parameter for thumbnail mapping.", default=20.0, ) thumbnailSatBorder = pexConfig.Field( dtype=int, doc="Width of border around saturated pixels in thumbnail.", default=2, )
class TwoConfig(pexConfig.Config): resources = pexConfig.ConfigField(dtype=pipeBase.ResourceConfig, doc="Resource configuration") def setDefaults(self): self.resources.minMemoryMB = 1024 self.resources.minNumCores = 32
class MakeDiscreteSkyMapConfig(pexConfig.Config): """Config for MakeDiscreteSkyMapTask """ coaddName = pexConfig.Field( doc="coadd name, e.g. deep, goodSeeing, chiSquared", dtype=str, default="deep", ) skyMap = pexConfig.ConfigField( dtype=BaseSkyMap.ConfigClass, doc="SkyMap configuration parameters, excluding position and radius" ) borderSize = pexConfig.Field( doc="additional border added to the bounding box of the calexps, in degrees", dtype=float, default=0.0 ) doAppend = pexConfig.Field( doc="append another tract to an existing DiscreteSkyMap on disk, if present?", dtype=bool, default=False ) doWrite = pexConfig.Field( doc="persist the skyMap?", dtype=bool, default=True, ) def setDefaults(self): self.skyMap.tractOverlap = 0.0
class ZogyImagePsfMatchConfig(ImagePsfMatchConfig): """Config for the ZogyImagePsfMatchTask""" zogyConfig = pexConfig.ConfigField( dtype=ZogyConfig, doc='ZogyTask config to use when running on complete exposure (non spatially-varying)', )
class FgcmLoadReferenceCatalogConfig(pexConfig.Config): """Config for FgcmLoadReferenceCatalogTask""" refObjLoader = pexConfig.ConfigurableField( target=LoadIndexedReferenceObjectsTask, doc="Reference object loader for photometry", ) applyColorTerms = pexConfig.Field( doc=("Apply photometric color terms to reference stars?" "Requires that colorterms be set to a ColorTermLibrary"), dtype=bool, default=True) colorterms = pexConfig.ConfigField( doc="Library of photometric reference catalog name to color term dict.", dtype=ColortermLibrary, ) referenceSelector = pexConfig.ConfigurableField( target=ReferenceSourceSelectorTask, doc="Selection of reference sources", ) def validate(self): super().validate() if self.applyColorTerms and len(self.colorterms.data) == 0: msg = "applyColorTerms=True requires the `colorterms` field be set to a ColortermLibrary." raise pexConfig.FieldValidationError( FgcmLoadReferenceCatalogConfig.colorterms, self, msg)
class RepairConfig(pexConfig.Config): doInterpolate = pexConfig.Field( dtype=bool, doc= "Interpolate over defects? (ignored unless you provide a list of defects)", default=True, ) doCosmicRay = pexConfig.Field( dtype=bool, doc="Find and mask out cosmic rays?", default=True, ) cosmicray = pexConfig.ConfigField( dtype=measAlg.FindCosmicRaysConfig, doc="Options for finding and masking cosmic rays", ) interp = pexConfig.ConfigurableField( target=InterpImageTask, doc="Interpolate over bad image pixels", ) def setDefaults(self): self.interp.useFallbackValueAtEdge = True self.interp.fallbackValueType = "MEANCLIP" self.interp.negativeFallbackAllowed = True
class TwoConfig(pipeBase.PipelineTaskConfig, pipelineConnections=NullConnections): resources = pexConfig.ConfigField(dtype=pipeBase.ResourceConfig, doc="Resource configuration") def setDefaults(self): self.resources.minMemoryMB = 1024 self.resources.minNumCores = 32
class SnapCombineConfig(pexConfig.Config): doRepair = pexConfig.Field( dtype=bool, doc="Repair images (CR reject and interpolate) before combining", default=True, ) repairPsfFwhm = pexConfig.Field( dtype=float, doc="Psf FWHM (pixels) used to detect CRs", default=2.5, ) doDiffIm = pexConfig.Field( dtype=bool, doc="Perform difference imaging before combining", default=False, ) doPsfMatch = pexConfig.Field( dtype=bool, doc="Perform PSF matching for difference imaging (ignored if doDiffIm false)", default=True, ) doMeasurement = pexConfig.Field( dtype=bool, doc="Measure difference sources (ignored if doDiffIm false)", default=True, ) badMaskPlanes = pexConfig.ListField( dtype=str, doc="Mask planes that, if set, the associated pixels are not included in the combined exposure; " "DETECTED excludes cosmic rays", default=("DETECTED",), ) averageKeys = pexConfig.ListField( dtype=str, doc="List of float metadata keys to average when combining snaps, e.g. float positions and dates; " "non-float data must be handled by overriding the fixMetadata method", optional=True, ) sumKeys = pexConfig.ListField( dtype=str, doc="List of float or int metadata keys to sum when combining snaps, e.g. exposure time; " "non-float, non-int data must be handled by overriding the fixMetadata method", optional=True, ) repair = pexConfig.ConfigurableField(target=RepairTask, doc="") diffim = pexConfig.ConfigurableField(target=SnapPsfMatchTask, doc="") detection = pexConfig.ConfigurableField(target=SourceDetectionTask, doc="") initialPsf = pexConfig.ConfigField(dtype=InitialPsfConfig, doc="") measurement = pexConfig.ConfigurableField(target=SingleFrameMeasurementTask, doc="") def setDefaults(self): self.detection.thresholdPolarity = "both" def validate(self): if self.detection.thresholdPolarity != "both": raise ValueError("detection.thresholdPolarity must be 'both' for SnapCombineTask")
class MakeCoaddTempExpConfig(CoaddBaseTask.ConfigClass): """Config for MakeCoaddTempExpTask """ warpAndPsfMatch = pexConfig.ConfigurableField( target=WarpAndPsfMatchTask, doc="Task to warp and PSF-match calexp", ) doWrite = pexConfig.Field( doc="persist <coaddName>Coadd_<warpType>Warp", dtype=bool, default=True, ) bgSubtracted = pexConfig.Field( doc="Work with a background subtracted calexp?", dtype=bool, default=True, ) coaddPsf = pexConfig.ConfigField( doc="Configuration for CoaddPsf", dtype=CoaddPsfConfig, ) makeDirect = pexConfig.Field( doc="Make direct Warp/Coadds", dtype=bool, default=True, ) makePsfMatched = pexConfig.Field( doc="Make Psf-Matched Warp/Coadd?", dtype=bool, default=False, ) doWriteEmptyWarps = pexConfig.Field( dtype=bool, default=False, doc="Write out warps even if they are empty" ) hasFakes = pexConfig.Field( doc="Should be set to True if fake sources have been inserted into the input data.", dtype=bool, default=False, ) doApplySkyCorr = pexConfig.Field(dtype=bool, default=False, doc="Apply sky correction?") def validate(self): CoaddBaseTask.ConfigClass.validate(self) if not self.makePsfMatched and not self.makeDirect: raise RuntimeError("At least one of config.makePsfMatched and config.makeDirect must be True") if self.doPsfMatch: # Backwards compatibility. log.warn("Config doPsfMatch deprecated. Setting makePsfMatched=True and makeDirect=False") self.makePsfMatched = True self.makeDirect = False def setDefaults(self): CoaddBaseTask.ConfigClass.setDefaults(self) self.warpAndPsfMatch.psfMatch.kernel.active.kernelSize = self.matchingKernelSize
class ProcessFileConfig(pexConfig.Config): """A container for the Configs that ProcessFile needs Using such a container allows us to use the standard -c/-C/--show config options that pipe_base provides """ variance = pexConfig.Field( dtype=float, default=np.nan, doc="Initial per-pixel variance (if <= 0, estimate from inputs)") badPixelValue = pexConfig.Field(dtype=float, default=np.nan, doc="Value indicating a bad pixel") interpPlanes = pexConfig.ListField( dtype=str, default=[ "BAD", ], doc="Names of mask planes to interpolate over (e.g. ['BAD', 'SAT'])", itemCheck=lambda x: x in afwImage.MaskU().getMaskPlaneDict().keys()) isr = MyIsrConfig() doCalibrate = pexConfig.Field(dtype=bool, default=True, doc="Calibrate input data?") charImage = pexConfig.ConfigField( dtype=CharacterizeImageTask.ConfigClass, doc=CharacterizeImageTask.ConfigClass.__doc__) detection = pexConfig.ConfigField( dtype=SourceDetectionTask.ConfigClass, doc=SourceDetectionTask.ConfigClass.__doc__) detection.returnOriginalFootprints = False measurement = pexConfig.ConfigField( dtype=SingleFrameMeasurementTask.ConfigClass, doc=SingleFrameMeasurementTask.ConfigClass.__doc__) doDeblend = pexConfig.Field(dtype=bool, default=True, doc="Deblend sources?") if SourceDeblendTask: deblend = pexConfig.ConfigField( dtype=SourceDeblendTask.ConfigClass, doc=SourceDeblendTask.ConfigClass.__doc__)
class SuperTaskConfig(pexConfig.Config): """Base class for all SuperTask configurations. This class defines fields that must be defined for every SuperTask. It will be used as a base class for all SuperTask configurations instead of `pex.config.Config`. """ quantum = pexConfig.ConfigField(dtype=QuantumConfig, doc="configuration for SuperTask quantum")
class DatabaseConfig(pexConfig.Config): # database name name = pexConfig.Field("database name", str) # database system configuration system = pexConfig.ConfigField("database system info", DatabaseSystem) # class used to configure database configurationClass = pexConfig.Field("database configuration class", str) # type of database configuration configuration = pexConfig.ConfigChoiceField("configuration", dbTypemap)
class SubaruCrosstalkConfig(CrosstalkTask.ConfigClass): minPixelToMask = pexConfig.Field( dtype=float, default=45000, doc="Set crosstalk mask plane for pixels over this value") crosstalkMaskPlane = pexConfig.Field(dtype=str, default="CROSSTALK", doc="Name for crosstalk mask plane") coeffs = pexConfig.ConfigField(dtype=CrosstalkCoeffsConfig, doc="Crosstalk coefficients")
class Complex(pexConfig.Config): c = pexConfig.ConfigField("an inner config", InnerConfig) r = pexConfig.ConfigChoiceField("a registry field", typemap=GLOBAL_REGISTRY, default="AAA", optional=False) p = pexConfig.ConfigChoiceField("another registry", typemap=GLOBAL_REGISTRY, default="BBB", optional=True)
class SampleConfig(pexConfig.Config): boolItem = pexConfig.Field(doc="sample bool field", dtype=bool, default=True) floatItem = pexConfig.Field(doc="sample float field", dtype=float, default=3.1) strItem = pexConfig.Field(doc="sample str field", dtype=str, default="strDefault") subItem = pexConfig.ConfigField(doc="sample subfield", dtype=SubConfig) multiDocItem = pexConfig.Field(doc="1. sample... \n#2...multiline \n##3...#\n###4...docstring", dtype=str, default="multiLineDoc") dsType = pexConfig.Field(doc="dataset type for --id argument", dtype=str, default="calexp") dsTypeNoDefault = pexConfig.Field(doc="dataset type for --id argument; no default", dtype=str, optional=True)