For fields with many stars (100000) the matching and sorting required to complete this script can 20 minutes or more.
The guide star selection program expects its input catalog to be a a tab delimited ASCII table with two header lines in starbase format. All of the programs that are used with hectospec expect RA and Dec to be in units of hours and degrees in the FK5 (J2000) coordinate system. They format thier output as colon separated sexagasmal, but they will read eighter sexagasmal or decimal values on input.
The column headings should look like this example:
ra dec mag rank -- --- --- ----
1. Count the number of targets in the input file and shows the user the count
2. Filter the input file on the "type" column if it exists, selecting the
type == "Target" rows. "root.tag"
3. Computes the RA, Dec center and area of the catalog from the filtered targets.
4. Makes a catalog of 2mass targets from the center and area of the filtered targets.
A. All targets with neighbors within 2 arc seconds of each other are removed.
B. Shows the count of the 2mass catalog "root.tmc"
5. The filtered targets and the 2mass catalogs are matched.
A. Finds the filtered targets that are near (2 arcsecs) the 2mass catalog
targets, "root.near"
B. Finds the tmc targets that are near the filtered targets, "root.tmc.near"
C. Matches the targets in "root.near" and "root.tmc.near", creating
"root.tmc.matched"
6. Fits a linear translation and rotaiton between "root.near" and "root.tmc.near"
from "root.tmc.matched"
7. Makes a catalog of Guide Star 2 catalog targets from the center and area of
the filtered targets.
A. All targets with identical gsc2_id's combined.
B. All targets with neighbors within 2.5 arc seconds of each other are combined.
C. All targets with neighbors within 10 arc seconds of each other are removed.
D. Shows the count of the Guide Star 2 catalog "root.gsc"
E. Selects stars from the Guide Star 2 catalog (class == 0).
D. If magcat == gsc, computes the estimated rmag magnitude as the average of magf
and magj columns and selects stars from the input magnitude range "root.gsc.gdr".
8. If magcat == tmc, computes the estimated rmag magnitude from the 2mass colors
using a polynomial fit to colors of known stars and selelects stars from the input
magnitude range "root.tmc.gdr".
# R Magnitude corrections where fit from colors in Main Sequence
# broadband color table, from Kenyon, S. and Hartmann, L. 1995
# ApJS,101,117 for colors available in the 2mass catalog.
#
# RMS_rj 0.0450228
9. The guide candidates from the 2mass catalog and the Guide Star 2 catalogs are matched.
A. Finds the 2mass targets that are near (2 arcsecs) the Guide Star 2 catalog
targets, "root.tmc.gsc.near"
B. Finds the tmc targets that are near the filtered targets, "root.gsc.tmc.near"
C. Matches the targets in "root.tmc.gsc.near" and "root.gsc.tmc.near",
creating "root.tmc.gsc.matched"
10. The stars in the 2mass catalog and the Guide Star 2 match are placed in
the input target coordinate system by applying the transformation computed
in "root.tmc.matched" to the 2mass catalog coordinates.
11. The combination of the filtered targets and the transformed guide star catalog
is output.