Class implementing a pessimistic version of Optimistic Pattern Matcher
B (OPMb) from `Tabur (2007)`_, as described in `DMTN-031`_
Parameters
----------
reference_array : `numpy.ndarray`, (N, 3)
spherical points x, y, z of to use as reference objects for
pattern matching.
log : `lsst.log.Log` or `logging.Logger`
Logger for outputting debug info.
Notes
-----
The class loads and stores the reference object
in a convenient data structure for matching any set of source objects that
are assumed to contain each other. The pessimistic nature of the algorithm
comes from requiring that it discovers at least two patterns that agree on
the correct shift and rotation for matching before exiting. The original
behavior of OPMb can be recovered simply. Patterns matched between the
input datasets are n-spoked pinwheels created from n+1 points. Refer to
`DMTN-031`_ for more details.
.. _Tabur (2007): https://doi.org/10.1071/AS07028
.. _DMTN-031: https://dmtn-031.lsst.io/
Definition at line 77 of file pessimistic_pattern_matcher_b_3D.py.
def lsst.meas.astrom.pessimistic_pattern_matcher_b_3D.PessimisticPatternMatcherB.match |
( |
|
self, |
|
|
|
source_array, |
|
|
|
n_check, |
|
|
|
n_match, |
|
|
|
n_agree, |
|
|
|
max_n_patterns, |
|
|
|
max_shift, |
|
|
|
max_rotation, |
|
|
|
max_dist, |
|
|
|
min_matches, |
|
|
|
pattern_skip_array = None |
|
) |
| |
Match a given source catalog into the loaded reference catalog.
Given array of points on the unit sphere and tolerances, we
attempt to match a pinwheel like pattern between these input sources
and the reference objects this class was created with. This pattern
informs of the shift and rotation needed to align the input source
objects into the frame of the references.
Parameters
----------
source_array : `numpy.ndarray`, (N, 3)
An array of spherical x,y,z coordinates and a magnitude in units
of objects having a lower value for sorting. The array should be
of shape (N, 4).
n_check : `int`
Number of sources to create a pattern from. Not all objects may be
checked if n_match criteria is before looping through all n_check
objects.
n_match : `int`
Number of objects to use in constructing a pattern to match.
n_agree : `int`
Number of found patterns that must agree on their shift and
rotation before exiting. Set this value to 1 to recover the
expected behavior of Optimistic Pattern Matcher B.
max_n_patters : `int`
Number of patterns to create from the input source objects to
attempt to match into the reference objects.
max_shift : `float`
Maximum allowed shift to match patterns in arcseconds.
max_rotation : `float`
Maximum allowed rotation between patterns in degrees.
max_dist : `float`
Maximum distance in arcseconds allowed between candidate spokes in
the source and reference objects. Also sets that maximum distance
in the intermediate verify, pattern shift/rotation agreement, and
final verify steps.
pattern_skip_array : `int`
Patterns we would like to skip. This could be due to the pattern
being matched on a previous iteration that we now consider invalid.
This assumes the ordering of the source objects is the same
between different runs of the matcher which, assuming no object
has been inserted or the magnitudes have changed, it should be.
Returns
-------
output_struct : `lsst.pipe.base.Struct`
Result struct with components
- ``matches`` : (N, 2) array of matched ids for pairs. Empty list if no
match found (`numpy.ndarray`, (N, 2) or `list`)
- ``distances_rad`` : Radian distances between the matched objects.
Empty list if no match found (`numpy.ndarray`, (N,))
- ``pattern_idx``: Index of matched pattern. None if no match found
(`int`).
- ``shift`` : Magnitude for the shift between the source and reference
objects in arcseconds. None if no match found (`float`).
Definition at line 160 of file pessimistic_pattern_matcher_b_3D.py.