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?",
77 doWriteEmptyWarps = pexConfig.Field(
80 doc=
"Write out warps even if they are empty" 82 doApplySkyCorr = pexConfig.Field(dtype=bool, default=
False, doc=
"Apply sky correction?")
85 CoaddBaseTask.ConfigClass.validate(self)
87 raise RuntimeError(
"At least one of config.makePsfMatched and config.makeDirect must be True")
90 log.warn(
"Config doPsfMatch deprecated. Setting makePsfMatched=True and makeDirect=False")
95 CoaddBaseTask.ConfigClass.setDefaults(self)
96 self.
warpAndPsfMatch.psfMatch.kernel.active.kernelSize = self.matchingKernelSize
107 r"""!Warp and optionally PSF-Match calexps onto an a common projection. 109 @anchor MakeCoaddTempExpTask_ 111 @section pipe_tasks_makeCoaddTempExp_Contents Contents 113 - @ref pipe_tasks_makeCoaddTempExp_Purpose 114 - @ref pipe_tasks_makeCoaddTempExp_Initialize 115 - @ref pipe_tasks_makeCoaddTempExp_IO 116 - @ref pipe_tasks_makeCoaddTempExp_Config 117 - @ref pipe_tasks_makeCoaddTempExp_Debug 118 - @ref pipe_tasks_makeCoaddTempExp_Example 120 @section pipe_tasks_makeCoaddTempExp_Purpose Description 122 Warp and optionally PSF-Match calexps onto a common projection, by 123 performing the following operations: 124 - Group calexps by visit/run 125 - For each visit, generate a Warp by calling method @ref makeTempExp. 126 makeTempExp loops over the visit's calexps calling @ref WarpAndPsfMatch 129 The result is a `directWarp` (and/or optionally a `psfMatchedWarp`). 131 @section pipe_tasks_makeCoaddTempExp_Initialize Task Initialization 133 @copydoc \_\_init\_\_ 135 This task has one special keyword argument: passing reuse=True will cause 136 the task to skip the creation of warps that are already present in the 139 @section pipe_tasks_makeCoaddTempExp_IO Invoking the Task 141 This task is primarily designed to be run from the command line. 143 The main method is `runDataRef`, which takes a single butler data reference for the patch(es) 148 WarpType identifies the types of convolutions applied to Warps (previously CoaddTempExps). 149 Only two types are available: direct (for regular Warps/Coadds) and psfMatched 150 (for Warps/Coadds with homogenized PSFs). We expect to add a third type, likelihood, 151 for generating likelihood Coadds with Warps that have been correlated with their own PSF. 153 @section pipe_tasks_makeCoaddTempExp_Config Configuration parameters 155 See @ref MakeCoaddTempExpConfig and parameters inherited from 156 @link lsst.pipe.tasks.coaddBase.CoaddBaseConfig CoaddBaseConfig @endlink 158 @subsection pipe_tasks_MakeCoaddTempExp_psfMatching Guide to PSF-Matching Configs 160 To make `psfMatchedWarps`, select `config.makePsfMatched=True`. The subtask 161 @link lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask ModelPsfMatchTask @endlink 162 is responsible for the PSF-Matching, and its config is accessed via `config.warpAndPsfMatch.psfMatch`. 163 The optimal configuration depends on aspects of dataset: the pixel scale, average PSF FWHM and 164 dimensions of the PSF kernel. These configs include the requested model PSF, the matching kernel size, 165 padding of the science PSF thumbnail and spatial sampling frequency of the PSF. 167 *Config Guidelines*: The user must specify the size of the model PSF to which to match by setting 168 `config.modelPsf.defaultFwhm` in units of pixels. The appropriate values depends on science case. 169 In general, for a set of input images, this config should equal the FWHM of the visit 170 with the worst seeing. The smallest it should be set to is the median FWHM. The defaults 171 of the other config options offer a reasonable starting point. 172 The following list presents the most common problems that arise from a misconfigured 173 @link lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask ModelPsfMatchTask @endlink 174 and corresponding solutions. All assume the default Alard-Lupton kernel, with configs accessed via 175 ```config.warpAndPsfMatch.psfMatch.kernel['AL']```. Each item in the list is formatted as: 176 Problem: Explanation. *Solution* 178 *Troublshooting PSF-Matching Configuration:* 179 - Matched PSFs look boxy: The matching kernel is too small. _Increase the matching kernel size. 182 config.warpAndPsfMatch.psfMatch.kernel['AL'].kernelSize=27 # default 21 184 Note that increasing the kernel size also increases runtime. 185 - Matched PSFs look ugly (dipoles, quadropoles, donuts): unable to find good solution 186 for matching kernel. _Provide the matcher with more data by either increasing 187 the spatial sampling by decreasing the spatial cell size,_ 189 config.warpAndPsfMatch.psfMatch.kernel['AL'].sizeCellX = 64 # default 128 190 config.warpAndPsfMatch.psfMatch.kernel['AL'].sizeCellY = 64 # default 128 192 _or increasing the padding around the Science PSF, for example:_ 194 config.warpAndPsfMatch.psfMatch.autoPadPsfTo=1.6 # default 1.4 196 Increasing `autoPadPsfTo` increases the minimum ratio of input PSF dimensions to the 197 matching kernel dimensions, thus increasing the number of pixels available to fit 198 after convolving the PSF with the matching kernel. 199 Optionally, for debugging the effects of padding, the level of padding may be manually 200 controlled by setting turning off the automatic padding and setting the number 201 of pixels by which to pad the PSF: 203 config.warpAndPsfMatch.psfMatch.doAutoPadPsf = False # default True 204 config.warpAndPsfMatch.psfMatch.padPsfBy = 6 # pixels. default 0 206 - Deconvolution: Matching a large PSF to a smaller PSF produces 207 a telltale noise pattern which looks like ripples or a brain. 208 _Increase the size of the requested model PSF. For example:_ 210 config.modelPsf.defaultFwhm = 11 # Gaussian sigma in units of pixels. 212 - High frequency (sometimes checkered) noise: The matching basis functions are too small. 213 _Increase the width of the Gaussian basis functions. For example:_ 215 config.warpAndPsfMatch.psfMatch.kernel['AL'].alardSigGauss=[1.5, 3.0, 6.0] 216 # from default [0.7, 1.5, 3.0] 219 @section pipe_tasks_makeCoaddTempExp_Debug Debug variables 221 MakeCoaddTempExpTask has no debug output, but its subtasks do. 223 @section pipe_tasks_makeCoaddTempExp_Example A complete example of using MakeCoaddTempExpTask 225 This example uses the package ci_hsc to show how MakeCoaddTempExp fits 226 into the larger Data Release Processing. 231 # if not built already: 232 python $(which scons) # this will take a while 234 The following assumes that `processCcd.py` and `makeSkyMap.py` have previously been run 235 (e.g. by building `ci_hsc` above) to generate a repository of calexps and an 236 output respository with the desired SkyMap. The command, 238 makeCoaddTempExp.py $CI_HSC_DIR/DATA --rerun ci_hsc \ 239 --id patch=5,4 tract=0 filter=HSC-I \ 240 --selectId visit=903988 ccd=16 --selectId visit=903988 ccd=17 \ 241 --selectId visit=903988 ccd=23 --selectId visit=903988 ccd=24 \ 242 --config doApplyUberCal=False makePsfMatched=True modelPsf.defaultFwhm=11 244 writes a direct and PSF-Matched Warp to 245 - `$CI_HSC_DIR/DATA/rerun/ci_hsc/deepCoadd/HSC-I/0/5,4/warp-HSC-I-0-5,4-903988.fits` and 246 - `$CI_HSC_DIR/DATA/rerun/ci_hsc/deepCoadd/HSC-I/0/5,4/psfMatchedWarp-HSC-I-0-5,4-903988.fits` 249 @note PSF-Matching in this particular dataset would benefit from adding 250 `--configfile ./matchingConfig.py` to 251 the command line arguments where `matchingConfig.py` is defined by: 254 config.warpAndPsfMatch.psfMatch.kernel['AL'].kernelSize=27 255 config.warpAndPsfMatch.psfMatch.kernel['AL'].alardSigGauss=[1.5, 3.0, 6.0]" > matchingConfig.py 258 Add the option `--help` to see more options. 260 ConfigClass = MakeCoaddTempExpConfig
261 _DefaultName =
"makeCoaddTempExp" 264 CoaddBaseTask.__init__(self, **kwargs)
266 self.makeSubtask(
"warpAndPsfMatch")
270 """!Produce <coaddName>Coadd_<warpType>Warp images by warping and optionally PSF-matching. 272 @param[in] patchRef: data reference for sky map patch. Must include keys "tract", "patch", 273 plus the camera-specific filter key (e.g. "filter" or "band") 274 @return: dataRefList: a list of data references for the new <coaddName>Coadd_directWarps 275 if direct or both warp types are requested and <coaddName>Coadd_psfMatchedWarps if only psfMatched 278 @warning: this task assumes that all exposures in a warp (coaddTempExp) have the same filter. 280 @warning: this task sets the PhotoCalib of the coaddTempExp to the PhotoCalib of the first calexp 281 with any good pixels in the patch. For a mosaic camera the resulting PhotoCalib should be ignored 282 (assembleCoadd should determine zeropoint scaling without referring to it). 287 if self.config.makePsfMatched
and not self.config.makeDirect:
292 calExpRefList = self.
selectExposures(patchRef, skyInfo, selectDataList=selectDataList)
293 if len(calExpRefList) == 0:
294 self.log.warn(
"No exposures to coadd for patch %s", patchRef.dataId)
296 self.log.info(
"Selected %d calexps for patch %s", len(calExpRefList), patchRef.dataId)
297 calExpRefList = [calExpRef
for calExpRef
in calExpRefList
if calExpRef.datasetExists(
"calexp")]
298 self.log.info(
"Processing %d existing calexps for patch %s", len(calExpRefList), patchRef.dataId)
302 self.log.info(
"Processing %d warp exposures for patch %s", len(groupData.groups), patchRef.dataId)
305 for i, (tempExpTuple, calexpRefList)
in enumerate(groupData.groups.items()):
307 tempExpTuple, groupData.keys)
308 if self.
reuse and tempExpRef.datasetExists(datasetType=primaryWarpDataset, write=
True):
309 self.log.info(
"Skipping makeCoaddTempExp for %s; output already exists.", tempExpRef.dataId)
310 dataRefList.append(tempExpRef)
312 self.log.info(
"Processing Warp %d/%d: id=%s", i, len(groupData.groups), tempExpRef.dataId)
318 visitId = int(tempExpRef.dataId[
"visit"])
319 except (KeyError, ValueError):
326 for calExpInd, calExpRef
in enumerate(calexpRefList):
327 self.log.info(
"Reading calexp %s of %s for Warp id=%s", calExpInd+1, len(calexpRefList),
330 ccdId = calExpRef.get(
"ccdExposureId", immediate=
True)
337 calExpRef = calExpRef.butlerSubset.butler.dataRef(
"calexp", dataId=calExpRef.dataId,
338 tract=skyInfo.tractInfo.getId())
340 except Exception
as e:
341 self.log.warn(
"Calexp %s not found; skipping it: %s", calExpRef.dataId, e)
344 if self.config.doApplySkyCorr:
347 calExpList.append(calExp)
348 ccdIdList.append(ccdId)
349 dataIdList.append(calExpRef.dataId)
351 exps = self.
run(calExpList, ccdIdList, skyInfo, visitId, dataIdList).exposures
353 if any(exps.values()):
354 dataRefList.append(tempExpRef)
356 self.log.warn(
"Warp %s could not be created", tempExpRef.dataId)
358 if self.config.doWrite:
359 for (warpType, exposure)
in exps.items():
360 if exposure
is not None:
366 def run(self, calExpList, ccdIdList, skyInfo, visitId=0, dataIdList=None, **kwargs):
367 """Create a Warp from inputs 369 We iterate over the multiple calexps in a single exposure to construct 370 the warp (previously called a coaddTempExp) of that exposure to the 371 supplied tract/patch. 373 Pixels that receive no pixels are set to NAN; this is not correct 374 (violates LSST algorithms group policy), but will be fixed up by 375 interpolating after the coaddition. 377 @param calexpRefList: List of data references for calexps that (may) 378 overlap the patch of interest 379 @param skyInfo: Struct from CoaddBaseTask.getSkyInfo() with geometric 380 information about the patch 381 @param visitId: integer identifier for visit, for the table that will 383 @return a pipeBase Struct containing: 384 - exposures: a dictionary containing the warps requested: 385 "direct": direct warp if config.makeDirect 386 "psfMatched": PSF-matched warp if config.makePsfMatched 390 totGoodPix = {warpType: 0
for warpType
in warpTypeList}
391 didSetMetadata = {warpType:
False for warpType
in warpTypeList}
393 inputRecorder = {warpType: self.inputRecorder.makeCoaddTempExpRecorder(visitId, len(calExpList))
394 for warpType
in warpTypeList}
396 modelPsf = self.config.modelPsf.apply()
if self.config.makePsfMatched
else None 397 if dataIdList
is None:
398 dataIdList = ccdIdList
400 for calExpInd, (calExp, ccdId, dataId)
in enumerate(zip(calExpList, ccdIdList, dataIdList)):
401 self.log.info(
"Processing calexp %d of %d for this Warp: id=%s",
402 calExpInd+1, len(calExpList), dataId)
405 warpedAndMatched = self.warpAndPsfMatch.
run(calExp, modelPsf=modelPsf,
406 wcs=skyInfo.wcs, maxBBox=skyInfo.bbox,
407 makeDirect=self.config.makeDirect,
408 makePsfMatched=self.config.makePsfMatched)
409 except Exception
as e:
410 self.log.warn(
"WarpAndPsfMatch failed for calexp %s; skipping it: %s", dataId, e)
413 numGoodPix = {warpType: 0
for warpType
in warpTypeList}
414 for warpType
in warpTypeList:
415 exposure = warpedAndMatched.getDict()[warpType]
418 coaddTempExp = coaddTempExps[warpType]
419 if didSetMetadata[warpType]:
420 mimg = exposure.getMaskedImage()
421 mimg *= (coaddTempExp.getPhotoCalib().getInstFluxAtZeroMagnitude() /
422 exposure.getPhotoCalib().getInstFluxAtZeroMagnitude())
424 numGoodPix[warpType] = coaddUtils.copyGoodPixels(
425 coaddTempExp.getMaskedImage(), exposure.getMaskedImage(), self.
getBadPixelMask())
426 totGoodPix[warpType] += numGoodPix[warpType]
427 self.log.debug(
"Calexp %s has %d good pixels in this patch (%.1f%%) for %s",
428 dataId, numGoodPix[warpType],
429 100.0*numGoodPix[warpType]/skyInfo.bbox.getArea(), warpType)
430 if numGoodPix[warpType] > 0
and not didSetMetadata[warpType]:
431 coaddTempExp.setPhotoCalib(exposure.getPhotoCalib())
432 coaddTempExp.setFilter(exposure.getFilter())
433 coaddTempExp.getInfo().setVisitInfo(exposure.getInfo().getVisitInfo())
435 coaddTempExp.setPsf(exposure.getPsf())
436 didSetMetadata[warpType] =
True 439 inputRecorder[warpType].addCalExp(calExp, ccdId, numGoodPix[warpType])
441 except Exception
as e:
442 self.log.warn(
"Error processing calexp %s; skipping it: %s", dataId, e)
445 for warpType
in warpTypeList:
446 self.log.info(
"%sWarp has %d good pixels (%.1f%%)",
447 warpType, totGoodPix[warpType], 100.0*totGoodPix[warpType]/skyInfo.bbox.getArea())
449 if totGoodPix[warpType] > 0
and didSetMetadata[warpType]:
450 inputRecorder[warpType].finish(coaddTempExps[warpType], totGoodPix[warpType])
451 if warpType ==
"direct":
452 coaddTempExps[warpType].setPsf(
453 CoaddPsf(inputRecorder[warpType].coaddInputs.ccds, skyInfo.wcs,
454 self.config.coaddPsf.makeControl()))
456 if not self.config.doWriteEmptyWarps:
458 coaddTempExps[warpType] =
None 460 result = pipeBase.Struct(exposures=coaddTempExps)
464 """Return one calibrated Exposure, possibly with an updated SkyWcs. 466 @param[in] dataRef a sensor-level data reference 467 @param[in] bgSubtracted return calexp with background subtracted? If False get the 468 calexp's background background model and add it to the calexp. 469 @return calibrated exposure 471 @raises MissingExposureError If data for the exposure is not available. 473 If config.doApplyUberCal, the exposure will be photometrically 474 calibrated via the `jointcal_photoCalib` dataset and have its SkyWcs 475 updated to the `jointcal_wcs`, otherwise it will be calibrated via the 476 Exposure's own PhotoCalib and have the original SkyWcs. 479 exposure = dataRef.get(
"calexp", immediate=
True)
480 except dafPersist.NoResults
as e:
484 background = dataRef.get(
"calexpBackground", immediate=
True)
485 mi = exposure.getMaskedImage()
486 mi += background.getImage()
489 if self.config.doApplyUberCal:
490 if self.config.useMeasMosaic:
491 from lsst.meas.mosaic
import applyMosaicResultsExposure
494 calibrationErr = exposure.getPhotoCalib().getCalibrationErr()
496 applyMosaicResultsExposure(dataRef, calexp=exposure)
497 except dafPersist.NoResults
as e:
499 photoCalib = afwImage.PhotoCalib(exposure.getPhotoCalib().getCalibrationMean(),
503 photoCalib = dataRef.get(
"jointcal_photoCalib")
504 skyWcs = dataRef.get(
"jointcal_wcs")
505 exposure.setWcs(skyWcs)
507 photoCalib = exposure.getPhotoCalib()
509 exposure.maskedImage = photoCalib.calibrateImage(exposure.maskedImage,
510 includeScaleUncertainty=self.config.includeCalibVar)
511 exposure.maskedImage /= photoCalib.getCalibrationMean()
512 exposure.setPhotoCalib(photoCalib)
518 def _prepareEmptyExposure(skyInfo):
519 """Produce an empty exposure for a given patch""" 520 exp = afwImage.ExposureF(skyInfo.bbox, skyInfo.wcs)
521 exp.getMaskedImage().set(numpy.nan, afwImage.Mask
522 .getPlaneBitMask(
"NO_DATA"), numpy.inf)
526 """Return list of requested warp types per the config. 529 if self.config.makeDirect:
530 warpTypeList.append(
"direct")
531 if self.config.makePsfMatched:
532 warpTypeList.append(
"psfMatched")
536 """Apply correction to the sky background level 538 Sky corrections can be generated with the 'skyCorrection.py' 539 executable in pipe_drivers. Because the sky model used by that 540 code extends over the entire focal plane, this can produce 541 better sky subtraction. 543 The calexp is updated in-place. 547 dataRef : `lsst.daf.persistence.ButlerDataRef` 548 Data reference for calexp. 549 calexp : `lsst.afw.image.Exposure` or `lsst.afw.image.MaskedImage` 552 bg = dataRef.get(
"skyCorr")
553 if isinstance(calexp, afwImage.Exposure):
554 calexp = calexp.getMaskedImage()
555 calexp -= bg.getImage()
559 calExpList = pipeBase.InputDatasetField(
560 doc=
"Input exposures to be resampled and optionally PSF-matched onto a SkyMap projection/patch",
562 storageClass=
"ExposureF",
563 dimensions=(
"instrument",
"visit",
"detector")
565 backgroundList = pipeBase.InputDatasetField(
566 doc=
"Input backgrounds to be added back into the calexp if bgSubtracted=False",
567 name=
"calexpBackground",
568 storageClass=
"Background",
569 dimensions=(
"instrument",
"visit",
"detector")
571 skyCorrList = pipeBase.InputDatasetField(
572 doc=
"Input Sky Correction to be subtracted from the calexp if doApplySkyCorr=True",
574 storageClass=
"Background",
575 dimensions=(
"instrument",
"visit",
"detector")
577 skyMap = pipeBase.InputDatasetField(
578 doc=
"Input definition of geometry/bbox and projection/wcs for warped exposures",
579 nameTemplate=
"{coaddName}Coadd_skyMap",
580 storageClass=
"SkyMap",
581 dimensions=(
"skymap",),
584 direct = pipeBase.OutputDatasetField(
585 doc=(
"Output direct warped exposure (previously called CoaddTempExp), produced by resampling ",
586 "calexps onto the skyMap patch geometry."),
587 nameTemplate=
"{coaddName}Coadd_directWarp",
588 storageClass=
"ExposureF",
589 dimensions=(
"tract",
"patch",
"skymap",
"visit",
"instrument"),
592 psfMatched = pipeBase.OutputDatasetField(
593 doc=(
"Output PSF-Matched warped exposure (previously called CoaddTempExp), produced by resampling ",
594 "calexps onto the skyMap patch geometry and PSF-matching to a model PSF."),
595 nameTemplate=
"{coaddName}Coadd_psfMatchedWarp",
596 storageClass=
"ExposureF",
597 dimensions=(
"tract",
"patch",
"skymap",
"visit",
"instrument"),
603 self.formatTemplateNames({
"coaddName":
"deep"})
604 self.quantum.dimensions = (
"tract",
"patch",
"skymap",
"visit")
609 if self.doApplyUberCal:
610 raise RuntimeError(
"Gen3 MakeWarpTask cannot apply meas_mosaic or jointcal results." 611 "Please set doApplyUbercal=False.")
615 """Warp and optionally PSF-Match calexps onto an a common projection 617 First Draft of a Gen3 compatible MakeWarpTask which 618 currently does not handle doApplyUberCal=True. 620 ConfigClass = MakeWarpConfig
621 _DefaultName =
"makeWarp" 625 """Return input dataset type descriptors 627 Remove input dataset types not used by the Task 630 if config.bgSubtracted:
631 inputTypeDict.pop(
"backgroundList",
None)
632 if not config.doApplySkyCorr:
633 inputTypeDict.pop(
"skyCorrList",
None)
638 """Return output dataset type descriptors 640 Remove output dataset types not produced by the Task 643 if not config.makeDirect:
644 outputTypeDict.pop(
"direct",
None)
645 if not config.makePsfMatched:
646 outputTypeDict.pop(
"psfMatched",
None)
647 return outputTypeDict
650 """Construct warps for requested warp type for single epoch 652 PipelineTask (Gen3) entry point to warp and optionally PSF-match 653 calexps. This method is analogous to `runDataRef`, it prepares all 654 the data products to be passed to `run`. 655 Return a Struct with only requested warpTypes controlled by the configs 656 makePsfMatched and makeDirect. 661 Keys are the names of the configs describing input dataset types. 662 Values are input Python-domain data objects (or lists of objects) 663 retrieved from data butler. 664 inputDataIds : `dict` 665 Keys are the names of the configs describing input dataset types. 666 Values are DataIds (or lists of DataIds) that task consumes for 667 corresponding dataset type. 668 outputDataIds : `dict` 669 Keys are the names of the configs describing input dataset types. 670 Values are DataIds (or lists of DataIds) that task is to produce 671 for corresponding dataset type. 672 butler : `lsst.daf.butler.Butler` 673 Gen3 Butler object for fetching additional data products before 678 result : `lsst.pipe.base.Struct` 679 Result struct with components: 681 - ``direct`` : (optional) direct Warp Exposure 682 (``lsst.afw.image.Exposure``) 683 - ``psfMatched``: (optional) PSF-Matched Warp Exposure 684 (``lsst.afw.image.Exposure``) 687 skyMap = inputData[
"skyMap"]
688 outputDataId = next(iter(outputDataIds.values()))
690 tractId=outputDataId[
'tract'],
691 patchId=outputDataId[
'patch'])
694 dataIdList = inputDataIds[
'calExpList']
695 inputData[
'dataIdList'] = dataIdList
698 inputData[
'ccdIdList'] = [butler.registry.packDataId(
"visit_detector", dataId)
699 for dataId
in dataIdList]
702 visits = [dataId[
'visit']
for dataId
in dataIdList]
703 assert(all(visits[0] == visit
for visit
in visits))
704 inputData[
"visitId"] = visits[0]
707 results = self.
run(**inputData)
708 return pipeBase.Struct(**results.exposures)
711 """Calibrate and add backgrounds to input calExpList in place 713 TODO DM-17062: apply jointcal/meas_mosaic here 717 calExpList : `list` of `lsst.afw.image.Exposure` 718 Sequence of calexps to be modified in place 719 backgroundList : `list` of `lsst.afw.math.backgroundList` 720 Sequence of backgrounds to be added back in if bgSubtracted=False 721 skyCorrList : `list` of `lsst.afw.math.backgroundList` 722 Sequence of background corrections to be subtracted if doApplySkyCorr=True 724 backgroundList = len(calExpList)*[
None]
if backgroundList
is None else backgroundList
725 skyCorrList = len(calExpList)*[
None]
if skyCorrList
is None else skyCorrList
726 for calexp, background, skyCorr
in zip(calExpList, backgroundList, skyCorrList):
727 mi = calexp.maskedImage
728 if not self.config.bgSubtracted:
729 mi += background.getImage()
730 if self.config.doApplySkyCorr:
731 mi -= skyCorr.getImage()
def getCoaddDatasetName(self, warpType="direct")
def getGroupDataRef(butler, datasetType, groupTuple, keys)
Base class for coaddition.
def getOutputDatasetTypes(cls, config)
def prepareCalibratedExposures(self, calExpList, backgroundList=None, skyCorrList=None, kwargs)
def __init__(self, reuse=False, kwargs)
def makeSkyInfo(skyMap, tractId, patchId)
def _prepareEmptyExposure(skyInfo)
Warp and optionally PSF-Match calexps onto an a common projection.
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")
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.
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.
def getWarpTypeList(self)
def groupPatchExposures(patchDataRef, calexpDataRefList, coaddDatasetType="deepCoadd", tempExpDatasetType="deepCoadd_directWarp")
def applySkyCorr(self, dataRef, calexp)