Class implementing a pessimistic version of Optimistic Pattern Matcher
B (OPMb) from Tabur 2007. 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. http://github.com/lsst-dm/dmtn-031
--------------------------------------------------------------------------
Attributes:
reference_array : float array
spherical points x, y, z of to use as reference objects for
pattern matching.
log : an lsst.log instance
pair_id_array : int array
Internal lookup table. Given an id in the reference array, return
an array of the id pair that contains this object's id sorted on
the distance to the pairs.
pair_delta_array : float array
Internal lookup table. Given an id in the reference array, return
an array of the 3 vector deltas of all other pairs sorted on their
distance.
pair_dist_array : float array
Internal lookup table. Given an id in the reference return an array
of pair distances of all other pairs sorted on distance.
dist_array : float array
Array of all pairs of objects in the reference array sorted on
distance.
id_array : int array
Array of id pairs that lookup into the reference array sorted
on pair distance.
delta_array : float array
Array of 3 vector deltas for each pair in the reference array
sorted on pair distance.
Definition at line 61 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: float array
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 value
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 value
Number of objects to use in constructing a pattern to match.
n_agree: int value
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 value
Number of patterns to create from the input source objects to
attempt to match into the reference objects.
max_shift: float value
Maximum allowed shift to match patterns in arcseconds.
max_rotation: float value
Maximum allowed rotation between patterns in degrees.
max_dist: float value
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 array
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 : pipe.base.struct
A lsst.pipe.base struct containing the following outputs.
matches : int array
(N, 2) array of matched ids for pairs. Empty list if no
match found.
distances_rad : float array
Radian distances between the matched objects. Empty list
if no match found.
pattern_idx : int
Index of matched pattern. None if no match found.
shift : float
Magnitude for the shift between the source and
reference objects in arcseconds. None if no match found.
Definition at line 215 of file pessimistic_pattern_matcher_b_3D.py.