lsst.pipe.tasks g540474b770+e939cf0e26
Loading...
Searching...
No Matches
lsst.pipe.tasks.selectImages Namespace Reference

Classes

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

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()

lsst.pipe.tasks.selectImages._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()

lsst.pipe.tasks.selectImages._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()

lsst.pipe.tasks.selectImages.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:
1= pexConfig.ListField(
2 dtype=int,
3 default=[],
4 doc="Detectors to exclude from selection.",
5 optional=True,
6 )

Definition at line 394 of file selectImages.py.

◆ maxStarEPerBand

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

Definition at line 359 of file selectImages.py.

◆ maxStarUnNormalizedEPerBand

lsst.pipe.tasks.selectImages.maxStarUnNormalizedEPerBand
Initial value:
1= pexConfig.DictField(
2 keytype=str,
3 itemtype=float,
4 default={
5 "u": 2.8,
6 "g": 2.8,
7 "r": 2.8,
8 "i": 2.8,
9 "z": 2.8,
10 "y": 2.8,
11 "fallback": 2.8,
12 },
13 doc="Maximum median of the unnormalized ellipticity "
14 "(sqrt((starXX - starYY)**2.0 + (2.0*starXY)**2.0)) distribution of the star "
15 "sources used in the PSF model. If the current band for the exposure is not "
16 "included as a key in this dict, the value associated with the \"fallback\" key "
17 "will be used.",
18 )

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.