lsst.pipe.tasks g2c8cee2ce7+721f9a9580
Loading...
Searching...
No Matches
lsst.pipe.tasks.selectImages Namespace Reference

Classes

class  DatabaseSelectImagesConfig
class  BaseExposureInfo
class  BaseSelectImagesTask
class  SelectStruct
class  WcsSelectImagesConfig
class  WcsSelectImagesTask
class  PsfWcsSelectImagesConnections
class  PsfWcsSelectImagesTask
class  BestSeeingSelectVisitsConnections

Functions

 _meetsVisitSummaryMinValues (visit, visitSummary, visitSummaryMinValues, logger=None)
 _extractKeyValue (dataList, keys=None)
 validate (self)

Variables

 maxStarEPerBand
 maxStarUnNormalizedEPerBand
 excludeDetectors
 skyMap : `lsst.afw.table.ExposureCatalog`
 dataId : `dict` of dataId keys
 result : `lsst.sphgeom.ConvexPolygon.convexHull`
 minNPsfStarPerBand

Function Documentation

◆ _extractKeyValue()

_extractKeyValue ( dataList,
keys = None )
protected
Extract the keys and values from a list of dataIds.

The input dataList is a list of objects that have 'dataId' members.
This allows it to be used for both a list of data references and a
list of ExposureInfo.

Parameters
----------
dataList : `Unknown`
keys : `Unknown`

Returns
-------
keys : `Unknown`
values : `Unknown`

Raises
------
RuntimeError
    Raised if DataId keys are inconsistent.

Definition at line 142 of file selectImages.py.

◆ _meetsVisitSummaryMinValues()

_meetsVisitSummaryMinValues ( visit,
visitSummary,
visitSummaryMinValues,
logger = None )
protected
Check if the visitSummary meets minimum values in visitSummaryMinValues.

Parameters
----------
visit : `int`
    Visit number.
visitSummary : `lsst.afw.table.ExposureCatalog`
    Exposure catalog with per-detector summary information.
visitSummaryMinValues : `dict`
    Dictionary with column names as keys and minimum allowed values as values.
logger : `lsst.log.Logger`
    Logger to log debug and warning messages.

Returns
-------
result : `bool`
    True if all columns in visitSummary meet the minimum values specified
    in visitSummaryMinValues, False otherwise.

Definition at line 37 of file selectImages.py.

◆ validate()

validate ( self)

Definition at line 401 of file selectImages.py.

Variable Documentation

◆ dataId

lsst.pipe.tasks.selectImages.dataId : `dict` of dataId keys

Definition at line 778 of file selectImages.py.

◆ excludeDetectors

lsst.pipe.tasks.selectImages.excludeDetectors
Initial value:
= pexConfig.ListField(
dtype=int,
default=[],
doc="Detectors to exclude from selection.",
optional=True,
)

Definition at line 394 of file selectImages.py.

◆ maxStarEPerBand

lsst.pipe.tasks.selectImages.maxStarEPerBand
Initial value:
= pexConfig.DictField(
keytype=str,
itemtype=float,
default={
"u": 0.4,
"g": 0.4,
"r": 0.4,
"i": 0.4,
"z": 0.4,
"y": 0.4,
"fallback": 0.4,
},
doc="Maximum median of the ellipticity (sqrt(starE1**2.0 + starE2**2.0)) "
"distribution of the star sources used in the PSF model. If the current band "
"for the exposure is not included as a key in this dict, the value associated "
"with the \"fallback\" key will be used.",
)

Definition at line 359 of file selectImages.py.

◆ maxStarUnNormalizedEPerBand

lsst.pipe.tasks.selectImages.maxStarUnNormalizedEPerBand
Initial value:
= pexConfig.DictField(
keytype=str,
itemtype=float,
default={
"u": 2.8,
"g": 2.8,
"r": 2.8,
"i": 2.8,
"z": 2.8,
"y": 2.8,
"fallback": 2.8,
},
doc="Maximum median of the unnormalized ellipticity "
"(sqrt((starXX - starYY)**2.0 + (2.0*starXY)**2.0)) distribution of the star "
"sources used in the PSF model. If the current band for the exposure is not "
"included as a key in this dict, the value associated with the \"fallback\" key "
"will be used.",
)

Definition at line 376 of file selectImages.py.

◆ minNPsfStarPerBand

lsst.pipe.tasks.selectImages.minNPsfStarPerBand

Definition at line 403 of file selectImages.py.

◆ result

lsst.pipe.tasks.selectImages.result : `lsst.sphgeom.ConvexPolygon.convexHull`

Definition at line 783 of file selectImages.py.

◆ skyMap

lsst.pipe.tasks.selectImages.skyMap : `lsst.afw.table.ExposureCatalog`
if self.config.doConfirmOverlap:
    patchPolygon = self.makePatchPolygon(skyMap, dataId)

inputVisits = [visitSummary.ref.dataId['visit'] for visitSummary in visitSummaries]
fwhmSizes = []
visits = []
for visit, visitSummary in zip(inputVisits, visitSummaries):
    # read in one-by-one and only once. There may be hundreds
    visitSummary = visitSummary.get()

    # mjd is guaranteed to be the same for every detector in the
    # visitSummary.
    mjd = visitSummary[0].getVisitInfo().getDate().get(system=DateTime.MJD)

    pixelScales = np.array([vs['pixelScale'] for vs in visitSummary if vs.getWcs()])
    # psfSigma is PSF model determinant radius at chip center in pixels
    psfSigmas = np.array([vs['psfSigma'] for vs in visitSummary if vs.getWcs()])
    fwhm = np.nanmean(psfSigmas * pixelScales) * np.sqrt(8.*np.log(2.))

    if self.config.maxPsfFwhm and fwhm > self.config.maxPsfFwhm:
        continue
    if self.config.minPsfFwhm and fwhm < self.config.minPsfFwhm:
        continue
    if self.config.minMJD and mjd < self.config.minMJD:
        self.log.debug('MJD %f earlier than %.2f; rejecting', mjd, self.config.minMJD)
        continue
    if self.config.maxMJD and mjd > self.config.maxMJD:
        self.log.debug('MJD %f later than %.2f;  rejecting', mjd, self.config.maxMJD)
        continue
    if self.config.doConfirmOverlap and not self.doesIntersectPolygon(visitSummary, patchPolygon):
        continue
    if (self.config.visitSummaryMinValues
        and not _meetsVisitSummaryMinValues(visit, visitSummary, self.config.visitSummaryMinValues,
                                            self.log)):
        continue

    fwhmSizes.append(fwhm)
    visits.append(visit)

sortedVisits = [ind for (_, ind) in sorted(zip(fwhmSizes, visits))]
if self.config.nVisitsMax < 0:
    output = sortedVisits
else:
    output = sortedVisits[:self.config.nVisitsMax]

if len(output) == 0:
    self.log.info("All images rejected in BestSeeingSelectVisitsTask.")
    raise pipeBase.NoWorkFound(f"No good images found for {dataId}")
else:
    self.log.info(
        "%d images selected with FWHM range of %f--%f arcseconds",
        len(output),
        fwhmSizes[visits.index(output[0])],
        fwhmSizes[visits.index(output[-1])],
    )

# In order to store as a StructuredDataDict, convert list to dict
goodVisits = {key: True for key in output}
return pipeBase.Struct(goodVisits=goodVisits)

def makePatchPolygon(self, skyMap, dataId):

Definition at line 776 of file selectImages.py.