LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.astrom.directMatch.DirectMatchTask Class Reference
Inheritance diagram for lsst.meas.astrom.directMatch.DirectMatchTask:

Public Member Functions

def __init__ (self, butler=None, refObjLoader=None, **kwargs)
 
def setRefObjLoader (self, refObjLoader)
 
def run (self, catalog, filterName=None, epoch=None)
 
def calculateCircle (self, catalog)
 

Public Attributes

 refObjLoader
 

Static Public Attributes

 ConfigClass = DirectMatchConfig
 

Detailed Description

Simple, brute force matching of a source catalog to a reference catalog.

Parameters
----------
butler : `lsst.daf.persistence.Butler`
    Data butler containing the relevant reference catalog data.
refObjLoader : `lsst.meas.algorithms.LoadReferenceObjectsTask` or `None`
    For loading reference objects.
**kwargs
    Other keyword arguments required for instantiating a Task (such as
    ``config``).

Definition at line 29 of file directMatch.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.astrom.directMatch.DirectMatchTask.__init__ (   self,
  butler = None,
  refObjLoader = None,
**  kwargs 
)

Definition at line 45 of file directMatch.py.

45  def __init__(self, butler=None, refObjLoader=None, **kwargs):
46  Task.__init__(self, **kwargs)
47  if not refObjLoader:
48  if butler:
49  if not isinstance(self.config, DirectMatchConfig):
50  raise RuntimeError("DirectMatchTask must be initialized with DirectMatchConfig "
51  "if a refObjLoader is not supplied at initialization")
52  self.makeSubtask("refObjLoader", butler=butler)
53  else:
54  self.refObjLoader = None
55 
56  else:
57  self.refObjLoader = refObjLoader
58  self.makeSubtask("sourceSelection")
59  self.makeSubtask("referenceSelection")
60 

Member Function Documentation

◆ calculateCircle()

def lsst.meas.astrom.directMatch.DirectMatchTask.calculateCircle (   self,
  catalog 
)
Calculate a circle enclosing the catalog.

Parameters
----------
catalog : `lsst.afw.table.SourceCatalog`
    Catalog to encircle.

Returns
-------
result : `lsst.pipe.base.Struct`
    Result struct with components:

    ``center``
        ICRS center coordinate (`lsst.afw.geom.SpherePoint`).
    ``radius``
        Radius of the circle (`lsst.geom.Angle`).

Definition at line 123 of file directMatch.py.

123  def calculateCircle(self, catalog):
124  """Calculate a circle enclosing the catalog.
125 
126  Parameters
127  ----------
128  catalog : `lsst.afw.table.SourceCatalog`
129  Catalog to encircle.
130 
131  Returns
132  -------
133  result : `lsst.pipe.base.Struct`
134  Result struct with components:
135 
136  ``center``
137  ICRS center coordinate (`lsst.afw.geom.SpherePoint`).
138  ``radius``
139  Radius of the circle (`lsst.geom.Angle`).
140  """
141  coordList = [src.getCoord() for src in catalog]
142  center = averageSpherePoint(coordList)
143  radius = max(center.separation(coord) for coord in coordList)
144  return Struct(center=center, radius=radius + self.config.matchRadius*arcseconds)
int max
SpherePoint averageSpherePoint(std::vector< SpherePoint > const &coords)
Return the average of a list of coordinates.
Definition: SpherePoint.cc:235

◆ run()

def lsst.meas.astrom.directMatch.DirectMatchTask.run (   self,
  catalog,
  filterName = None,
  epoch = None 
)
Load reference objects and match to them.

Parameters
----------
catalog : `lsst.afw.table.SourceCatalog`
    Catalog to match.
filterName : `str`
    Name of filter loading fluxes.
epoch : `astropy.time.Time` or `None`
    Epoch to which to correct proper motion and parallax, or `None` to
    not apply such corrections.

Returns
-------
result : `lsst.pipe.base.Struct`
    Result struct with components:

    ``matches``
        Matched sources with associated reference
        (`lsst.afw.table.SourceMatchVector`).
    ``matchMeta``
        Match metadata (`lsst.meas.astrom.MatchMetadata`).

Definition at line 76 of file directMatch.py.

