LSST Applications g0265f82a02+d6b5cd48b5,g02d81e74bb+7bcba2e4e8,g2079a07aa2+14824f138e,g212a7c68fe+4b38ad7149,g2305ad1205+906def1e41,g295015adf3+564da5d084,g2bbee38e9b+d6b5cd48b5,g337abbeb29+d6b5cd48b5,g3ddfee87b4+cff7e20090,g487adcacf7+50712f9db4,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+d19d1a10d7,g5a732f18d5+66d966b544,g64a986408d+7bcba2e4e8,g858d7b2824+7bcba2e4e8,g8a8a8dda67+a6fc98d2e7,g99cad8db69+808e2eeadf,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga8c6da7877+9e3c062e8e,gb0e22166c9+3863383f4c,gb6a65358fc+d6b5cd48b5,gb983acf43b+60bb7664b7,gba4ed39666+9664299f35,gbb8dafda3b+6623599aa9,gc07e1c2157+f6e5778202,gc120e1dc64+6e28925a4e,gc28159a63d+d6b5cd48b5,gcf0d15dbbd+cff7e20090,gdaeeff99f8+a38ce5ea23,ge6526c86ff+bcc88f9437,ge79ae78c31+d6b5cd48b5,gee10cc3b42+a6fc98d2e7,gf1cff7945b+7bcba2e4e8,v24.1.5.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Attributes | List of all members
lsst.pipe.tasks.skyCorrection.SkyCorrectionTask Class Reference
Inheritance diagram for lsst.pipe.tasks.skyCorrection.SkyCorrectionTask:

Public Member Functions

 __init__ (self, *args, **kwargs)
 
 runQuantum (self, butlerQC, inputRefs, outputRefs)
 
 run (self, calExps, calBkgs, skyFrames, camera)
 

Static Public Attributes

 ConfigClass = SkyCorrectionConfig
 

Protected Member Functions

 _restoreBackgroundRefineMask (self, calExps, calBkgs)
 
 _subtractVisitBackground (self, calExps, calBkgs, camera, config)
 
 _subtractDetectorBackground (self, calExp, bgModel)
 
 _subtractSkyFrame (self, calExps, skyFrames, calBkgs)
 
 _binAndMosaic (self, exposures, camera, binning, ids=None, refExps=None)
 

Static Protected Attributes

str _DefaultName = "skyCorr"
 

Detailed Description

Perform a full focal plane sky correction.

Definition at line 208 of file skyCorrection.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask.__init__ ( self,
* args,
** kwargs )

Definition at line 214 of file skyCorrection.py.

214 def __init__(self, *args, **kwargs):
215 super().__init__(**kwargs)
216 self.makeSubtask("sky")
217 self.makeSubtask("maskObjects")
218

Member Function Documentation

◆ _binAndMosaic()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._binAndMosaic ( self,
exposures,
camera,
binning,
ids = None,
refExps = None )
protected
Bin input exposures and mosaic across the entire focal plane.

Input exposures are binned and then mosaicked at the position of
the detector in the focal plane of the camera.

Parameters
----------
exposures : `list`
    Detector level list of either calexp `ExposureF` types or
    calexpBackground `BackgroundList` types.
camera : `lsst.afw.cameraGeom.Camera`
    Camera matching the input data to process.
binning : `int`
    Binning size to be applied to input images.
ids : `list` [`int`], optional
    List of detector ids to iterate over.
refExps : `list` [`lsst.afw.image.exposure.ExposureF`], optional
    If supplied, mask planes from these reference images will be used.
Returns
-------
mosaicImage : `lsst.afw.image.exposure.ExposureF`
    Mosaicked full focal plane image.

Definition at line 525 of file skyCorrection.py.

525 def _binAndMosaic(self, exposures, camera, binning, ids=None, refExps=None):
526 """Bin input exposures and mosaic across the entire focal plane.
527
528 Input exposures are binned and then mosaicked at the position of
529 the detector in the focal plane of the camera.
530
531 Parameters
532 ----------
533 exposures : `list`
534 Detector level list of either calexp `ExposureF` types or
535 calexpBackground `BackgroundList` types.
536 camera : `lsst.afw.cameraGeom.Camera`
537 Camera matching the input data to process.
538 binning : `int`
539 Binning size to be applied to input images.
540 ids : `list` [`int`], optional
541 List of detector ids to iterate over.
542 refExps : `list` [`lsst.afw.image.exposure.ExposureF`], optional
543 If supplied, mask planes from these reference images will be used.
544 Returns
545 -------
546 mosaicImage : `lsst.afw.image.exposure.ExposureF`
547 Mosaicked full focal plane image.
548 """
549 refExps = np.resize(refExps, len(exposures)) # type: ignore
550 binnedImages = []
551 for exp, refExp in zip(exposures, refExps):
552 try:
553 nativeImage = exp.getMaskedImage()
554 except AttributeError:
555 nativeImage = afwImage.makeMaskedImage(exp.getImage())
556 if refExp:
557 nativeImage.setMask(refExp.getMask())
558 binnedImage = afwMath.binImage(nativeImage, binning)
559 binnedImages.append(binnedImage)
560 mosConfig = VisualizeMosaicExpConfig()
561 mosConfig.binning = binning
562 mosTask = VisualizeMosaicExpTask(config=mosConfig)
563 imageStruct = mosTask.run(binnedImages, camera, inputIds=ids)
564 mosaicImage = imageStruct.outputData
565 return mosaicImage
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

◆ _restoreBackgroundRefineMask()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._restoreBackgroundRefineMask ( self,
calExps,
calBkgs )
protected
Restore original background to each calexp and invert the related
background model; optionally refine the mask plane.

The original visit-level background is restored to each calibrated
exposure and the existing background model is inverted in-place. If
doMaskObjects is True, the mask map associated with the exposure will
be iteratively updated (over nIter loops) by re-estimating the
background each iteration and redetecting footprints.

The background model modified in-place in this method will comprise the
first N elements of the skyCorr dataset type, i.e., these N elements
are the inverse of the calexpBackground model. All subsequent elements
appended to skyCorr will be additive such that, when skyCorr is
subtracted from a calexp, the net result will be to undo the initial
per-detector background solution and then apply the skyCorr model
thereafter. Adding skyCorr to a calexpBackground will effectively
negate the calexpBackground, returning only the additive background
components of the skyCorr background model.

Parameters
----------
calExps : `lsst.afw.image.exposure.ExposureF`
    Detector level calexp images to process.
calBkgs : `lsst.afw.math._backgroundList.BackgroundList`
    Detector level background lists associated with the calexps.

Returns
-------
calExps : `lsst.afw.image.exposure.ExposureF`
    The calexps with the initially subtracted background restored.
skyCorrBases : `lsst.afw.math._backgroundList.BackgroundList`
    The inverted initial background models; the genesis for skyCorrs.

Definition at line 321 of file skyCorrection.py.

321 def _restoreBackgroundRefineMask(self, calExps, calBkgs):
322 """Restore original background to each calexp and invert the related
323 background model; optionally refine the mask plane.
324
325 The original visit-level background is restored to each calibrated
326 exposure and the existing background model is inverted in-place. If
327 doMaskObjects is True, the mask map associated with the exposure will
328 be iteratively updated (over nIter loops) by re-estimating the
329 background each iteration and redetecting footprints.
330
331 The background model modified in-place in this method will comprise the
332 first N elements of the skyCorr dataset type, i.e., these N elements
333 are the inverse of the calexpBackground model. All subsequent elements
334 appended to skyCorr will be additive such that, when skyCorr is
335 subtracted from a calexp, the net result will be to undo the initial
336 per-detector background solution and then apply the skyCorr model
337 thereafter. Adding skyCorr to a calexpBackground will effectively
338 negate the calexpBackground, returning only the additive background
339 components of the skyCorr background model.
340
341 Parameters
342 ----------
343 calExps : `lsst.afw.image.exposure.ExposureF`
344 Detector level calexp images to process.
345 calBkgs : `lsst.afw.math._backgroundList.BackgroundList`
346 Detector level background lists associated with the calexps.
347
348 Returns
349 -------
350 calExps : `lsst.afw.image.exposure.ExposureF`
351 The calexps with the initially subtracted background restored.
352 skyCorrBases : `lsst.afw.math._backgroundList.BackgroundList`
353 The inverted initial background models; the genesis for skyCorrs.
354 """
355 skyCorrBases = []
356 for calExp, calBkg in zip(calExps, calBkgs):
357 image = calExp.getMaskedImage()
358
359 # Invert all elements of the existing bg model; restore in calexp
360 for calBkgElement in calBkg:
361 statsImage = calBkgElement[0].getStatsImage()
362 statsImage *= -1
363 skyCorrBase = calBkg.getImage()
364 image -= skyCorrBase
365
366 # Iteratively subtract bg, re-detect sources, and add bg back on
367 if self.config.doMaskObjects:
368 self.maskObjects.findObjects(calExp)
369
370 stats = np.nanpercentile(skyCorrBase.array, [50, 75, 25])
371 self.log.info(
372 "Detector %d: Initial background restored; BG median = %.1f counts, BG IQR = %.1f counts",
373 calExp.getDetector().getId(),
374 -stats[0],
375 np.subtract(*stats[1:]),
376 )
377 skyCorrBases.append(skyCorrBase)
378 return calExps, skyCorrBases
379

