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 | List of all members
lsst.pipe.tasks.background.MaskObjectsTask Class Reference
Inheritance diagram for lsst.pipe.tasks.background.MaskObjectsTask:

Public Member Functions

 __init__ (self, *args, **kwargs)
 
 run (self, exposure, maskPlanes=None)
 
 findObjects (self, exposure)
 
 removeObjects (self, exposure, maskPlanes=None)
 

Static Public Attributes

 ConfigClass = MaskObjectsConfig
 

Detailed Description

Iterative masking of objects on an Exposure

This task makes more exhaustive object mask by iteratively doing detection
and background-subtraction. The purpose of this task is to get true
background removing faint tails of large objects. This is useful to get a
clean sky estimate from relatively small number of visits.

We deliberately use the specified ``detectSigma`` instead of the PSF,
in order to better pick up the faint wings of objects.

Definition at line 803 of file background.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.pipe.tasks.background.MaskObjectsTask.__init__ ( self,
* args,
** kwargs )

Definition at line 816 of file background.py.

816 def __init__(self, *args, **kwargs):
817 super().__init__(*args, **kwargs)
818 # Disposable schema suppresses warning from SourceDetectionTask.__init__
819 self.makeSubtask("detection", schema=afwTable.Schema())
820 self.makeSubtask("interpolate")
821 self.makeSubtask("subtractBackground")
822
Defines the fields and offsets for a table.
Definition Schema.h:51

Member Function Documentation

◆ findObjects()

lsst.pipe.tasks.background.MaskObjectsTask.findObjects ( self,
exposure )
Iteratively find objects on an exposure

Objects are masked with the ``DETECTED`` mask plane.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure on which to mask objects.

Definition at line 838 of file background.py.

838 def findObjects(self, exposure):
839 """Iteratively find objects on an exposure
840
841 Objects are masked with the ``DETECTED`` mask plane.
842
843 Parameters
844 ----------
845 exposure : `lsst.afw.image.Exposure`
846 Exposure on which to mask objects.
847 """
848 for _ in range(self.config.nIter):
849 bg = self.subtractBackground.run(exposure).background
850 self.detection.detectFootprints(exposure, sigma=self.config.detectSigma, clearMask=True)
851 exposure.maskedImage += bg.getImage()
852

◆ removeObjects()

lsst.pipe.tasks.background.MaskObjectsTask.removeObjects ( self,
exposure,
maskPlanes = None )
Remove objects from exposure

We interpolate over using a background model if ``doInterpolate`` is
set; otherwise we simply replace everything with the median.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure on which to mask objects.
maskPlanes : iterable of `str`, optional
    List of mask planes to remove. ``DETECTED`` will be added as well.

Definition at line 853 of file background.py.

853 def removeObjects(self, exposure, maskPlanes=None):
854 """Remove objects from exposure
855
856 We interpolate over using a background model if ``doInterpolate`` is
857 set; otherwise we simply replace everything with the median.
858
859 Parameters
860 ----------
861 exposure : `lsst.afw.image.Exposure`
862 Exposure on which to mask objects.
863 maskPlanes : iterable of `str`, optional
864 List of mask planes to remove. ``DETECTED`` will be added as well.
865 """
866 image = exposure.image
867 mask = exposure.mask
868 maskVal = mask.getPlaneBitMask("DETECTED")
869 if maskPlanes is not None:
870 maskVal |= mask.getPlaneBitMask(maskPlanes)
871 isBad = mask.array & maskVal > 0
872
873 if self.config.doInterpolate:
874 smooth = self.interpolate.fitBackground(exposure.maskedImage)
875 replace = smooth.getImageF().array[isBad]
876 mask.array &= ~mask.getPlaneBitMask(["DETECTED"])
877 else:
878 replace = numpy.median(image.array[~isBad])
879 image.array[isBad] = replace
880
881

◆ run()

lsst.pipe.tasks.background.MaskObjectsTask.run ( self,
exposure,
maskPlanes = None )
Mask objects on Exposure

Objects are found and removed.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure on which to mask objects.
maskPlanes : iterable of `str`, optional
    List of mask planes to remove.

Definition at line 823 of file background.py.

823 def run(self, exposure, maskPlanes=None):
824 """Mask objects on Exposure
825
826 Objects are found and removed.
827
828 Parameters
829 ----------
830 exposure : `lsst.afw.image.Exposure`
831 Exposure on which to mask objects.
832 maskPlanes : iterable of `str`, optional
833 List of mask planes to remove.
834 """
835 self.findObjects(exposure)
836 self.removeObjects(exposure, maskPlanes)
837

Member Data Documentation

◆ ConfigClass

lsst.pipe.tasks.background.MaskObjectsTask.ConfigClass = MaskObjectsConfig
static

Definition at line 814 of file background.py.


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