lsst.pipe.tasks gd5638573c2+392ae78cd2
Loading...
Searching...
No Matches
lsst.pipe.tasks.peekExposure.PeekExposureTask Class Reference
Inheritance diagram for lsst.pipe.tasks.peekExposure.PeekExposureTask:

Public Member Functions

 __init__ (self, Any config, *, Any display=None, **Any kwargs)
float getDonutDiameter (self, afwImage.Exposure exposure)
pipeBase.Struct run (self, afwImage.Exposure exposure, *, bool doDisplay=False, bool doDisplayIndices=False, str mode="auto", int|None binSize=None, float|None donutDiameter=None)
tuple[str, int, afwTable.SourceCatalog] runPeek (self, afwImage.Exposure exposure, str mode, float donutDiameter, int|None binSize=None)
astropy.table.Table transformTable (self, int binSize, afwTable.SourceCatalog binnedSourceCat)
tuple[int, geom.Point2D, afwGeom.Quadrupole] getBrightest (self, afwTable.SourceCatalog binnedSourceCat, int binSize, npt.NDArray[np.bool_] goodSourceMask)
afwGeom.Quadrupole getPsfShape (self, afwTable.SourceCatalog binnedSourceCat, int binSize, npt.NDArray[np.bool_] goodSourceMask)
tuple[list[afwGeom.Quadrupole], list[afwGeom.Quadrupole]] transformShapes (self, afwGeom.Quadrupole shapes, afwImage.Exposure exposure, int binSize)
None updateDisplay (self, afwImage.Exposure exposure, int binSize, afwTable.SourceCatalog binnedSourceCat, int maxFluxIdx, bool doDisplayIndices)

Static Public Attributes

 ConfigClass = PeekExposureTaskConfig

Protected Member Functions

pipeBase.Struct _run (self, afwImage.Exposure exposure, bool doDisplay, bool doDisplayIndices, str mode, int|None binSize, float|None donutDiameter)

Protected Attributes

 _display = display

Static Protected Attributes

PeekSpecTask _DefaultName = "peekExposureTask"

Detailed Description

Peek at exposure to quickly detect and measure both the brightest
source in the image, and a set of sources representative of the
exposure's overall image quality.

Parameters
----------
config : `lsst.summit.utils.peekExposure.PeekExposureTaskConfig`
    Configuration for the task.
display : `lsst.afw.display.Display`, optional
    For displaying the exposure and sources.

Notes
-----
The basic philosophy of PeekExposureTask is to:
1) Classify exposures based on metadata into 'donut', 'spec', or 'photo'.
2) Run PeekTask on the exposure through a wrapper with class specific
modifications.
3) Try only to branch in the code based on the metadata, and not on the
   data itself.  This avoids problematic discontinuities in measurements.

The main knobs we fiddle with based on the classification are:
    - Detection threshold
    - Minimum number of pixels for a detection
    - Binning of the image
    - Installed PSF size

Member Function Documentation

◆ _run()

pipeBase.Struct lsst.pipe.tasks.peekExposure.PeekExposureTask._run ( self,
afwImage.Exposure exposure,
bool doDisplay,
bool doDisplayIndices,
str mode,
int | None binSize,
float | None donutDiameter )
protected
The actual run method, called by run().

◆ getBrightest()

tuple[int, geom.Point2D, afwGeom.Quadrupole] lsst.pipe.tasks.peekExposure.PeekExposureTask.getBrightest ( self,
afwTable.SourceCatalog binnedSourceCat,
int binSize,
npt.NDArray[np.bool_] goodSourceMask )
Find the brightest source in the catalog.

Parameters
----------
binnedSourceCat : `lsst.afw.table.SourceCatalog`
    Source catalog from the binned exposure.
binSize : `int`
    Binning factor used.
goodSourceMask : `numpy.ndarray`
    Boolean array indicating which sources are good.

Returns
-------
maxFluxIdx : `int`
    Index of the brightest source in the catalog.
brightCentroid : `lsst.geom.Point2D`
    Centroid of the brightest source (unbinned coords).
brightShape : `lsst.afw.geom.Quadrupole`
    Shape of the brightest source (unbinned coords).

◆ getDonutDiameter()

float lsst.pipe.tasks.peekExposure.PeekExposureTask.getDonutDiameter ( self,
afwImage.Exposure exposure )
Estimate donut diameter from exposure metadata.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure to estimate donut diameter for.

Returns
-------
donutDiameter : `float`
    Estimated donut diameter in pixels.

◆ getPsfShape()

afwGeom.Quadrupole lsst.pipe.tasks.peekExposure.PeekExposureTask.getPsfShape ( self,
afwTable.SourceCatalog binnedSourceCat,
int binSize,
npt.NDArray[np.bool_] goodSourceMask )
Estimate the modal PSF shape from the sources.

Parameters
----------
binnedSourceCat : `lsst.afw.table.SourceCatalog`
    Source catalog from the binned exposure.
binSize : `int`
    Binning factor used.
goodSourceMask : `numpy.ndarray`
    Boolean array indicating which sources are good.

Returns
-------
psfShape : `lsst.afw.geom.Quadrupole`
    Estimated PSF shape (unbinned coords).

◆ run()

pipeBase.Struct lsst.pipe.tasks.peekExposure.PeekExposureTask.run ( self,
afwImage.Exposure exposure,
* ,
bool doDisplay = False,
bool doDisplayIndices = False,
str mode = "auto",
int | None binSize = None,
float | None donutDiameter = None )
Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure at which to peek.
doDisplay : `bool`, optional
    Display the exposure and sources?  Default False.  (Requires
    display to have been passed to task constructor)
