LSST Applications g0265f82a02+093ff98f47,g02d81e74bb+10352d6f39,g1f3e9fa97e+40b0fc677d,g2079a07aa2+14824f138e,g2bbee38e9b+093ff98f47,g337abbeb29+093ff98f47,g3ddfee87b4+064c02c7ee,g487adcacf7+7e842ebf4b,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g568d43a26c+1d7ac31cb0,g591dd9f2cf+fb1f69e2ea,g858d7b2824+10352d6f39,g8a8a8dda67+a6fc98d2e7,g8cdfe0ae6a+66d966b544,g99cad8db69+7ce8a7c20a,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga2e4dd1c03+064c02c7ee,ga8c6da7877+04f6ba86dc,gae46bcf261+093ff98f47,gb0e22166c9+3863383f4c,gba4ed39666+9664299f35,gbb8dafda3b+db40f59a7d,gbeb006f7da+e6a448e96d,gbf5cecdb8a+10352d6f39,gc0f3af6251+10a3fd39cd,gc120e1dc64+5839e50a77,gc28159a63d+093ff98f47,gcf0d15dbbd+064c02c7ee,gd2a12a3803+0c2c227a2b,gdaeeff99f8+a38ce5ea23,ge79ae78c31+093ff98f47,gee10cc3b42+a6fc98d2e7,gf1cff7945b+10352d6f39,w.2024.15
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 233 of file skyCorrection.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 239 of file skyCorrection.py.

239 def __init__(self, *args, **kwargs):
240 super().__init__(**kwargs)
241 self.makeSubtask("sky")
242 self.makeSubtask("maskObjects")
243

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 551 of file skyCorrection.py.

551 def _binAndMosaic(self, exposures, camera, binning, ids=None, refExps=None):
552 """Bin input exposures and mosaic across the entire focal plane.
553
554 Input exposures are binned and then mosaicked at the position of
555 the detector in the focal plane of the camera.
556
557 Parameters
558 ----------
559 exposures : `list`
560 Detector level list of either calexp `ExposureF` types or
561 calexpBackground `BackgroundList` types.
562 camera : `lsst.afw.cameraGeom.Camera`
563 Camera matching the input data to process.
564 binning : `int`
565 Binning size to be applied to input images.
566 ids : `list` [`int`], optional
567 List of detector ids to iterate over.
568 refExps : `list` [`lsst.afw.image.exposure.ExposureF`], optional
569 If supplied, mask planes from these reference images will be used.
570 Returns
571 -------
572 mosaicImage : `lsst.afw.image.exposure.ExposureF`
573 Mosaicked full focal plane image.
574 """
575 refExps = np.resize(refExps, len(exposures)) # type: ignore
576 binnedImages = []
577 for exp, refExp in zip(exposures, refExps):
578 try:
579 nativeImage = exp.getMaskedImage()
580 except AttributeError:
581 nativeImage = afwImage.makeMaskedImage(exp.getImage())
582 if refExp:
583 nativeImage.setMask(refExp.getMask())
584 binnedImage = afwMath.binImage(nativeImage, binning)
585 binnedImages.append(binnedImage)
586 mosConfig = VisualizeMosaicExpConfig()
587 mosConfig.binning = binning
588 mosTask = VisualizeMosaicExpTask(config=mosConfig)
589 imageStruct = mosTask.run(binnedImages, camera, inputIds=ids)
590 mosaicImage = imageStruct.outputData
591 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 347 of file skyCorrection.py.

347 def _restoreBackgroundRefineMask(self, calExps, calBkgs):
348 """Restore original background to each calexp and invert the related
349 background model; optionally refine the mask plane.
350
351 The original visit-level background is restored to each calibrated
352 exposure and the existing background model is inverted in-place. If
353 doMaskObjects is True, the mask map associated with the exposure will
354 be iteratively updated (over nIter loops) by re-estimating the
355 background each iteration and redetecting footprints.
356
357 The background model modified in-place in this method will comprise the
358 first N elements of the skyCorr dataset type, i.e., these N elements
359 are the inverse of the calexpBackground model. All subsequent elements
360 appended to skyCorr will be additive such that, when skyCorr is
361 subtracted from a calexp, the net result will be to undo the initial
362 per-detector background solution and then apply the skyCorr model
363 thereafter. Adding skyCorr to a calexpBackground will effectively
364 negate the calexpBackground, returning only the additive background
365 components of the skyCorr background model.
366
367 Parameters
368 ----------
369 calExps : `lsst.afw.image.exposure.ExposureF`
370 Detector level calexp images to process.
371 calBkgs : `lsst.afw.math._backgroundList.BackgroundList`
372 Detector level background lists associated with the calexps.
373
374 Returns
375 -------
376 calExps : `lsst.afw.image.exposure.ExposureF`
377 The calexps with the initially subtracted background restored.
378 skyCorrBases : `lsst.afw.math._backgroundList.BackgroundList`
379 The inverted initial background models; the genesis for skyCorrs.
380 """
381 skyCorrBases = []
382 for calExp, calBkg in zip(calExps, calBkgs):
383 image = calExp.getMaskedImage()
384
385 # Invert all elements of the existing bg model; restore in calexp
386 for calBkgElement in calBkg:
387 statsImage = calBkgElement[0].getStatsImage()
388 statsImage *= -1
389 skyCorrBase = calBkg.getImage()
390 image -= skyCorrBase
391
392 # Iteratively subtract bg, re-detect sources, and add bg back on
393 if self.config.doMaskObjects:
394 self.maskObjects.findObjects(calExp)
395
396 stats = np.nanpercentile(skyCorrBase.array, [50, 75, 25])
397 self.log.info(
398 "Detector %d: Initial background restored; BG median = %.1f counts, BG IQR = %.1f counts",
399 calExp.getDetector().getId(),
400 -stats[0],
401 np.subtract(*stats[1:]),
402 )
403 skyCorrBases.append(skyCorrBase)
404 return calExps, skyCorrBases
405