◆ _subtractDetectorBackground()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._subtractDetectorBackground ( self,
calExp,
bgModel )
protected
Generate CCD background model and subtract from image.

Translate the full focal plane background into CCD coordinates and
subtract from the original science exposure image.

Parameters
----------
calExp : `lsst.afw.image.exposure.ExposureF`
    Exposure to subtract the background model from.
bgModel : `lsst.pipe.tasks.background.FocalPlaneBackground`
    Full focal plane camera-level background model.

Returns
-------
calExp : `lsst.afw.image.exposure.ExposureF`
    Background subtracted input exposure.
calBkgElement : `lsst.afw.math._backgroundList.BackgroundList`
    Detector level realization of the full focal plane bg model.

Definition at line 463 of file skyCorrection.py.

463 def _subtractDetectorBackground(self, calExp, bgModel):
464 """Generate CCD background model and subtract from image.
465
466 Translate the full focal plane background into CCD coordinates and
467 subtract from the original science exposure image.
468
469 Parameters
470 ----------
471 calExp : `lsst.afw.image.exposure.ExposureF`
472 Exposure to subtract the background model from.
473 bgModel : `lsst.pipe.tasks.background.FocalPlaneBackground`
474 Full focal plane camera-level background model.
475
476 Returns
477 -------
478 calExp : `lsst.afw.image.exposure.ExposureF`
479 Background subtracted input exposure.
480 calBkgElement : `lsst.afw.math._backgroundList.BackgroundList`
481 Detector level realization of the full focal plane bg model.
482 """
483 image = calExp.getMaskedImage()
484 with warnings.catch_warnings():
485 warnings.filterwarnings("ignore", r"invalid value encountered")
486 calBkgElement = bgModel.toCcdBackground(calExp.getDetector(), image.getBBox())
487 image -= calBkgElement.getImage()
488 return calExp, calBkgElement
489

◆ _subtractSkyFrame()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._subtractSkyFrame ( self,
calExps,
skyFrames,
calBkgs )
protected
Determine the full focal plane sky frame scale factor relative to
an input list of calibrated exposures and subtract.

This method measures the sky frame scale on all inputs, resulting in
values equal to the background method solveScales(). The sky frame is
then subtracted as in subtractSkyFrame() using the appropriate scale.

Input calExps and calBkgs are updated in-place, returning sky frame
subtracted calExps and sky frame updated calBkgs, respectively.

Parameters
----------
calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
    Calibrated exposures to be background subtracted.
skyFrames : `list` [`lsst.afw.image.exposure.ExposureF`]
    Sky frame calibration data for the input detectors.
calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
    Background lists associated with the input calibrated exposures.

Definition at line 490 of file skyCorrection.py.

