Correlate the source positions found on two lists.
Source matching is done by finding sources within a specified radius.
If you have position errors available and wish to match by significance
level, then try match_xy.pro in the TARA library
x1in,y1in - First set of x and y coordinates. The program
marches through this list element by element,
looking in list 2 for the closest match. So, the program
will run faster if this is the shorter of the two lists.
Unless you use the option or magnitude keyword, there is
nothing to guarantee unique matches.
x2in,y2in - Second set of x and y coordinates. This list is
searched in its entirety every time one element of list 1
dcr - Critical radius outside which correlations are rejected;
but see 'option' below.
Optional Keyword Input
option - Changes behavior of program and description of output
lists slightly, as follows:
OPTION=0 or left out
Same as older versions of SRCOR. The closest match from list2
is found for each element of list 1, but if the distance is
greater than DCR, the match is thrown out. Thus the index
of that element within list 1 will not appear in the IND1 output
Forces the output mapping to be one-to-one. OPTION=0 results,
in general, in a many-to-one mapping from list 1 to list 2.
Under OPTION=1, a further processing step is performed to
keep only the minimum-distance match, whenever an entry from
list 1 appears more than once in the initial mapping.
Same as OPTION=1, except the critical distance parameter DCR
is ignored. I.e., the closest object is retrieved from list 2
for each object in list 1 WITHOUT a critical-radius criterion,
then the clean-up of duplicates is done as under OPTION=1.
An array of stellar magnitudes corresponding to x1in and y1in.
If this is supplied, then the brightest star from list 1
within the selected distance of the star in list 2 is taken.
The option keyword is ignored in this case.
If SPHERICAL=1, it is assumed that the input arrays are in
celestial coordinates (RA and Dec), with x1in and x2in in
decimal hours and y1in and y2in in decimal degrees. If
SPHERICAL=2 then it is assumed that the input arrays are in
longitude and latitude with x1in,x2in,y1in,y2in in decimal
degrees. In both cases, the critial radius dcr is in
*arcseconds*. Calculations of spherical distances are made
with the gcirc program.
ind1 - index of matched stars in first list, set to -1 if no matches
ind2 - index of matched stars in second list
Optional Output Keyword
Count - integer giving number of matches returned
Adapted from UIT procedure J.Wm.Parker, SwRI 29 July 1997
Improve speed for spherical searches, added /SILENT keyword
W. Landsman Mar 2009
Avoid error when no matches found with /SPHERICAL O. Trottier June 2009
Added output Count keyword W.L June 2009
Adjust right ascension for cosine angle W.L. December 2009
Return as soon as no matches found W.L. December 2009
Use some V6.0 notation W.L. February 2011
Fix problem when /Spherical and Option =2 set, and sources separated
by more han 180 degrees. W.L. March 2011