1 from __future__
import absolute_import, division, print_function
3 __all__ = [
"MatchMetadata",
"createMatchMetadata"]
5 from lsst.daf.base
import PropertyList
6 from lsst.afw.geom
import Box2D
7 from lsst.afw.image.utils
import getDistortedWcs
11 """Metadata required for unpersisting a match list"""
13 def __init__(self, ctrCoord, radius, filterName):
16 @param[in] ctrCoord: Coordinates of center (lsst.afw.coord.IcrsCoord)
17 @param[in] radius: Minimum radius for selecting sources (lsst.afw.geom.Angle)
18 @param[in] filterName: Name of filter (str) or None
20 PropertyList.__init__(self)
21 ctrCoord = ctrCoord.toIcrs()
22 self.add(
'RA', ctrCoord.getRa().asDegrees(),
'field center in degrees')
23 self.add(
'DEC', ctrCoord.getDec().asDegrees(),
'field center in degrees')
24 self.add(
'RADIUS', radius.asDegrees(),
'field radius in degrees, minimum')
25 self.add(
'SMATCHV', 1,
'SourceMatchVector version number')
26 filterName =
"UNKNOWN" if filterName
is None else str(filterName)
27 self.add(
'FILTER', filterName,
'filter name for photometric data')
31 """Create metadata required for unpersisting a match list
33 @param[in] exposure exposure for which to create metadata
34 @param[in] border number of pixels by which to grow the bbox in all directions
36 @return metadata about the field (a daf_base PropertyList)
38 bboxd = Box2D(exposure.getBBox())
40 wcs = getDistortedWcs(exposure.getInfo())
41 ctrCoord = wcs.pixelToSky(bboxd.getCenter()).toIcrs()
42 approxRadius = max(ctrCoord.angularSeparation(wcs.pixelToSky(pp).toIcrs())
for pp
in bboxd.getCorners())
43 return MatchMetadata(ctrCoord, approxRadius, exposure.getFilter().getName())