490 def _subtractSkyFrame(self, calExps, skyFrames, calBkgs):
491 """Determine the full focal plane sky frame scale factor relative to
492 an input list of calibrated exposures and subtract.
493
494 This method measures the sky frame scale on all inputs, resulting in
495 values equal to the background method solveScales(). The sky frame is
496 then subtracted as in subtractSkyFrame() using the appropriate scale.
497
498 Input calExps and calBkgs are updated in-place, returning sky frame
499 subtracted calExps and sky frame updated calBkgs, respectively.
500
501 Parameters
502 ----------
503 calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
504 Calibrated exposures to be background subtracted.
505 skyFrames : `list` [`lsst.afw.image.exposure.ExposureF`]
506 Sky frame calibration data for the input detectors.
507 calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
508 Background lists associated with the input calibrated exposures.
509 """
510 skyFrameBgModels = []
511 scales = []
512 for calExp, skyFrame in zip(calExps, skyFrames):
513 skyFrameBgModel = self.sky.exposureToBackground(skyFrame)
514 skyFrameBgModels.append(skyFrameBgModel)
515 # return a tuple of gridded image and sky frame clipped means
516 samples = self.sky.measureScale(calExp.getMaskedImage(), skyFrameBgModel)
517 scales.append(samples)
518 scale = self.sky.solveScales(scales)
519 for calExp, skyFrameBgModel, calBkg in zip(calExps, skyFrameBgModels, calBkgs):
520 # subtract the scaled sky frame model from each calExp in-place,
521 # also updating the calBkg list in-place
522 self.sky.subtractSkyFrame(calExp.getMaskedImage(), skyFrameBgModel, scale, calBkg)
523 self.log.info("Sky frame subtracted with a scale factor of %.5f", scale)
524

◆ _subtractVisitBackground()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._subtractVisitBackground ( self,
calExps,
calBkgs,
camera,
config )
protected
Perform a full focal-plane background subtraction for a visit.

Generate a full focal plane background model, binning all masked
detectors into bins of [bgModelN.xSize, bgModelN.ySize]. After,
subtract the resultant background model (translated back into CCD
coordinates) from the original detector exposure.

Return a list of background subtracted images and a list of full focal
plane background parameters.

Parameters
----------
calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
    Calibrated exposures to be background subtracted.
calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
    Background lists associated with the input calibrated exposures.
camera : `lsst.afw.cameraGeom.Camera`
    Camera description.
config : `lsst.pipe.tasks.background.FocalPlaneBackgroundConfig`
    Configuration to use for background subtraction.

Returns
-------
calExps : `list` [`lsst.afw.image.maskedImage.MaskedImageF`]
    Background subtracted exposures for creating a focal plane image.
calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
    Updated background lists with a visit-level model appended.

Definition at line 380 of file skyCorrection.py.

380 def _subtractVisitBackground(self, calExps, calBkgs, camera, config):
381 """Perform a full focal-plane background subtraction for a visit.
382
383 Generate a full focal plane background model, binning all masked
384 detectors into bins of [bgModelN.xSize, bgModelN.ySize]. After,
385 subtract the resultant background model (translated back into CCD
386 coordinates) from the original detector exposure.
387
388 Return a list of background subtracted images and a list of full focal
389 plane background parameters.
390
391 Parameters
392 ----------
393 calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
394 Calibrated exposures to be background subtracted.
395 calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
396 Background lists associated with the input calibrated exposures.
397 camera : `lsst.afw.cameraGeom.Camera`
398 Camera description.
399 config : `lsst.pipe.tasks.background.FocalPlaneBackgroundConfig`
400 Configuration to use for background subtraction.
401
402 Returns
403 -------
404 calExps : `list` [`lsst.afw.image.maskedImage.MaskedImageF`]
405 Background subtracted exposures for creating a focal plane image.
406 calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
407 Updated background lists with a visit-level model appended.
408 """
409 # Set up empty full focal plane background model object
410 bgModelBase = FocalPlaneBackground.fromCamera(config, camera)
411
412 # Loop over each detector, bin into [xSize, ySize] bins, and update
413 # summed flux (_values) and number of contributing pixels (_numbers)
414 # in focal plane coordinates. Append outputs to bgModels.
415 bgModels = []
416 for calExp in calExps:
417 bgModel = bgModelBase.clone()
418 bgModel.addCcd(calExp)
419 bgModels.append(bgModel)
420
421 # Merge detector models to make a single full focal plane bg model
422 for bgModel, calExp in zip(bgModels, calExps):
423 msg = (
424 "Detector %d: Merging %d unmasked pixels (%.1f%s of detector area) into focal plane "
425 "background model"
426 )
427 self.log.debug(
428 msg,
429 calExp.getDetector().getId(),
430 bgModel._numbers.getArray().sum(),
431 100 * bgModel._numbers.getArray().sum() / calExp.getBBox().getArea(),
432 "%",
433 )
434 bgModelBase.merge(bgModel)
435
436 # Map full focal plane bg solution to detector; subtract from exposure
437 calBkgElements = []
438 for calExp in calExps:
439 _, calBkgElement = self._subtractDetectorBackground(calExp, bgModelBase)
440 calBkgElements.append(calBkgElement)
441
442 msg = (
443 "Focal plane background model constructed using %.2f x %.2f mm (%d x %d pixel) superpixels; "
444 "FP BG median = %.1f counts, FP BG IQR = %.1f counts"
445 )
446 with warnings.catch_warnings():
447 warnings.filterwarnings("ignore", r"invalid value encountered")
448 stats = np.nanpercentile(bgModelBase.getStatsImage().array, [50, 75, 25])
449 self.log.info(
450 msg,
451 config.xSize,
452 config.ySize,
453 int(config.xSize / config.pixelSize),
454 int(config.ySize / config.pixelSize),
455 stats[0],
456 np.subtract(*stats[1:]),
457 )
458
459 for calBkg, calBkgElement in zip(calBkgs, calBkgElements):
460 calBkg.append(calBkgElement[0])
461 return calExps, calBkgs
462