76  def run(self, catalog, filterName=None, epoch=None):
77  """Load reference objects and match to them.
78 
79  Parameters
80  ----------
81  catalog : `lsst.afw.table.SourceCatalog`
82  Catalog to match.
83  filterName : `str`
84  Name of filter loading fluxes.
85  epoch : `astropy.time.Time` or `None`
86  Epoch to which to correct proper motion and parallax, or `None` to
87  not apply such corrections.
88 
89  Returns
90  -------
91  result : `lsst.pipe.base.Struct`
92  Result struct with components:
93 
94  ``matches``
95  Matched sources with associated reference
96  (`lsst.afw.table.SourceMatchVector`).
97  ``matchMeta``
98  Match metadata (`lsst.meas.astrom.MatchMetadata`).
99  """
100  if self.refObjLoader is None:
101  raise RuntimeError("Running matcher task with no refObjLoader set in __ini__ or setRefObjLoader")
102  circle = self.calculateCircle(catalog)
103  matchMeta = self.refObjLoader.getMetadataCircle(circle.center, circle.radius, filterName, epoch=epoch)
104  emptyResult = Struct(matches=[], matchMeta=matchMeta)
105  sourceSelection = self.sourceSelection.run(catalog)
106  if len(sourceSelection.sourceCat) == 0:
107  self.log.warning("No objects selected from %d objects in source catalog", len(catalog))
108  return emptyResult
109  refData = self.refObjLoader.loadSkyCircle(circle.center, circle.radius, filterName, epoch=epoch)
110  refCat = refData.refCat
111  refSelection = self.referenceSelection.run(refCat)
112  if len(refSelection.sourceCat) == 0:
113  self.log.warning("No objects selected from %d objects in reference catalog", len(refCat))
114  return emptyResult
115  matches = afwTable.matchRaDec(refSelection.sourceCat, sourceSelection.sourceCat,
116  self.config.matchRadius*arcseconds)
117  self.log.info("Matched %d from %d/%d input and %d/%d reference sources",
118  len(matches), len(sourceSelection.sourceCat), len(catalog),
119  len(refSelection.sourceCat), len(refCat))
120  return Struct(matches=matches, matchMeta=matchMeta, refCat=refCat, sourceSelection=sourceSelection,
121  refSelection=refSelection)
122 
std::vector< Match< typename Cat1::Record, typename Cat2::Record > > matchRaDec(Cat1 const &cat1, Cat2 const &cat2, lsst::geom::Angle radius, MatchControl const &mc=MatchControl())
Compute all tuples (s1,s2,d) where s1 belings to cat1, s2 belongs to cat2 and d, the distance between...
Definition: Match.cc:158
def run(self, coaddExposures, bbox, wcs)
Definition: getTemplate.py:603

◆ setRefObjLoader()

def lsst.meas.astrom.directMatch.DirectMatchTask.setRefObjLoader (   self,
  refObjLoader 
)
Set the reference object loader for the task.

Parameters
----------
refObjLoader
    An instance of a reference object loader, either a
    `lsst.meas.algorithms.LoadReferenceObjectsTask` task or a
    `lsst.meas.algorithms.ReferenceObjectLoader` instance. A task can
    be used as a subtask and is generally used in gen2 middleware. The
    class is designed to be used with gen3 middleware and is
    initialized outside the normal task framework.

Definition at line 61 of file directMatch.py.

61  def setRefObjLoader(self, refObjLoader):
62  """Set the reference object loader for the task.
63 
64  Parameters
65  ----------
66  refObjLoader
67  An instance of a reference object loader, either a
68  `lsst.meas.algorithms.LoadReferenceObjectsTask` task or a
69  `lsst.meas.algorithms.ReferenceObjectLoader` instance. A task can
70  be used as a subtask and is generally used in gen2 middleware. The
71  class is designed to be used with gen3 middleware and is
72  initialized outside the normal task framework.
73  """
74  self.refObjLoader = refObjLoader
75 

Member Data Documentation

◆ ConfigClass

lsst.meas.astrom.directMatch.DirectMatchTask.ConfigClass = DirectMatchConfig
static

Definition at line 42 of file directMatch.py.

◆ refObjLoader

lsst.meas.astrom.directMatch.DirectMatchTask.refObjLoader

Definition at line 54 of file directMatch.py.


The documentation for this class was generated from the following file: