31 from .coaddBase
import CoaddBaseTask, makeSkyInfo
32 from .warpAndPsfMatch
import WarpAndPsfMatchTask
33 from .coaddHelpers
import groupPatchExposures, getGroupDataRef
35 __all__ = [
"MakeCoaddTempExpTask",
"MakeWarpTask",
"MakeWarpConfig"]
39 """Raised when data cannot be retrieved for an exposure. 40 When processing patches, sometimes one exposure is missing; this lets us 41 distinguish bewteen that case, and other errors. 47 """Config for MakeCoaddTempExpTask 49 warpAndPsfMatch = pexConfig.ConfigurableField(
50 target=WarpAndPsfMatchTask,
51 doc=
"Task to warp and PSF-match calexp",
53 doWrite = pexConfig.Field(
54 doc=
"persist <coaddName>Coadd_<warpType>Warp",
58 bgSubtracted = pexConfig.Field(
59 doc=
"Work with a background subtracted calexp?",
63 coaddPsf = pexConfig.ConfigField(
64 doc=
"Configuration for CoaddPsf",
67 makeDirect = pexConfig.Field(
68 doc=
"Make direct Warp/Coadds",
72 makePsfMatched = pexConfig.Field(
73 doc=
"Make Psf-Matched Warp/Coadd?",
78 doWriteEmptyWarps = pexConfig.Field(
81 doc=
"Write out warps even if they are empty" 84 hasFakes = pexConfig.Field(
85 doc=
"Should be set to True if fakes ources have been inserted into the input data.",
89 doApplySkyCorr = pexConfig.Field(dtype=bool, default=
False, doc=
"Apply sky correction?")
92 CoaddBaseTask.ConfigClass.validate(self)
94 raise RuntimeError(
"At least one of config.makePsfMatched and config.makeDirect must be True")
97 log.warn(
"Config doPsfMatch deprecated. Setting makePsfMatched=True and makeDirect=False")
102 CoaddBaseTask.ConfigClass.setDefaults(self)
103 self.
warpAndPsfMatch.psfMatch.kernel.active.kernelSize = self.matchingKernelSize
114 r"""!Warp and optionally PSF-Match calexps onto an a common projection. 116 @anchor MakeCoaddTempExpTask_ 118 @section pipe_tasks_makeCoaddTempExp_Contents Contents 120 - @ref pipe_tasks_makeCoaddTempExp_Purpose 121 - @ref pipe_tasks_makeCoaddTempExp_Initialize 122 - @ref pipe_tasks_makeCoaddTempExp_IO 123 - @ref pipe_tasks_makeCoaddTempExp_Config 124 - @ref pipe_tasks_makeCoaddTempExp_Debug 125 - @ref pipe_tasks_makeCoaddTempExp_Example 127 @section pipe_tasks_makeCoaddTempExp_Purpose Description 129 Warp and optionally PSF-Match calexps onto a common projection, by 130 performing the following operations: 131 - Group calexps by visit/run 132 - For each visit, generate a Warp by calling method @ref makeTempExp. 133 makeTempExp loops over the visit's calexps calling @ref WarpAndPsfMatch 136 The result is a `directWarp` (and/or optionally a `psfMatchedWarp`). 138 @section pipe_tasks_makeCoaddTempExp_Initialize Task Initialization 140 @copydoc \_\_init\_\_ 142 This task has one special keyword argument: passing reuse=True will cause 143 the task to skip the creation of warps that are already present in the 146 @section pipe_tasks_makeCoaddTempExp_IO Invoking the Task 148 This task is primarily designed to be run from the command line. 150 The main method is `runDataRef`, which takes a single butler data reference for the patch(es) 155 WarpType identifies the types of convolutions applied to Warps (previously CoaddTempExps). 156 Only two types are available: direct (for regular Warps/Coadds) and psfMatched 157 (for Warps/Coadds with homogenized PSFs). We expect to add a third type, likelihood, 158 for generating likelihood Coadds with Warps that have been correlated with their own PSF. 160 @section pipe_tasks_makeCoaddTempExp_Config Configuration parameters 162 See @ref MakeCoaddTempExpConfig and parameters inherited from 163 @link lsst.pipe.tasks.coaddBase.CoaddBaseConfig CoaddBaseConfig @endlink 165 @subsection pipe_tasks_MakeCoaddTempExp_psfMatching Guide to PSF-Matching Configs 167 To make `psfMatchedWarps`, select `config.makePsfMatched=True`. The subtask 168 @link lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask ModelPsfMatchTask @endlink 169 is responsible for the PSF-Matching, and its config is accessed via `config.warpAndPsfMatch.psfMatch`. 170 The optimal configuration depends on aspects of dataset: the pixel scale, average PSF FWHM and 171 dimensions of the PSF kernel. These configs include the requested model PSF, the matching kernel size, 172 padding of the science PSF thumbnail and spatial sampling frequency of the PSF. 174 *Config Guidelines*: The user must specify the size of the model PSF to which to match by setting 175 `config.modelPsf.defaultFwhm` in units of pixels. The appropriate values depends on science case. 176 In general, for a set of input images, this config should equal the FWHM of the visit 177 with the worst seeing. The smallest it should be set to is the median FWHM. The defaults 178 of the other config options offer a reasonable starting point. 179 The following list presents the most common problems that arise from a misconfigured 180 @link lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask ModelPsfMatchTask @endlink 181 and corresponding solutions. All assume the default Alard-Lupton kernel, with configs accessed via 182 ```config.warpAndPsfMatch.psfMatch.kernel['AL']```. Each item in the list is formatted as: 183 Problem: Explanation. *Solution* 185 *Troublshooting PSF-Matching Configuration:* 186 - Matched PSFs look boxy: The matching kernel is too small. _Increase the matching kernel size. 189 config.warpAndPsfMatch.psfMatch.kernel['AL'].kernelSize=27 # default 21 191 Note that increasing the kernel size also increases runtime. 192 - Matched PSFs look ugly (dipoles, quadropoles, donuts): unable to find good solution 193 for matching kernel. _Provide the matcher with more data by either increasing 194 the spatial sampling by decreasing the spatial cell size,_ 196 config.warpAndPsfMatch.psfMatch.kernel['AL'].sizeCellX = 64 # default 128 197 config.warpAndPsfMatch.psfMatch.kernel['AL'].sizeCellY = 64 # default 128 199 _or increasing the padding around the Science PSF, for example:_ 201 config.warpAndPsfMatch.psfMatch.autoPadPsfTo=1.6 # default 1.4 203 Increasing `autoPadPsfTo` increases the minimum ratio of input PSF dimensions to the 204 matching kernel dimensions, thus increasing the number of pixels available to fit 205 after convolving the PSF with the matching kernel. 206 Optionally, for debugging the effects of padding, the level of padding may be manually 207 controlled by setting turning off the automatic padding and setting the number 208 of pixels by which to pad the PSF: 210 config.warpAndPsfMatch.psfMatch.doAutoPadPsf = False # default True 211 config.warpAndPsfMatch.psfMatch.padPsfBy = 6 # pixels. default 0 213 - Deconvolution: Matching a large PSF to a smaller PSF produces 214 a telltale noise pattern which looks like ripples or a brain. 215 _Increase the size of the requested model PSF. For example:_ 217 config.modelPsf.defaultFwhm = 11 # Gaussian sigma in units of pixels. 219 - High frequency (sometimes checkered) noise: The matching basis functions are too small. 220 _Increase the width of the Gaussian basis functions. For example:_ 222 config.warpAndPsfMatch.psfMatch.kernel['AL'].alardSigGauss=[1.5, 3.0, 6.0] 223 # from default [0.7, 1.5, 3.0] 226 @section pipe_tasks_makeCoaddTempExp_Debug Debug variables 228 MakeCoaddTempExpTask has no debug output, but its subtasks do. 230 @section pipe_tasks_makeCoaddTempExp_Example A complete example of using MakeCoaddTempExpTask 232 This example uses the package ci_hsc to show how MakeCoaddTempExp fits 233 into the larger Data Release Processing. 238 # if not built already: 239 python $(which scons) # this will take a while 241 The following assumes that `processCcd.py` and `makeSkyMap.py` have previously been run 242 (e.g. by building `ci_hsc` above) to generate a repository of calexps and an 243 output respository with the desired SkyMap. The command, 245 makeCoaddTempExp.py $CI_HSC_DIR/DATA --rerun ci_hsc \ 246 --id patch=5,4 tract=0 filter=HSC-I \ 247 --selectId visit=903988 ccd=16 --selectId visit=903988 ccd=17 \ 248 --selectId visit=903988 ccd=23 --selectId visit=903988 ccd=24 \ 249 --config doApplyUberCal=False makePsfMatched=True modelPsf.defaultFwhm=11 251 writes a direct and PSF-Matched Warp to 252 - `$CI_HSC_DIR/DATA/rerun/ci_hsc/deepCoadd/HSC-I/0/5,4/warp-HSC-I-0-5,4-903988.fits` and 253 - `$CI_HSC_DIR/DATA/rerun/ci_hsc/deepCoadd/HSC-I/0/5,4/psfMatchedWarp-HSC-I-0-5,4-903988.fits` 256 @note PSF-Matching in this particular dataset would benefit from adding 257 `--configfile ./matchingConfig.py` to 258 the command line arguments where `matchingConfig.py` is defined by: 261 config.warpAndPsfMatch.psfMatch.kernel['AL'].kernelSize=27 262 config.warpAndPsfMatch.psfMatch.kernel['AL'].alardSigGauss=[1.5, 3.0, 6.0]" > matchingConfig.py 265 Add the option `--help` to see more options. 267 ConfigClass = MakeCoaddTempExpConfig
268 _DefaultName =
"makeCoaddTempExp" 271 CoaddBaseTask.__init__(self, **kwargs)
273 self.makeSubtask(
"warpAndPsfMatch")
274 if self.config.hasFakes:
281 """!Produce <coaddName>Coadd_<warpType>Warp images by warping and optionally PSF-matching. 283 @param[in] patchRef: data reference for sky map patch. Must include keys "tract", "patch", 284 plus the camera-specific filter key (e.g. "filter" or "band") 285 @return: dataRefList: a list of data references for the new <coaddName>Coadd_directWarps 286 if direct or both warp types are requested and <coaddName>Coadd_psfMatchedWarps if only psfMatched 289 @warning: this task assumes that all exposures in a warp (coaddTempExp) have the same filter. 291 @warning: this task sets the PhotoCalib of the coaddTempExp to the PhotoCalib of the first calexp 292 with any good pixels in the patch. For a mosaic camera the resulting PhotoCalib should be ignored 293 (assembleCoadd should determine zeropoint scaling without referring to it). 298 if self.config.makePsfMatched
and not self.config.makeDirect:
303 calExpRefList = self.
selectExposures(patchRef, skyInfo, selectDataList=selectDataList)
305 if len(calExpRefList) == 0:
306 self.log.
warn(
"No exposures to coadd for patch %s", patchRef.dataId)
308 self.log.
info(
"Selected %d calexps for patch %s", len(calExpRefList), patchRef.dataId)
309 calExpRefList = [calExpRef
for calExpRef
in calExpRefList
if calExpRef.datasetExists(self.
calexpType)]
310 self.log.
info(
"Processing %d existing calexps for patch %s", len(calExpRefList), patchRef.dataId)
314 self.log.
info(
"Processing %d warp exposures for patch %s", len(groupData.groups), patchRef.dataId)
317 for i, (tempExpTuple, calexpRefList)
in enumerate(groupData.groups.items()):
319 tempExpTuple, groupData.keys)
320 if self.
reuse and tempExpRef.datasetExists(datasetType=primaryWarpDataset, write=
True):
321 self.log.
info(
"Skipping makeCoaddTempExp for %s; output already exists.", tempExpRef.dataId)
322 dataRefList.append(tempExpRef)
324 self.log.
info(
"Processing Warp %d/%d: id=%s", i, len(groupData.groups), tempExpRef.dataId)
330 visitId =
int(tempExpRef.dataId[
"visit"])
331 except (KeyError, ValueError):
338 for calExpInd, calExpRef
in enumerate(calexpRefList):
339 self.log.
info(
"Reading calexp %s of %s for Warp id=%s", calExpInd+1, len(calexpRefList),
342 ccdId = calExpRef.get(
"ccdExposureId", immediate=
True)
349 calExpRef = calExpRef.butlerSubset.butler.dataRef(self.
calexpType,
350 dataId=calExpRef.dataId,
351 tract=skyInfo.tractInfo.getId())
353 except Exception
as e:
354 self.log.
warn(
"Calexp %s not found; skipping it: %s", calExpRef.dataId, e)
357 if self.config.doApplySkyCorr:
360 calExpList.append(calExp)
361 ccdIdList.append(ccdId)
362 dataIdList.append(calExpRef.dataId)
364 exps = self.
run(calExpList, ccdIdList, skyInfo, visitId, dataIdList).exposures
366 if any(exps.values()):
367 dataRefList.append(tempExpRef)
369 self.log.
warn(
"Warp %s could not be created", tempExpRef.dataId)
371 if self.config.doWrite:
372 for (warpType, exposure)
in exps.items():
373 if exposure
is not None:
379 def run(self, calExpList, ccdIdList, skyInfo, visitId=0, dataIdList=None, **kwargs):
380 """Create a Warp from inputs 382 We iterate over the multiple calexps in a single exposure to construct 383 the warp (previously called a coaddTempExp) of that exposure to the 384 supplied tract/patch. 386 Pixels that receive no pixels are set to NAN; this is not correct 387 (violates LSST algorithms group policy), but will be fixed up by 388 interpolating after the coaddition. 390 @param calexpRefList: List of data references for calexps that (may) 391 overlap the patch of interest 392 @param skyInfo: Struct from CoaddBaseTask.getSkyInfo() with geometric 393 information about the patch 394 @param visitId: integer identifier for visit, for the table that will 396 @return a pipeBase Struct containing: 397 - exposures: a dictionary containing the warps requested: 398 "direct": direct warp if config.makeDirect 399 "psfMatched": PSF-matched warp if config.makePsfMatched 403 totGoodPix = {warpType: 0
for warpType
in warpTypeList}
404 didSetMetadata = {warpType:
False for warpType
in warpTypeList}
406 inputRecorder = {warpType: self.inputRecorder.makeCoaddTempExpRecorder(visitId, len(calExpList))
407 for warpType
in warpTypeList}
409 modelPsf = self.config.modelPsf.apply()
if self.config.makePsfMatched
else None 410 if dataIdList
is None:
411 dataIdList = ccdIdList
413 for calExpInd, (calExp, ccdId, dataId)
in enumerate(zip(calExpList, ccdIdList, dataIdList)):
414 self.log.
info(
"Processing calexp %d of %d for this Warp: id=%s",
415 calExpInd+1, len(calExpList), dataId)
418 warpedAndMatched = self.warpAndPsfMatch.
run(calExp, modelPsf=modelPsf,
419 wcs=skyInfo.wcs, maxBBox=skyInfo.bbox,
420 makeDirect=self.config.makeDirect,
421 makePsfMatched=self.config.makePsfMatched)
422 except Exception
as e:
423 self.log.
warn(
"WarpAndPsfMatch failed for calexp %s; skipping it: %s", dataId, e)
426 numGoodPix = {warpType: 0
for warpType
in warpTypeList}
427 for warpType
in warpTypeList:
428 exposure = warpedAndMatched.getDict()[warpType]
431 coaddTempExp = coaddTempExps[warpType]
432 if didSetMetadata[warpType]:
433 mimg = exposure.getMaskedImage()
434 mimg *= (coaddTempExp.getPhotoCalib().getInstFluxAtZeroMagnitude() /
435 exposure.getPhotoCalib().getInstFluxAtZeroMagnitude())
438 coaddTempExp.getMaskedImage(), exposure.getMaskedImage(), self.
getBadPixelMask())
439 totGoodPix[warpType] += numGoodPix[warpType]
440 self.log.
debug(
"Calexp %s has %d good pixels in this patch (%.1f%%) for %s",
441 dataId, numGoodPix[warpType],
442 100.0*numGoodPix[warpType]/skyInfo.bbox.getArea(), warpType)
443 if numGoodPix[warpType] > 0
and not didSetMetadata[warpType]:
444 coaddTempExp.setPhotoCalib(exposure.getPhotoCalib())
445 coaddTempExp.setFilter(exposure.getFilter())
446 coaddTempExp.getInfo().setVisitInfo(exposure.getInfo().getVisitInfo())
448 coaddTempExp.setPsf(exposure.getPsf())
449 didSetMetadata[warpType] =
True 452 inputRecorder[warpType].addCalExp(calExp, ccdId, numGoodPix[warpType])
454 except Exception
as e:
455 self.log.
warn(
"Error processing calexp %s; skipping it: %s", dataId, e)
458 for warpType
in warpTypeList:
459 self.log.
info(
"%sWarp has %d good pixels (%.1f%%)",
460 warpType, totGoodPix[warpType], 100.0*totGoodPix[warpType]/skyInfo.bbox.getArea())
462 if totGoodPix[warpType] > 0
and didSetMetadata[warpType]:
463 inputRecorder[warpType].finish(coaddTempExps[warpType], totGoodPix[warpType])
464 if warpType ==
"direct":
465 coaddTempExps[warpType].setPsf(
466 CoaddPsf(inputRecorder[warpType].coaddInputs.ccds, skyInfo.wcs,
467 self.config.coaddPsf.makeControl()))
469 if not self.config.doWriteEmptyWarps:
471 coaddTempExps[warpType] =
None 473 result = pipeBase.Struct(exposures=coaddTempExps)
477 """Return one calibrated Exposure, possibly with an updated SkyWcs. 479 @param[in] dataRef a sensor-level data reference 480 @param[in] bgSubtracted return calexp with background subtracted? If False get the 481 calexp's background background model and add it to the calexp. 482 @return calibrated exposure 484 @raises MissingExposureError If data for the exposure is not available. 486 If config.doApplyUberCal, the exposure will be photometrically 487 calibrated via the `jointcal_photoCalib` dataset and have its SkyWcs 488 updated to the `jointcal_wcs`, otherwise it will be calibrated via the 489 Exposure's own PhotoCalib and have the original SkyWcs. 492 exposure = dataRef.get(self.
calexpType, immediate=
True)
497 background = dataRef.get(
"calexpBackground", immediate=
True)
498 mi = exposure.getMaskedImage()
499 mi += background.getImage()
502 if self.config.doApplyUberCal:
503 if self.config.useMeasMosaic:
504 from lsst.meas.mosaic
import applyMosaicResultsExposure
507 calibrationErr = exposure.getPhotoCalib().getCalibrationErr()
509 applyMosaicResultsExposure(dataRef, calexp=exposure)
516 photoCalib = dataRef.get(
"jointcal_photoCalib")
517 skyWcs = dataRef.get(
"jointcal_wcs")
518 exposure.setWcs(skyWcs)
520 photoCalib = exposure.getPhotoCalib()
522 exposure.maskedImage = photoCalib.calibrateImage(exposure.maskedImage,
523 includeScaleUncertainty=self.config.includeCalibVar)
524 exposure.maskedImage /= photoCalib.getCalibrationMean()
525 exposure.setPhotoCalib(photoCalib)
531 def _prepareEmptyExposure(skyInfo):
532 """Produce an empty exposure for a given patch""" 533 exp = afwImage.ExposureF(skyInfo.bbox, skyInfo.wcs)
535 .getPlaneBitMask(
"NO_DATA"), numpy.inf)
539 """Return list of requested warp types per the config. 542 if self.config.makeDirect:
543 warpTypeList.append(
"direct")
544 if self.config.makePsfMatched:
545 warpTypeList.append(
"psfMatched")
549 """Apply correction to the sky background level 551 Sky corrections can be generated with the 'skyCorrection.py' 552 executable in pipe_drivers. Because the sky model used by that 553 code extends over the entire focal plane, this can produce 554 better sky subtraction. 556 The calexp is updated in-place. 560 dataRef : `lsst.daf.persistence.ButlerDataRef` 561 Data reference for calexp. 562 calexp : `lsst.afw.image.Exposure` or `lsst.afw.image.MaskedImage` 565 bg = dataRef.get(
"skyCorr")
567 calexp = calexp.getMaskedImage()
568 calexp -= bg.getImage()
572 calExpList = pipeBase.InputDatasetField(
573 doc=
"Input exposures to be resampled and optionally PSF-matched onto a SkyMap projection/patch",
575 storageClass=
"ExposureF",
576 dimensions=(
"instrument",
"visit",
"detector")
578 backgroundList = pipeBase.InputDatasetField(
579 doc=
"Input backgrounds to be added back into the calexp if bgSubtracted=False",
580 name=
"calexpBackground",
581 storageClass=
"Background",
582 dimensions=(
"instrument",
"visit",
"detector")
584 skyCorrList = pipeBase.InputDatasetField(
585 doc=
"Input Sky Correction to be subtracted from the calexp if doApplySkyCorr=True",
587 storageClass=
"Background",
588 dimensions=(
"instrument",
"visit",
"detector")
590 skyMap = pipeBase.InputDatasetField(
591 doc=
"Input definition of geometry/bbox and projection/wcs for warped exposures",
592 nameTemplate=
"{coaddName}Coadd_skyMap",
593 storageClass=
"SkyMap",
594 dimensions=(
"skymap",),
597 direct = pipeBase.OutputDatasetField(
598 doc=(
"Output direct warped exposure (previously called CoaddTempExp), produced by resampling ",
599 "calexps onto the skyMap patch geometry."),
600 nameTemplate=
"{coaddName}Coadd_directWarp",
601 storageClass=
"ExposureF",
602 dimensions=(
"tract",
"patch",
"skymap",
"visit",
"instrument"),
605 psfMatched = pipeBase.OutputDatasetField(
606 doc=(
"Output PSF-Matched warped exposure (previously called CoaddTempExp), produced by resampling ",
607 "calexps onto the skyMap patch geometry and PSF-matching to a model PSF."),
608 nameTemplate=
"{coaddName}Coadd_psfMatchedWarp",
609 storageClass=
"ExposureF",
610 dimensions=(
"tract",
"patch",
"skymap",
"visit",
"instrument"),
616 self.formatTemplateNames({
"coaddName":
"deep"})
617 self.quantum.dimensions = (
"tract",
"patch",
"skymap",
"visit")
622 if self.doApplyUberCal:
623 raise RuntimeError(
"Gen3 MakeWarpTask cannot apply meas_mosaic or jointcal results." 624 "Please set doApplyUbercal=False.")
628 """Warp and optionally PSF-Match calexps onto an a common projection 630 First Draft of a Gen3 compatible MakeWarpTask which 631 currently does not handle doApplyUberCal=True. 633 ConfigClass = MakeWarpConfig
634 _DefaultName =
"makeWarp" 638 """Return input dataset type descriptors 640 Remove input dataset types not used by the Task 643 if config.bgSubtracted:
644 inputTypeDict.pop(
"backgroundList",
None)
645 if not config.doApplySkyCorr:
646 inputTypeDict.pop(
"skyCorrList",
None)
651 """Return output dataset type descriptors 653 Remove output dataset types not produced by the Task 656 if not config.makeDirect:
657 outputTypeDict.pop(
"direct",
None)
658 if not config.makePsfMatched:
659 outputTypeDict.pop(
"psfMatched",
None)
660 return outputTypeDict
663 """Construct warps for requested warp type for single epoch 665 PipelineTask (Gen3) entry point to warp and optionally PSF-match 666 calexps. This method is analogous to `runDataRef`, it prepares all 667 the data products to be passed to `run`. 668 Return a Struct with only requested warpTypes controlled by the configs 669 makePsfMatched and makeDirect. 674 Keys are the names of the configs describing input dataset types. 675 Values are input Python-domain data objects (or lists of objects) 676 retrieved from data butler. 677 inputDataIds : `dict` 678 Keys are the names of the configs describing input dataset types. 679 Values are DataIds (or lists of DataIds) that task consumes for 680 corresponding dataset type. 681 outputDataIds : `dict` 682 Keys are the names of the configs describing input dataset types. 683 Values are DataIds (or lists of DataIds) that task is to produce 684 for corresponding dataset type. 685 butler : `lsst.daf.butler.Butler` 686 Gen3 Butler object for fetching additional data products before 691 result : `lsst.pipe.base.Struct` 692 Result struct with components: 694 - ``direct`` : (optional) direct Warp Exposure 695 (``lsst.afw.image.Exposure``) 696 - ``psfMatched``: (optional) PSF-Matched Warp Exposure 697 (``lsst.afw.image.Exposure``) 700 skyMap = inputData[
"skyMap"]
701 outputDataId = next(iter(outputDataIds.values()))
703 tractId=outputDataId[
'tract'],
704 patchId=outputDataId[
'patch'])
707 dataIdList = inputDataIds[
'calExpList']
708 inputData[
'dataIdList'] = dataIdList
711 inputData[
'ccdIdList'] = [butler.registry.packDataId(
"visit_detector", dataId)
712 for dataId
in dataIdList]
715 visits = [dataId[
'visit']
for dataId
in dataIdList]
716 assert(
all(visits[0] == visit
for visit
in visits))
717 inputData[
"visitId"] = visits[0]
720 results = self.
run(**inputData)
721 return pipeBase.Struct(**results.exposures)
724 """Calibrate and add backgrounds to input calExpList in place 726 TODO DM-17062: apply jointcal/meas_mosaic here 730 calExpList : `list` of `lsst.afw.image.Exposure` 731 Sequence of calexps to be modified in place 732 backgroundList : `list` of `lsst.afw.math.backgroundList` 733 Sequence of backgrounds to be added back in if bgSubtracted=False 734 skyCorrList : `list` of `lsst.afw.math.backgroundList` 735 Sequence of background corrections to be subtracted if doApplySkyCorr=True 737 backgroundList = len(calExpList)*[
None]
if backgroundList
is None else backgroundList
738 skyCorrList = len(calExpList)*[
None]
if skyCorrList
is None else skyCorrList
739 for calexp, background, skyCorr
in zip(calExpList, backgroundList, skyCorrList):
740 mi = calexp.maskedImage
741 if not self.config.bgSubtracted:
742 mi += background.getImage()
743 if self.config.doApplySkyCorr:
744 mi -= skyCorr.getImage()
def getCoaddDatasetName(self, warpType="direct")
def getGroupDataRef(butler, datasetType, groupTuple, keys)
Base class for coaddition.
def getOutputDatasetTypes(cls, config)
The photometric calibration of an exposure.
def prepareCalibratedExposures(self, calExpList, backgroundList=None, skyCorrList=None, kwargs)
A class to contain the data, WCS, and other information needed to describe an image of the sky...
def __init__(self, reuse=False, kwargs)
def makeSkyInfo(skyMap, tractId, patchId)
def _prepareEmptyExposure(skyInfo)
Fit spatial kernel using approximate fluxes for candidates, and solving a linear system of equations...
daf::base::PropertySet * set
Warp and optionally PSF-Match calexps onto an a common projection.
bool any(CoordinateExpr< N > const &expr) noexcept
Return true if any elements are true.
def adaptArgsAndRun(self, inputData, inputDataIds, outputDataIds, butler)
def getSkyInfo(self, patchRef)
Use getSkyinfo to return the skyMap, tract and patch information, wcs and the outer bbox of the patch...
def getTempExpDatasetName(self, warpType="direct")
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
def run(self, calExpList, ccdIdList, skyInfo, visitId=0, dataIdList=None, kwargs)
def getBadPixelMask(self)
Convenience method to provide the bitmask from the mask plane names.
Represent a 2-dimensional array of bitmask pixels.
CoaddPsf is the Psf derived to be used for non-PSF-matched Coadd images.
def getInputDatasetTypes(cls, config)
def getCalibratedExposure(self, dataRef, bgSubtracted)
def selectExposures(self, patchRef, skyInfo=None, selectDataList=[])
Select exposures to coadd.
def runDataRef(self, patchRef, selectDataList=[])
Produce <coaddName>Coadd_<warpType>Warp images by warping and optionally PSF-matching.
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
int copyGoodPixels(lsst::afw::image::MaskedImage< ImagePixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > &destImage, lsst::afw::image::MaskedImage< ImagePixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > const &srcImage, lsst::afw::image::MaskPixel const badPixelMask)
copy good pixels from one masked image to another
def getWarpTypeList(self)
def groupPatchExposures(patchDataRef, calexpDataRefList, coaddDatasetType="deepCoadd", tempExpDatasetType="deepCoadd_directWarp")
def applySkyCorr(self, dataRef, calexp)