doDisplayIndices : `bool`, optional
    Display the source indices?  Default False.  (Requires display to
    have been passed to task constructor)
mode : {'auto', 'donut', 'spec', 'photo'}, optional
    Mode to run in.  Default 'auto'.
binSize : `int`, optional
    Binning factor for exposure.  Default is None, which let's subtasks
    control rebinning directly.
donutDiameter : `float`, optional
    Donut diameter in pixels.  Default is None, which will estimate the
    donut diameter from the exposure metadata.

Returns
-------
result : `pipeBase.Struct`
    Result of the peek.
    Struct containing:
        - mode : `str`
            Peek mode that was run.
        - binSize : `int`
            Binning factor used.
        - binnedSourceCat : `lsst.afw.table.SourceCatalog`
            Source catalog from the binned exposure.
        - table : `astropy.table.Table`
            Curated source table in unbinned coordinates.
        - brightestIdx : `int`
            Index of brightest source in source catalog.
        - brightestCentroid : `lsst.geom.Point2D`
            Brightest source centroid in unbinned pixel coords.
        - brightestPixelShape : `lsst.afw.geom.Quadrupole`
            Brightest source shape in unbinned pixel coords.
        - brightestEquatorialShape : `lsst.afw.geom.Quadrupole`
            Brightest source shape in equitorial coordinates (arcsec).
        - brightestAltAzShape : `lsst.afw.geom.Quadrupole`
            Brightest source shape in alt/az coordinates (arcsec).
        - psfPixelShape : `lsst.afw.geom.Quadrupole`
            Estimated PSF shape in unbinned pixel coords.
        - psfEquatorialShape : `lsst.afw.geom.Quadrupole`
            Estimated PSF shape in equitorial coordinates (arcsec).
        - psfAltAzShape : `lsst.afw.geom.Quadrupole`
            Estimated PSF shape in alt/az coordinates (arcsec).
        - pixelMedian : `float`
            Median estimate of entire image.
        - pixelMode : `float`
            Mode estimate of entire image.

◆ runPeek()

tuple[str, int, afwTable.SourceCatalog] lsst.pipe.tasks.peekExposure.PeekExposureTask.runPeek ( self,
afwImage.Exposure exposure,
str mode,
float donutDiameter,
int | None binSize = None )
Classify exposure and run appropriate PeekTask wrapper.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure to peek.
mode : {'auto', 'donut', 'spec', 'photo'}
    Mode to run in.
donutDiameter : `float`
    Donut diameter in pixels.
binSize : `int`, optional
    Binning factor for exposure.  Default is None, which let's subtasks
    control rebinning directly.

Returns
-------
result : `pipeBase.Struct`
    Result of the peek.
    Struct containing:
        - mode : `str`
            Peek mode that was run.
        - binSize : `int`
            Binning factor used.
        - binnedSourceCat : `lsst.afw.table.SourceCatalog`
            Source catalog from the binned exposure.

◆ transformShapes()

tuple[list[afwGeom.Quadrupole], list[afwGeom.Quadrupole]] lsst.pipe.tasks.peekExposure.PeekExposureTask.transformShapes ( self,
afwGeom.Quadrupole shapes,
afwImage.Exposure exposure,
int binSize )
Transform shapes from x/y pixel coordinates to equitorial and
horizon coordinates.

Parameters
----------
shapes : `list` of `lsst.afw.geom.Quadrupole`
    List of shapes (in pixel coordinates) to transform.
exposure : `lsst.afw.image.Exposure`
    Exposure containing WCS and VisitInfo for transformation.
binSize : `int`
    Binning factor used.

Returns
-------
equatorialShapes : `list` of `lsst.afw.geom.Quadrupole`
    List of shapes transformed to equitorial (North and West)
    coordinates.  Units are arcseconds.
altAzShapes : `list` of `lsst.afw.geom.Quadrupole`
    List of shapes transformed to alt/az coordinates.  Units are
    arcseconds.

◆ transformTable()

astropy.table.Table lsst.pipe.tasks.peekExposure.PeekExposureTask.transformTable ( self,
int binSize,
afwTable.SourceCatalog binnedSourceCat )
Make an astropy table from the source catalog but with
transformations back to the original unbinned coordinates.

Since there's some ambiguity in the apFlux apertures when binning,
we'll only populate the table with the slots columns (slot_apFlux
doesn't indicate an aperture radius).  For simplicity, do the same for
centroids and shapes too.

And since we're only copying over the slots_* columns, we remove the
"slots_" part of the column names and lowercase the first remaining
letter.

Parameters
----------
binSize : `int`
    Binning factor used.
binnedSourceCat : `lsst.afw.table.SourceCatalog`
    Source catalog from the binned exposure.

Returns
-------
table : `astropy.table.Table`
    Curated source table in unbinned coordinates.

◆ updateDisplay()

None lsst.pipe.tasks.peekExposure.PeekExposureTask.updateDisplay ( self,
afwImage.Exposure exposure,
int binSize,
afwTable.SourceCatalog binnedSourceCat,
int maxFluxIdx,
bool doDisplayIndices )
Update the afwDisplay with the exposure and sources.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure to peek.
binSize : `int`
    Binning factor used.
binnedSourceCat : `lsst.afw.table.SourceCatalog`
    Source catalog from the binned exposure.
maxFluxIdx : `int`
    Index of the brightest source in the catalog.
doDisplayIndices : `bool`
    Display the source indices?

The documentation for this class was generated from the following file:
  • python/lsst/pipe/tasks/peekExposure.py