LSST Applications g2079a07aa2+86d27d4dc4,g2305ad1205+a659bff248,g2bbee38e9b+3c60f8fe34,g337abbeb29+3c60f8fe34,g33d1c0ed96+3c60f8fe34,g3502564af9+d77d6d1350,g3a166c0a6a+3c60f8fe34,g487adcacf7+25d9892218,g4be5004598+d77d6d1350,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+4d81263f9a,g5cd07815a0+980d2b1c3b,g607f77f49a+d77d6d1350,g858d7b2824+d77d6d1350,g88963caddf+83e433e629,g99cad8db69+a4d3c48eeb,g9ddcbc5298+9a081db1e4,ga1e77700b3+bcf1af89ad,ga57fefb910+9a39d7b2d7,gae0086650b+585e252eca,gb065fddaf9+4f9fd82a2c,gb0e22166c9+60f28cb32d,gb363559e06+d84b1d3d07,gb3b7280ab2+4563d032e1,gb4b16eec92+babe958938,gba4ed39666+c2a2e4ac27,gbb8dafda3b+ed6854b564,gc120e1dc64+b72d212f87,gc28159a63d+3c60f8fe34,gc3e9b769f7+921dbcd359,gcf0d15dbbd+9a39d7b2d7,gdaeeff99f8+f9a426f77a,gddc38dedce+585e252eca,ge79ae78c31+3c60f8fe34,w.2024.21
LSST Data Management Base Package
Loading...
Searching...
No Matches
skyCorrection.py
Go to the documentation of this file.
1# This file is part of pipe_tasks.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
21
22__all__ = ["SkyCorrectionTask", "SkyCorrectionConfig"]
23
24import warnings
25
26import lsst.afw.image as afwImage
27import lsst.afw.math as afwMath
28import lsst.pipe.base.connectionTypes as cT
29import numpy as np
30from lsst.pex.config import Config, ConfigField, ConfigurableField, Field
31from lsst.pipe.base import PipelineTask, PipelineTaskConfig, PipelineTaskConnections, Struct
33 FocalPlaneBackground,
34 FocalPlaneBackgroundConfig,
35 MaskObjectsTask,
36 SkyMeasurementTask,
37)
38from lsst.pipe.tasks.visualizeVisit import VisualizeMosaicExpConfig, VisualizeMosaicExpTask
39
40
41def _skyFrameLookup(datasetType, registry, quantumDataId, collections):
42 """Lookup function to identify sky frames.
43
44 Parameters
45 ----------
46 datasetType : `lsst.daf.butler.DatasetType`
47 Dataset to lookup.
48 registry : `lsst.daf.butler.Registry`
49 Butler registry to query.
50 quantumDataId : `lsst.daf.butler.DataCoordinate`
51 Data id to transform to find sky frames.
52 The ``detector`` entry will be stripped.
53 collections : `lsst.daf.butler.CollectionSearch`
54 Collections to search through.
55
56 Returns
57 -------
58 results : `list` [`lsst.daf.butler.DatasetRef`]
59 List of datasets that will be used as sky calibration frames.
60 """
61 newDataId = quantumDataId.subset(registry.dimensions.conform(["instrument", "visit"]))
62 skyFrames = []
63 for dataId in registry.queryDataIds(["visit", "detector"], dataId=newDataId).expanded():
64 skyFrame = registry.findDataset(
65 datasetType, dataId, collections=collections, timespan=dataId.timespan
66 )
67 skyFrames.append(skyFrame)
68 return skyFrames
69
70
71def _reorderAndPadList(inputList, inputKeys, outputKeys, padWith=None):
72 """Match the order of one list to another, padding if necessary.
73
74 Parameters
75 ----------
76 inputList : `list`
77 List to be reordered and padded. Elements can be any type.
78 inputKeys : iterable
79 Iterable of values to be compared with outputKeys.
80 Length must match `inputList`.
81 outputKeys : iterable
82 Iterable of values to be compared with inputKeys.
83 padWith :
84 Any value to be inserted where one of inputKeys is not in outputKeys.
85
86 Returns
87 -------
88 outputList : `list`
89 Copy of inputList reordered per outputKeys and padded with `padWith`
90 so that the length matches length of outputKeys.
91 """
92 outputList = []
93 for outputKey in outputKeys:
94 if outputKey in inputKeys:
95 outputList.append(inputList[inputKeys.index(outputKey)])
96 else:
97 outputList.append(padWith)
98 return outputList
99
100
101class SkyCorrectionConnections(PipelineTaskConnections, dimensions=("instrument", "visit")):
102 rawLinker = cT.Input(
103 doc="Raw data to provide exp-visit linkage to connect calExp inputs to camera/sky calibs.",
104 name="raw",
105 multiple=True,
106 deferLoad=True,
107 storageClass="Exposure",
108 dimensions=["instrument", "exposure", "detector"],
109 )
110 calExps = cT.Input(
111 doc="Background-subtracted calibrated exposures.",
112 name="calexp",
113 multiple=True,
114 storageClass="ExposureF",
115 dimensions=["instrument", "visit", "detector"],
116 )
117 calBkgs = cT.Input(
118 doc="Subtracted backgrounds for input calibrated exposures.",
119 multiple=True,
120 name="calexpBackground",
121 storageClass="Background",
122 dimensions=["instrument", "visit", "detector"],
123 )
124 skyFrames = cT.PrerequisiteInput(
125 doc="Calibration sky frames.",
126 name="sky",
127 multiple=True,
128 storageClass="ExposureF",
129 dimensions=["instrument", "physical_filter", "detector"],
130 isCalibration=True,
131 lookupFunction=_skyFrameLookup,
132 )
133 camera = cT.PrerequisiteInput(
134 doc="Input camera.",
135 name="camera",
136 storageClass="Camera",
137 dimensions=["instrument"],
138 isCalibration=True,
139 )
140 skyCorr = cT.Output(
141 doc="Sky correction data, to be subtracted from the calibrated exposures.",
142 name="skyCorr",
143 multiple=True,
144 storageClass="Background",
145 dimensions=["instrument", "visit", "detector"],
146 )
147 calExpMosaic = cT.Output(
148 doc="Full focal plane mosaicked image of the sky corrected calibrated exposures.",
149 name="calexp_skyCorr_visit_mosaic",
150 storageClass="ImageF",
151 dimensions=["instrument", "visit"],
152 )
153 calBkgMosaic = cT.Output(
154 doc="Full focal plane mosaicked image of the sky corrected calibrated exposure backgrounds.",
155 name="calexpBackground_skyCorr_visit_mosaic",
156 storageClass="ImageF",
157 dimensions=["instrument", "visit"],
158 )
159
160 def __init__(self, *, config: "SkyCorrectionConfig | None" = None):
161 super().__init__(config=config)
162 assert config is not None
163 if not config.doSky:
164 del self.skyFrames
165
166
167class SkyCorrectionConfig(PipelineTaskConfig, pipelineConnections=SkyCorrectionConnections):
168 maskObjects = ConfigurableField(
169 target=MaskObjectsTask,
170 doc="Mask Objects",
171 )
172 doMaskObjects = Field(
173 dtype=bool,
174 default=True,
175 doc="Iteratively mask objects to find good sky?",
176 )
177 bgModel1 = ConfigField(
178 dtype=FocalPlaneBackgroundConfig,
179 doc="Initial background model, prior to sky frame subtraction",
180 )
182 target=SkyMeasurementTask,
183 doc="Sky measurement",
184 )
185 doSky = Field(
186 dtype=bool,
187 default=True,
188 doc="Do sky frame subtraction?",
189 )
190 bgModel2 = ConfigField(
191 dtype=FocalPlaneBackgroundConfig,
192 doc="Final (cleanup) background model, after sky frame subtraction",
193 )
194 doBgModel2 = Field(
195 dtype=bool,
196 default=True,
197 doc="Do final (cleanup) background model subtraction, after sky frame subtraction?",
198 )
199 binning = Field(
200 dtype=int,
201 default=8,
202 doc="Binning factor for constructing full focal plane '*_camera' output datasets",
203 )
204
205 def setDefaults(self):
206 Config.setDefaults(self)
207 self.bgModel2.doSmooth = True
208 self.bgModel2.minFrac = 0.5
209 self.bgModel2.xSize = 256
210 self.bgModel2.ySize = 256
211 self.bgModel2.smoothScale = 1.0
212
213
214class SkyCorrectionTask(PipelineTask):
215 """Perform a full focal plane sky correction."""
216
217 ConfigClass = SkyCorrectionConfig
218 _DefaultName = "skyCorr"
219
220 def __init__(self, *args, **kwargs):
221 super().__init__(**kwargs)
222 self.makeSubtask("sky")
223 self.makeSubtask("maskObjects")
224
225 def runQuantum(self, butlerQC, inputRefs, outputRefs):
226 # Sort the calExps, calBkgs and skyFrames inputRefs and the
227 # skyCorr outputRef by detector ID to ensure reproducibility.
228 detectorOrder = [ref.dataId["detector"] for ref in inputRefs.calExps]
229 detectorOrder.sort()
230 inputRefs.calExps = _reorderAndPadList(
231 inputRefs.calExps, [ref.dataId["detector"] for ref in inputRefs.calExps], detectorOrder
232 )
233 inputRefs.calBkgs = _reorderAndPadList(
234 inputRefs.calBkgs, [ref.dataId["detector"] for ref in inputRefs.calBkgs], detectorOrder
235 )
236 # Only attempt to fetch sky frames if they are going to be applied.
237 if self.config.doSky:
238 inputRefs.skyFrames = _reorderAndPadList(
239 inputRefs.skyFrames, [ref.dataId["detector"] for ref in inputRefs.skyFrames], detectorOrder
240 )
241 else:
242 inputRefs.skyFrames = []
243 outputRefs.skyCorr = _reorderAndPadList(
244 outputRefs.skyCorr, [ref.dataId["detector"] for ref in outputRefs.skyCorr], detectorOrder
245 )
246 inputs = butlerQC.get(inputRefs)
247 inputs.pop("rawLinker", None)
248 outputs = self.run(**inputs)
249 butlerQC.put(outputs, outputRefs)
250
251 def run(self, calExps, calBkgs, skyFrames, camera):
252 """Perform sky correction on a visit.
253
254 The original visit-level background is first restored to the calibrated
255 exposure and the existing background model is inverted in-place. If
256 doMaskObjects is True, the mask map associated with this exposure will
257 be iteratively updated (over nIter loops) by re-estimating the
258 background each iteration and redetecting footprints.
259
260 An initial full focal plane sky subtraction (bgModel1) will take place
261 prior to scaling and subtracting the sky frame.
262
263 If doSky is True, the sky frame will be scaled to the flux in the input
264 visit.
265
266 If doBgModel2 is True, a final full focal plane sky subtraction will
267 take place after the sky frame has been subtracted.
268
269 The first N elements of the returned skyCorr will consist of inverted
270 elements of the calexpBackground model (i.e., subtractive). All
271 subsequent elements appended to skyCorr thereafter will be additive
272 such that, when skyCorr is subtracted from a calexp, the net result
273 will be to undo the initial per-detector background solution and then
274 apply the skyCorr model thereafter. Adding skyCorr to a
275 calexpBackground will effectively negate the calexpBackground,
276 returning only the additive background components of the skyCorr
277 background model.
278
279 Parameters
280 ----------
281 calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
282 Detector calibrated exposure images for the visit.
283 calBkgs : `list` [`lsst.afw.math.BackgroundList`]
284 Detector background lists matching the calibrated exposures.
285 skyFrames : `list` [`lsst.afw.image.exposure.ExposureF`]
286 Sky frame calibration data for the input detectors.
287 camera : `lsst.afw.cameraGeom.Camera`
288 Camera matching the input data to process.
289
290 Returns
291 -------
292 results : `Struct` containing:
293 skyCorr : `list` [`lsst.afw.math.BackgroundList`]
294 Detector-level sky correction background lists.
295 calExpMosaic : `lsst.afw.image.exposure.ExposureF`
296 Visit-level mosaic of the sky corrected data, binned.
297 Analogous to `calexp - skyCorr`.
298 calBkgMosaic : `lsst.afw.image.exposure.ExposureF`
299 Visit-level mosaic of the sky correction background, binned.
300 Analogous to `calexpBackground + skyCorr`.
301 """
302 # Restore original backgrounds in-place; optionally refine mask maps
303 numOrigBkgElements = [len(calBkg) for calBkg in calBkgs]
304 _ = self._restoreBackgroundRefineMask(calExps, calBkgs)
305
306 # Bin exposures, generate full-fp bg, map to CCDs and subtract in-place
307 _ = self._subtractVisitBackground(calExps, calBkgs, camera, self.config.bgModel1)
308
309 # Subtract a scaled sky frame from all input exposures
310 if self.config.doSky:
311 self._subtractSkyFrame(calExps, skyFrames, calBkgs)
312
313 # Bin exposures, generate full-fp bg, map to CCDs and subtract in-place
314 if self.config.doBgModel2:
315 _ = self._subtractVisitBackground(calExps, calBkgs, camera, self.config.bgModel2)
316
317 # Make camera-level images of bg subtracted calexps and subtracted bgs
318 calExpIds = [exp.getDetector().getId() for exp in calExps]
319 skyCorrExtras = []
320 for calBkg, num in zip(calBkgs, numOrigBkgElements):
321 skyCorrExtra = calBkg.clone()
322 skyCorrExtra._backgrounds = skyCorrExtra._backgrounds[num:]
323 skyCorrExtras.append(skyCorrExtra)
324 calExpMosaic = self._binAndMosaic(calExps, camera, self.config.binning, ids=calExpIds, refExps=None)
325 calBkgMosaic = self._binAndMosaic(
326 skyCorrExtras, camera, self.config.binning, ids=calExpIds, refExps=calExps
327 )
328
329 return Struct(skyCorr=calBkgs, calExpMosaic=calExpMosaic, calBkgMosaic=calBkgMosaic)
330
331 def _restoreBackgroundRefineMask(self, calExps, calBkgs):
332 """Restore original background to each calexp and invert the related
333 background model; optionally refine the mask plane.
334
335 The original visit-level background is restored to each calibrated
336 exposure and the existing background model is inverted in-place. If
337 doMaskObjects is True, the mask map associated with the exposure will
338 be iteratively updated (over nIter loops) by re-estimating the
339 background each iteration and redetecting footprints.
340
341 The background model modified in-place in this method will comprise the
342 first N elements of the skyCorr dataset type, i.e., these N elements
343 are the inverse of the calexpBackground model. All subsequent elements
344 appended to skyCorr will be additive such that, when skyCorr is
345 subtracted from a calexp, the net result will be to undo the initial
346 per-detector background solution and then apply the skyCorr model
347 thereafter. Adding skyCorr to a calexpBackground will effectively
348 negate the calexpBackground, returning only the additive background
349 components of the skyCorr background model.
350
351 Parameters
352 ----------
353 calExps : `lsst.afw.image.exposure.ExposureF`
354 Detector level calexp images to process.
355 calBkgs : `lsst.afw.math._backgroundList.BackgroundList`
356 Detector level background lists associated with the calexps.
357
358 Returns
359 -------
360 calExps : `lsst.afw.image.exposure.ExposureF`
361 The calexps with the initially subtracted background restored.
362 skyCorrBases : `lsst.afw.math._backgroundList.BackgroundList`
363 The inverted initial background models; the genesis for skyCorrs.
364 """
365 skyCorrBases = []
366 for calExp, calBkg in zip(calExps, calBkgs):
367 image = calExp.getMaskedImage()
368
369 # Invert all elements of the existing bg model; restore in calexp
370 for calBkgElement in calBkg:
371 statsImage = calBkgElement[0].getStatsImage()
372 statsImage *= -1
373 skyCorrBase = calBkg.getImage()
374 image -= skyCorrBase
375
376 # Iteratively subtract bg, re-detect sources, and add bg back on
377 if self.config.doMaskObjects:
378 self.maskObjects.findObjects(calExp)
379
380 stats = np.nanpercentile(skyCorrBase.array, [50, 75, 25])
381 self.log.info(
382 "Detector %d: Initial background restored; BG median = %.1f counts, BG IQR = %.1f counts",
383 calExp.getDetector().getId(),
384 -stats[0],
385 np.subtract(*stats[1:]),
386 )
387 skyCorrBases.append(skyCorrBase)
388 return calExps, skyCorrBases
389
390 def _subtractVisitBackground(self, calExps, calBkgs, camera, config):
391 """Perform a full focal-plane background subtraction for a visit.
392
393 Generate a full focal plane background model, binning all masked
394 detectors into bins of [bgModelN.xSize, bgModelN.ySize]. After,
395 subtract the resultant background model (translated back into CCD
396 coordinates) from the original detector exposure.
397
398 Return a list of background subtracted images and a list of full focal
399 plane background parameters.
400
401 Parameters
402 ----------
403 calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
404 Calibrated exposures to be background subtracted.
405 calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
406 Background lists associated with the input calibrated exposures.
407 camera : `lsst.afw.cameraGeom.Camera`
408 Camera description.
409 config : `lsst.pipe.tasks.background.FocalPlaneBackgroundConfig`
410 Configuration to use for background subtraction.
411
412 Returns
413 -------
414 calExps : `list` [`lsst.afw.image.maskedImage.MaskedImageF`]
415 Background subtracted exposures for creating a focal plane image.
416 calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
417 Updated background lists with a visit-level model appended.
418 """
419 # Set up empty full focal plane background model object
420 bgModelBase = FocalPlaneBackground.fromCamera(config, camera)
421
422 # Loop over each detector, bin into [xSize, ySize] bins, and update
423 # summed flux (_values) and number of contributing pixels (_numbers)
424 # in focal plane coordinates. Append outputs to bgModels.
425 bgModels = []
426 for calExp in calExps:
427 bgModel = bgModelBase.clone()
428 bgModel.addCcd(calExp)
429 bgModels.append(bgModel)
430
431 # Merge detector models to make a single full focal plane bg model
432 for bgModel, calExp in zip(bgModels, calExps):
433 msg = (
434 "Detector %d: Merging %d unmasked pixels (%.1f%s of detector area) into focal plane "
435 "background model"
436 )
437 self.log.debug(
438 msg,
439 calExp.getDetector().getId(),
440 bgModel._numbers.getArray().sum(),
441 100 * bgModel._numbers.getArray().sum() / calExp.getBBox().getArea(),
442 "%",
443 )
444 bgModelBase.merge(bgModel)
445
446 # Map full focal plane bg solution to detector; subtract from exposure
447 calBkgElements = []
448 for calExp in calExps:
449 _, calBkgElement = self._subtractDetectorBackground(calExp, bgModelBase)
450 calBkgElements.append(calBkgElement)
451
452 msg = (
453 "Focal plane background model constructed using %.2f x %.2f mm (%d x %d pixel) superpixels; "
454 "FP BG median = %.1f counts, FP BG IQR = %.1f counts"
455 )
456 with warnings.catch_warnings():
457 warnings.filterwarnings("ignore", r"invalid value encountered")
458 stats = np.nanpercentile(bgModelBase.getStatsImage().array, [50, 75, 25])
459 self.log.info(
460 msg,
461 config.xSize,
462 config.ySize,
463 int(config.xSize / config.pixelSize),
464 int(config.ySize / config.pixelSize),
465 stats[0],
466 np.subtract(*stats[1:]),
467 )
468
469 for calBkg, calBkgElement in zip(calBkgs, calBkgElements):
470 calBkg.append(calBkgElement[0])
471 return calExps, calBkgs
472
473 def _subtractDetectorBackground(self, calExp, bgModel):
474 """Generate CCD background model and subtract from image.
475
476 Translate the full focal plane background into CCD coordinates and
477 subtract from the original science exposure image.
478
479 Parameters
480 ----------
481 calExp : `lsst.afw.image.exposure.ExposureF`
482 Exposure to subtract the background model from.
483 bgModel : `lsst.pipe.tasks.background.FocalPlaneBackground`
484 Full focal plane camera-level background model.
485
486 Returns
487 -------
488 calExp : `lsst.afw.image.exposure.ExposureF`
489 Background subtracted input exposure.
490 calBkgElement : `lsst.afw.math._backgroundList.BackgroundList`
491 Detector level realization of the full focal plane bg model.
492 """
493 image = calExp.getMaskedImage()
494 with warnings.catch_warnings():
495 warnings.filterwarnings("ignore", r"invalid value encountered")
496 calBkgElement = bgModel.toCcdBackground(calExp.getDetector(), image.getBBox())
497 image -= calBkgElement.getImage()
498 return calExp, calBkgElement
499
500 def _subtractSkyFrame(self, calExps, skyFrames, calBkgs):
501 """Determine the full focal plane sky frame scale factor relative to
502 an input list of calibrated exposures and subtract.
503
504 This method measures the sky frame scale on all inputs, resulting in
505 values equal to the background method solveScales(). The sky frame is
506 then subtracted as in subtractSkyFrame() using the appropriate scale.
507
508 Input calExps and calBkgs are updated in-place, returning sky frame
509 subtracted calExps and sky frame updated calBkgs, respectively.
510
511 Parameters
512 ----------
513 calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
514 Calibrated exposures to be background subtracted.
515 skyFrames : `list` [`lsst.afw.image.exposure.ExposureF`]
516 Sky frame calibration data for the input detectors.
517 calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
518 Background lists associated with the input calibrated exposures.
519 """
520 skyFrameBgModels = []
521 scales = []
522 for calExp, skyFrame in zip(calExps, skyFrames):
523 skyFrameBgModel = self.sky.exposureToBackground(skyFrame)
524 skyFrameBgModels.append(skyFrameBgModel)
525 # return a tuple of gridded image and sky frame clipped means
526 samples = self.sky.measureScale(calExp.getMaskedImage(), skyFrameBgModel)
527 scales.append(samples)
528 scale = self.sky.solveScales(scales)
529 for calExp, skyFrameBgModel, calBkg in zip(calExps, skyFrameBgModels, calBkgs):
530 # subtract the scaled sky frame model from each calExp in-place,
531 # also updating the calBkg list in-place
532 self.sky.subtractSkyFrame(calExp.getMaskedImage(), skyFrameBgModel, scale, calBkg)
533 self.log.info("Sky frame subtracted with a scale factor of %.5f", scale)
534
535 def _binAndMosaic(self, exposures, camera, binning, ids=None, refExps=None):
536 """Bin input exposures and mosaic across the entire focal plane.
537
538 Input exposures are binned and then mosaicked at the position of
539 the detector in the focal plane of the camera.
540
541 Parameters
542 ----------
543 exposures : `list`
544 Detector level list of either calexp `ExposureF` types or
545 calexpBackground `BackgroundList` types.
546 camera : `lsst.afw.cameraGeom.Camera`
547 Camera matching the input data to process.
548 binning : `int`
549 Binning size to be applied to input images.
550 ids : `list` [`int`], optional
551 List of detector ids to iterate over.
552 refExps : `list` [`lsst.afw.image.exposure.ExposureF`], optional
553 If supplied, mask planes from these reference images will be used.
554 Returns
555 -------
556 mosaicImage : `lsst.afw.image.exposure.ExposureF`
557 Mosaicked full focal plane image.
558 """
559 refExps = np.resize(refExps, len(exposures)) # type: ignore
560 binnedImages = []
561 for exp, refExp in zip(exposures, refExps):
562 try:
563 nativeImage = exp.getMaskedImage()
564 except AttributeError:
565 nativeImage = afwImage.makeMaskedImage(exp.getImage())
566 if refExp:
567 nativeImage.setMask(refExp.getMask())
568 binnedImage = afwMath.binImage(nativeImage, binning)
569 binnedImages.append(binnedImage)
570 mosConfig = VisualizeMosaicExpConfig()
571 mosConfig.binning = binning
572 mosTask = VisualizeMosaicExpTask(config=mosConfig)
573 imageStruct = mosTask.run(binnedImages, camera, inputIds=ids)
574 mosaicImage = imageStruct.outputData
575 return mosaicImage
__init__(self, *"SkyCorrectionConfig | None" config=None)
_subtractVisitBackground(self, calExps, calBkgs, camera, config)
run(self, calExps, calBkgs, skyFrames, camera)
_subtractSkyFrame(self, calExps, skyFrames, calBkgs)
runQuantum(self, butlerQC, inputRefs, outputRefs)
_binAndMosaic(self, exposures, camera, binning, ids=None, refExps=None)
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > * makeMaskedImage(typename std::shared_ptr< Image< ImagePixelT > > image, typename std::shared_ptr< Mask< MaskPixelT > > mask=Mask< MaskPixelT >(), typename std::shared_ptr< Image< VariancePixelT > > variance=Image< VariancePixelT >())
A function to return a MaskedImage of the correct type (cf.
std::shared_ptr< ImageT > binImage(ImageT const &inImage, int const binX, int const binY, lsst::afw::math::Property const flags=lsst::afw::math::MEAN)
Definition binImage.cc:44
_reorderAndPadList(inputList, inputKeys, outputKeys, padWith=None)
_skyFrameLookup(datasetType, registry, quantumDataId, collections)