◆ _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 489 of file skyCorrection.py.

489 def _subtractDetectorBackground(self, calExp, bgModel):
490 """Generate CCD background model and subtract from image.
491
492 Translate the full focal plane background into CCD coordinates and
493 subtract from the original science exposure image.
494
495 Parameters
496 ----------
497 calExp : `lsst.afw.image.exposure.ExposureF`
498 Exposure to subtract the background model from.
499 bgModel : `lsst.pipe.tasks.background.FocalPlaneBackground`
500 Full focal plane camera-level background model.
501
502 Returns
503 -------
504 calExp : `lsst.afw.image.exposure.ExposureF`
505 Background subtracted input exposure.
506 calBkgElement : `lsst.afw.math._backgroundList.BackgroundList`
507 Detector level realization of the full focal plane bg model.
508 """
509 image = calExp.getMaskedImage()
510 with warnings.catch_warnings():
511 warnings.filterwarnings("ignore", r"invalid value encountered")
512 calBkgElement = bgModel.toCcdBackground(calExp.getDetector(), image.getBBox())
513 image -= calBkgElement.getImage()
514 return calExp, calBkgElement
515

◆ _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 516 of file skyCorrection.py.

516 def _subtractSkyFrame(self, calExps, skyFrames, calBkgs):
517 """Determine the full focal plane sky frame scale factor relative to
518 an input list of calibrated exposures and subtract.
519
520 This method measures the sky frame scale on all inputs, resulting in
521 values equal to the background method solveScales(). The sky frame is
522 then subtracted as in subtractSkyFrame() using the appropriate scale.
523
524 Input calExps and calBkgs are updated in-place, returning sky frame
525 subtracted calExps and sky frame updated calBkgs, respectively.
526
527 Parameters
528 ----------
529 calExps : `list` [`lsst.afw.image.exposure.ExposureF`]
530 Calibrated exposures to be background subtracted.
531 skyFrames : `list` [`lsst.afw.image.exposure.ExposureF`]
532 Sky frame calibration data for the input detectors.
533 calBkgs : `list` [`lsst.afw.math._backgroundList.BackgroundList`]
534 Background lists associated with the input calibrated exposures.
535 """
536 skyFrameBgModels = []
537 scales = []
538 for calExp, skyFrame in zip(calExps, skyFrames):
539 skyFrameBgModel = self.sky.exposureToBackground(skyFrame)
540 skyFrameBgModels.append(skyFrameBgModel)
541 # return a tuple of gridded image and sky frame clipped means
542 samples = self.sky.measureScale(calExp.getMaskedImage(), skyFrameBgModel)
543 scales.append(samples)
544 scale = self.sky.solveScales(scales)
545 for calExp, skyFrameBgModel, calBkg in zip(calExps, skyFrameBgModels, calBkgs):
546 # subtract the scaled sky frame model from each calExp in-place,
547 # also updating the calBkg list in-place
548 self.sky.subtractSkyFrame(calExp.getMaskedImage(), skyFrameBgModel, scale, calBkg)
549 self.log.info("Sky frame subtracted with a scale factor of %.5f", scale)
550

◆ _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 406 of file skyCorrection.py.

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

◆ 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.

If doBgModel1 is True, an initial full focal plane sky subtraction 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 266 of file skyCorrection.py.

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

◆ runQuantum()

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

Definition at line 244 of file skyCorrection.py.

244 def runQuantum(self, butlerQC, inputRefs, outputRefs):
245 # Sort the calExps, calBkgs and skyFrames inputRefs and the
246 # skyCorr outputRef by detector ID to ensure reproducibility.
247 detectorOrder = [ref.dataId["detector"] for ref in inputRefs.calExps]
248 detectorOrder.sort()
249 inputRefs.calExps = _reorderAndPadList(
250 inputRefs.calExps, [ref.dataId["detector"] for ref in inputRefs.calExps], detectorOrder
251 )
252 inputRefs.calBkgs = _reorderAndPadList(
253 inputRefs.calBkgs, [ref.dataId["detector"] for ref in inputRefs.calBkgs], detectorOrder
254 )
255 inputRefs.skyFrames = _reorderAndPadList(
256 inputRefs.skyFrames, [ref.dataId["detector"] for ref in inputRefs.skyFrames], detectorOrder
257 )
258 outputRefs.skyCorr = _reorderAndPadList(
259 outputRefs.skyCorr, [ref.dataId["detector"] for ref in outputRefs.skyCorr], detectorOrder
260 )
261 inputs = butlerQC.get(inputRefs)
262 inputs.pop("rawLinker", None)
263 outputs = self.run(**inputs)
264 butlerQC.put(outputs, outputRefs)
265

Member Data Documentation

◆ _DefaultName

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

Definition at line 237 of file skyCorrection.py.

◆ ConfigClass

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

Definition at line 236 of file skyCorrection.py.


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