◆ run()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask.run ( self,
calExps,
calBkgs,
skyFrames,
camera )
Perform sky correction on a visit.

The original visit-level background is first restored to the calibrated
exposure and the existing background model is inverted in-place. If
doMaskObjects is True, the mask map associated with this exposure will
be iteratively updated (over nIter loops) by re-estimating the
background each iteration and redetecting footprints.

An initial full focal plane sky subtraction (bgModel1) will take place
prior to scaling and subtracting the sky frame.

If doSky is True, the sky frame will be scaled to the flux in the input
visit.

If doBgModel2 is True, a final full focal plane sky subtraction will
take place after the sky frame has been subtracted.

The first N elements of the returned skyCorr will consist of inverted
elements of the calexpBackground model (i.e., subtractive). All
subsequent elements appended to skyCorr thereafter will be additive
such that, when skyCorr is subtracted from a calexp, the net result
will be to undo the initial per-detector background solution and then
apply the skyCorr model thereafter. Adding skyCorr to a
calexpBackground will effectively negate the calexpBackground,
returning only the additive background components of the skyCorr
background model.

Parameters
----------
calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
    Detector calibrated exposure images for the visit.
calBkgs : `list` [`lsst.afw.math.BackgroundList`]
    Detector background lists matching the calibrated exposures.
skyFrames : `list` [`lsst.afw.image.exposure.ExposureF`]
    Sky frame calibration data for the input detectors.
camera : `lsst.afw.cameraGeom.Camera`
    Camera matching the input data to process.

Returns
-------
results : `Struct` containing:
    skyCorr : `list` [`lsst.afw.math.BackgroundList`]
        Detector-level sky correction background lists.
    calExpMosaic : `lsst.afw.image.exposure.ExposureF`
        Visit-level mosaic of the sky corrected data, binned.
        Analogous to `calexp - skyCorr`.
    calBkgMosaic : `lsst.afw.image.exposure.ExposureF`
        Visit-level mosaic of the sky correction background, binned.
        Analogous to `calexpBackground + skyCorr`.

Definition at line 241 of file skyCorrection.py.

