LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
createMatchMetadata.py
Go to the documentation of this file.
1 from __future__ import absolute_import, division, print_function
2 
3 from lsst.daf.base import PropertyList
4 from lsst.afw.geom import Box2D
5 from lsst.afw.image.utils import getDistortedWcs
6 
7 __all__ = ["MatchMetadata", "createMatchMetadata"]
8 
9 
11  """Metadata required for unpersisting a match list"""
12 
13  def __init__(self, ctrCoord, radius, filterName):
14  """!Ctor
15 
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
19  """
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  self.add('FILTER', filterName or "UNKNOWN", 'filter name for photometric data')
27 
28 
29 def createMatchMetadata(exposure, border=0):
30  """Create metadata required for unpersisting a match list
31 
32  @param[in] exposure exposure for which to create metadata
33  @param[in] border number of pixels by which to grow the bbox in all directions
34 
35  @return metadata about the field (a daf_base PropertyList)
36  """
37  bboxd = Box2D(exposure.getBBox())
38  bboxd.grow(border)
39  wcs = getDistortedWcs(exposure.getInfo())
40  ctrCoord = wcs.pixelToSky(bboxd.getCenter()).toIcrs()
41  approxRadius = max(ctrCoord.angularSeparation(wcs.pixelToSky(pp).toIcrs()) for pp in bboxd.getCorners())
42  return MatchMetadata(ctrCoord, approxRadius, exposure.getFilter().getName())
Class for storing ordered metadata with comments.
Definition: PropertyList.h:82
void add(std::string const &name, T const &value)
Appends a single value to the vector of values for a property name (possibly hierarchical).
def getDistortedWcs
Get a WCS from an exposureInfo, with distortion terms if possible.
Definition: utils.py:48
A floating-point coordinate rectangle geometry.
Definition: Box.h:271