Programmer's/Maintainer's Guide: Matchall
matchall
Deprecated. This is simply a wrapper to call matchall2.
matchall2
matchall/matchall2 are designed to match two lists of objects
from different coordinate systems, given a transformation between
the systems. The matching criterion is that the objects must
lie within one full width once transformed. The real work is
done by a c routine, matchup.
Arguments
The basic idea is that, once matchall is run, the elements phoa[matched1]
and phob[matched2] are matched in that order.
- intrns: trns_struct giving the transformation information.
This can either be set by hand or calculated using something
like transimages.
- imsa: imsum_struct containing full width information about image a.
- imsb: imsum_struct containing full width information about image b.
- phoa: Photometry list in first reference frame
- phob: Photometry list in second reference frame
- match1: Returns indicies of matched list in reference frame one.
- match2: Returns indicies of matched list in reference frame two.
- indicies: Returns the indicie array that the c routine (matchup)
that does all of the under the hood work returns.
- ident: Keyword that forces an identity transformation.
- tolerance: Used to manually set the matching tolerance, instead
of using the full width information in imsa,imsb.
Procedure
- The x and y positions of phoa and phob are extracted into x1,y1,x2,y2.
- x1,y1 are sorted by x1, and x2,y2 are sorted by y2
- If the identity flag is set, a identity transform is set up
- If tol isn't set, then it is calculated from the fwx,fwy fields of
imsa,imsb, paying attention to the magnification between systems.
- The c library matchup.so is called to match these lists
- The output of matchup is handled to put the results in the original
phoa,phob ordering (recall the x,y positions were sorted -- this has
to be undone).
matchup
This is the c routine that does the actual matching between lists
of x,y positions.
Procedure
- The (sorted) x1,y1 are all transformed to the x2,y2 frame using
the transformation information.
- x2 is searched to find all points within tol of the transformed x1.
This can be done efficiently with a binary search because x2 is sorted.
- Each of these points which satisfies delta_x^2 + delta_y^2 < tol^2
is pushed onto a stack.
- Once the stack is loaded, the point with the smallest chi2 is then
assigned as the match.
Return values
The information about the match is returned in the array ind.
The way this is presented can be a little confusing. the idea is that ind
returns the indicies in x2,y2 which match up to the points in x1,y1 assuming
that a match was found. The value -1 is returned if no match was found.
So, x2[ind[n]],y2[ind[n]] are the matching point to x1[n],y1[n], if a
match was found. Note that x1,y1,x2,y2 should have been sorted before input,
so it will be necessary for the caller to process ind to get the match
between their original object lists.