241 def run(self, calExps, calBkgs, skyFrames, camera):
242 """Perform sky correction on a visit.
243
244 The original visit-level background is first restored to the calibrated
245 exposure and the existing background model is inverted in-place. If
246 doMaskObjects is True, the mask map associated with this exposure will
247 be iteratively updated (over nIter loops) by re-estimating the
248 background each iteration and redetecting footprints.
249
250 An initial full focal plane sky subtraction (bgModel1) will take place
251 prior to scaling and subtracting the sky frame.
252
253 If doSky is True, the sky frame will be scaled to the flux in the input
254 visit.
255
256 If doBgModel2 is True, a final full focal plane sky subtraction will
257 take place after the sky frame has been subtracted.
258
259 The first N elements of the returned skyCorr will consist of inverted
260 elements of the calexpBackground model (i.e., subtractive). All
261 subsequent elements appended to skyCorr thereafter will be additive
262 such that, when skyCorr is subtracted from a calexp, the net result
263 will be to undo the initial per-detector background solution and then
264 apply the skyCorr model thereafter. Adding skyCorr to a
265 calexpBackground will effectively negate the calexpBackground,
266 returning only the additive background components of the skyCorr
267 background model.
268
269 Parameters
270 ----------
271 calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
272 Detector calibrated exposure images for the visit.
273 calBkgs : `list` [`lsst.afw.math.BackgroundList`]
274 Detector background lists matching the calibrated exposures.
275 skyFrames : `list` [`lsst.afw.image.exposure.ExposureF`]
276 Sky frame calibration data for the input detectors.
277 camera : `lsst.afw.cameraGeom.Camera`
278 Camera matching the input data to process.
279
280 Returns
281 -------
282 results : `Struct` containing:
283 skyCorr : `list` [`lsst.afw.math.BackgroundList`]
284 Detector-level sky correction background lists.
285 calExpMosaic : `lsst.afw.image.exposure.ExposureF`
286 Visit-level mosaic of the sky corrected data, binned.
287 Analogous to `calexp - skyCorr`.
288 calBkgMosaic : `lsst.afw.image.exposure.ExposureF`
289 Visit-level mosaic of the sky correction background, binned.
290 Analogous to `calexpBackground + skyCorr`.
291 """
292 # Restore original backgrounds in-place; optionally refine mask maps
293 numOrigBkgElements = [len(calBkg) for calBkg in calBkgs]
294 _ = self._restoreBackgroundRefineMask(calExps, calBkgs)
295
296 # Bin exposures, generate full-fp bg, map to CCDs and subtract in-place
297 _ = self._subtractVisitBackground(calExps, calBkgs, camera, self.config.bgModel1)
298
299 # Subtract a scaled sky frame from all input exposures
300 if self.config.doSky:
301 self._subtractSkyFrame(calExps, skyFrames, calBkgs)
302
303 # Bin exposures, generate full-fp bg, map to CCDs and subtract in-place
304 if self.config.doBgModel2:
305 _ = self._subtractVisitBackground(calExps, calBkgs, camera, self.config.bgModel2)
306
307 # Make camera-level images of bg subtracted calexps and subtracted bgs
308 calExpIds = [exp.getDetector().getId() for exp in calExps]
309 skyCorrExtras = []
310 for calBkg, num in zip(calBkgs, numOrigBkgElements):
311 skyCorrExtra = calBkg.clone()
312 skyCorrExtra._backgrounds = skyCorrExtra._backgrounds[num:]
313 skyCorrExtras.append(skyCorrExtra)
314 calExpMosaic = self._binAndMosaic(calExps, camera, self.config.binning, ids=calExpIds, refExps=None)
315 calBkgMosaic = self._binAndMosaic(
316 skyCorrExtras, camera, self.config.binning, ids=calExpIds, refExps=calExps
317 )
318
319 return Struct(skyCorr=calBkgs, calExpMosaic=calExpMosaic, calBkgMosaic=calBkgMosaic)
320

◆ runQuantum()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask.runQuantum ( self,
butlerQC,
inputRefs,
outputRefs )

Definition at line 219 of file skyCorrection.py.

219 def runQuantum(self, butlerQC, inputRefs, outputRefs):
220 # Sort the calExps, calBkgs and skyFrames inputRefs and the
221 # skyCorr outputRef by detector ID to ensure reproducibility.
222 detectorOrder = [ref.dataId["detector"] for ref in inputRefs.calExps]
223 detectorOrder.sort()
224 inputRefs.calExps = _reorderAndPadList(
225 inputRefs.calExps, [ref.dataId["detector"] for ref in inputRefs.calExps], detectorOrder
226 )
227 inputRefs.calBkgs = _reorderAndPadList(
228 inputRefs.calBkgs, [ref.dataId["detector"] for ref in inputRefs.calBkgs], detectorOrder
229 )
230 inputRefs.skyFrames = _reorderAndPadList(
231 inputRefs.skyFrames, [ref.dataId["detector"] for ref in inputRefs.skyFrames], detectorOrder
232 )
233 outputRefs.skyCorr = _reorderAndPadList(
234 outputRefs.skyCorr, [ref.dataId["detector"] for ref in outputRefs.skyCorr], detectorOrder
235 )
236 inputs = butlerQC.get(inputRefs)
237 inputs.pop("rawLinker", None)
238 outputs = self.run(**inputs)
239 butlerQC.put(outputs, outputRefs)
240

Member Data Documentation

◆ _DefaultName

str lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._DefaultName = "skyCorr"
staticprotected

Definition at line 212 of file skyCorrection.py.

◆ ConfigClass

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask.ConfigClass = SkyCorrectionConfig
static

Definition at line 211 of file skyCorrection.py.


The documentation for this class was generated from the following file: