LSSTApplications  11.0-22-g33de520,13.0+4,13.0+72,13.0-1-g46ffeb4+33,13.0-1-g47a359c+13,13.0-10-gbb93d41+29,13.0-12-g0251d74+22,13.0-12-gaf0c0ec+7,13.0-13-gd4b2922+21,13.0-14-g9415442+37,13.0-18-gc4ad422+6,13.0-2-g167564e+9,13.0-2-g50559bf,13.0-22-g3839dbb+22,13.0-26-g0f127ff+4,13.0-3-g3542790+8,13.0-3-g520d906+1,13.0-31-g48013df,13.0-4-g4231ded+8,13.0-42-g52e9227+2,13.0-5-g2a40766+1,13.0-52-g022e0bf+6,13.0-6-g08b5043,13.0-6-geef1ef2+6,13.0-8-gb7ca535,13.0-94-ga1c4440,master-gada5ecbbff+5,master-gf6b1fd7af3+2
LSSTDataManagementBasePackage
createMatchMetadata.py
Go to the documentation of this file.
1 from __future__ import absolute_import, division, print_function
2 
3 __all__ = ["MatchMetadata", "createMatchMetadata"]
4 
5 from lsst.daf.base import PropertyList
6 from lsst.afw.geom import Box2D
7 from lsst.afw.image.utils import getDistortedWcs
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  filterName = "UNKNOWN" if filterName is None else str(filterName)
27  self.add('FILTER', filterName, 'filter name for photometric data')
28 
29 
30 def createMatchMetadata(exposure, border=0):
31  """Create metadata required for unpersisting a match list
32 
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
35 
36  @return metadata about the field (a daf_base PropertyList)
37  """
38  bboxd = Box2D(exposure.getBBox())
39  bboxd.grow(border)
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())
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).
int max
Definition: BoundedField.cc:99
def getDistortedWcs
Get a WCS from an exposureInfo, with distortion terms if possible.
Definition: utils.py:60
A floating-point coordinate rectangle geometry.
Definition: Box.h:266