/********************************/ /* ctlst */ /* */ /* Catalog list of */ /* object record */ /********************************/ #include "focas1.h" #define T(x, y) strcmp(x, y) == 0 static char *help[] = { "usage: catlist [-flag] options < catalog", "flag: one of the following", " 1: blank separated values (default)", " 2: values on separate lines", " 3: blank separated name = value", " 4: name = value on separte lines", " 5: dump object records in name = value format (options ignored)", " 6: dump object records in one value per line", "", "Options are the following blank separated keywords:", "", "Abbreviated keywords and computed quantities", " o: object number", " c: classification", " a: isophotal area", " m: isophotal magnitude", " x: x position", " y: y position", " r: right ascension", " d: declination", " s: resolution scale", " f: resolution fraction", " ir2: intensity weighted second moment radius", " r2: unweighted second moment radius", " mc: core magnitude", " ma: aperture magnitude", " mi: isophotal magnitude", " mt: total magnitude", "Basic object record entries", " entnum: detection number", " subent: split number", " class: classification", " eflgs: object flags", " sbr: sky brightness", " nsbr: number of sky pixels", " ssbr: sky sigma", " area: isophotal area", " tarea: total area", " ispht: isophote brightness", " xavg: average x width", " yavg: average y width", " xc: x position", " yc: y position", " ra: right ascension", " dec: declination", " Li: isophotal luminosity", " sLi: sigma of isophotal luminosity", " Lc: core luminosity", " Lfca: aperture luminosity", " Ltotal: total luminosity", " mag: isophotal magnitude", " icx: x intensity weighted centroid", " icy: y intensity weighted centroid", " ixx: xx intensity weighted second moment", " iyy: yy intensity weighted second moment", " ixy: xy intensity weighted second moment", " ir1: intensity weighted first moment radius", " ir3: intensity weighted third moment radius", " ir4: intensity weighted fourth moment radius", " cx: x unweighted centroid", " cy: y unweighted centroid", " xx: xx unweighted second moment", " yy: yy unweighted second moment", " xy: xy unweighted second moment", " r1: unweighted first moment radius", " fitxc: x template center", " fityc: y template center", " scale: resolution scale", " frac: resolution fraction", " prob: resolution probability", " arpos: area file offset", 0 }; stctlst (options, o) char *options; struct objrec *o; { int i, fltwds; char *fltptr[25], fltwd[25][10]; if (strlen (options)) { fltwds = sscanf (options, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", fltwd[0], fltwd[1], fltwd[2], fltwd[3], fltwd[4], fltwd[5], fltwd[6], fltwd[7], fltwd[8], fltwd[9], fltwd[10], fltwd[11], fltwd[12], fltwd[13], fltwd[14], fltwd[15], fltwd[16], fltwd[17], fltwd[18], fltwd[19], fltwd[20], fltwd[21], fltwd[22], fltwd[23], fltwd[24]); for (i = 0; i < fltwds; i++) fltptr[i] = fltwd[i]; } else fltwds = 0; return (ctlst (fltwds, fltptr, o)); } ctlst (argc, argv, o) int argc; char *argv[]; struct objrec *o; { int i, j; char flag; if ((argc == 0) || (argv[0][0] == '^')) { for (i = 0; help[i] != 0; i++) printf ("%s\n", help[i]); return (1); } flag = '1'; j = 0; if (argv[0][0] == '-') { flag = argv[0][1]; j++; } if (flag == '5') for (i = 1; i < 41; i++) {/* Dump object record */ nvalue (i); pvalue (i, o); printf ("\n"); } if (flag == '6') for (i = 1; i < 41; i++) {/* Dump object record */ pvalue (i, o); printf ("\n"); } else { /* Print selected options */ for (i = j; i < argc; i++) { if ((i != j) && ((flag == '1') || (flag == '3'))) printf (" "); if ((flag == '3') || (flag == '4')) nvalue (ctselect (argv[i])); pvalue (ctselect (argv[i]), o); if ((i < argc - 1) && ((flag == '2') || (flag == '4'))) printf ("\n"); } printf ("\n"); } return (0); } /*Return integer to quantity selected by string*/ ctselect (string) char string[]; { /* Alternate names */ if (T (string, "c")) return (3); if (T (string, "a")) return (8); if (T (string, "m")) return (22); if (T (string, "x")) return (13); if (T (string, "y")) return (14); if (T (string, "r")) return (15); if (T (string, "d")) return (16); if (T (string, "s")) return (39); if (T (string, "f")) return (40); if (T (string, "o")) return (43); /* Basic derived names */ if (T (string, "object")) return (43); if (T (string, "ir2")) return (44); if (T (string, "r2")) return (45); if (T (string, "mc")) return (46); if (T (string, "ma")) return (47); if (T (string, "mi")) return (22); if (T (string, "mt")) return (48); /* Basic names */ if (T (string, "entnum")) return (1); if (T (string, "subent")) return (2); if (T (string, "class")) return (3); if (T (string, "eflgs")) return (4); if (T (string, "sbr")) return (5); if (T (string, "nsbr")) return (6); if (T (string, "ssbr")) return (7); if (T (string, "area")) return (8); if (T (string, "tarea")) return (9); if (T (string, "ispht")) return (10); if (T (string, "xavg")) return (11); if (T (string, "yavg")) return (12); if (T (string, "xc")) return (13); if (T (string, "yc")) return (14); if (T (string, "ra")) return (15); if (T (string, "dec")) return (16); if (T (string, "Li")) return (17); if (T (string, "sLi")) return (18); if (T (string, "Lc")) return (19); if (T (string, "Lfca")) return (20); if (T (string, "Ltotal")) return (21); if (T (string, "mag")) return (22); if (T (string, "icx")) return (23); if (T (string, "icy")) return (24); if (T (string, "ixx")) return (25); if (T (string, "iyy")) return (26); if (T (string, "ixy")) return (27); if (T (string, "ir1")) return (28); if (T (string, "ir3")) return (29); if (T (string, "ir4")) return (30); if (T (string, "cx")) return (31); if (T (string, "cy")) return (32); if (T (string, "xx")) return (33); if (T (string, "yy")) return (34); if (T (string, "xy")) return (35); if (T (string, "r1")) return (36); if (T (string, "fitxc")) return (37); if (T (string, "fityc")) return (38); if (T (string, "scale")) return (39); if (T (string, "frac")) return (40); if (T (string, "prob")) return (41); if (T (string, "arpos")) return (42); return (0); } /*Print value of string in appropriate format*/ pvalue (n, o) int n; struct objrec *o; { float temp; if (o == 0) { printf ("-999"); return (0); } switch (n) { case 0: break; case 1: printf ("%d", o->entnum); break; case 2: printf ("%d", o->subent); break; case 3: printf ("%s", o->class); break; case 4: if (o->eflgs & FRCD) printf ("F"); if (o->eflgs & EDGE) printf ("B"); if (o->eflgs & ATTN) printf ("A"); if (o->eflgs & SIZE) printf ("L"); if (o->eflgs & CLSF) printf ("C"); if (o->eflgs & PEAK) printf ("P"); if (o->eflgs & SNGL) printf ("S"); if (o->eflgs & REFP) printf ("R"); if (o->eflgs & DARK) printf ("D"); if (o->eflgs & EVAL) printf ("E"); if (o->eflgs == 0) printf ("-"); break; case 5: printf ("%.6g", o->sbr); break; case 6: printf ("%d", o->nsbr); break; case 7: printf ("%.6g", o->ssbr); break; case 8: printf ("%d", o->area); break; case 9: printf ("%d", o->tarea); break; case 10: printf ("%.6g", o->ispht); break; case 11: printf ("%.6g", o->xavg); break; case 12: printf ("%.6g", o->yavg); break; case 13: printf ("%.6g", o->xc); break; case 14: printf ("%.6g", o->yc); break; case 15: printf ("%.6g", o->ra); break; case 16: printf ("%.6g", o->dec); break; case 17: printf ("%.6g", o->Li); break; case 18: printf ("%.6g", o->sLi); break; case 19: printf ("%.6g", o->Lc); break; case 20: printf ("%.6g", o->Lfca); break; case 21: printf ("%.6g", o->Ltotal); break; case 22: printf ("%.6g", o->mag); break; case 23: printf ("%.6g", o->icx); break; case 24: printf ("%.6g", o->icy); break; case 25: printf ("%.6g", o->ixx); break; case 26: printf ("%.6g", o->iyy); break; case 27: printf ("%.6g", o->ixy); break; case 28: printf ("%.6g", o->ir1); break; case 29: printf ("%.6g", pow (o->ir3, 1./ 3.)); break; case 30: temp = o->ir4 > 0. ? o->ir4 : 0.; printf ("%.6g", sqrt (sqrt (temp))); break; case 31: printf ("%.6g", o->cx); break; case 32: printf ("%.6g", o->cy); break; case 33: printf ("%.6g", o->xx); break; case 34: printf ("%.6g", o->yy); break; case 35: printf ("%.6g", o->xy); break; case 36: printf ("%.6g", o->r1); break; case 37: printf ("%.6g", o->fitxc); break; case 38: printf ("%.6g", o->fityc); break; case 39: printf ("%.6g", o->scale); break; case 40: printf ("%.6g", o->frac); break; case 41: printf ("%.6g", o->prob); break; case 42: printf ("%d", o->arpos); break; case 43: printf ("%d.%-d ", o->entnum, o->subent); break; case 44: temp = o->ixx + o->iyy; temp = temp > 0. ? temp : 0.; printf ("%.6g", sqrt (temp)); break; case 45: temp = o->xx + o->yy; temp = temp > 0. ? temp : 0.; printf ("%.6g", sqrt (temp)); break; case 46: if (o->Lc > 0.) printf ("%.6g", sp.magfst - 2.5 * log10 (o->Lc)); else printf ("0 "); break; case 47: if (o->Lfca > 0.) printf ("%.6g", sp.magfst - 2.5 * log10 (o->Lfca)); else printf ("0 "); break; case 48: if (o->Ltotal > 0.) printf ("%.6g", sp.magfst - 2.5 * log10 (o->Ltotal)); else printf ("0 "); break; } return (0); } /*Print name of string*/ nvalue (n) int n; { switch (n) { case 0: break; case 1: printf ("detection = "); break; case 2: printf ("split = "); break; case 3: printf ("classification = "); break; case 4: printf ("flags = "); break; case 5: printf ("sky brightness = "); break; case 6: printf ("sky pixels = "); break; case 7: printf ("sky sigma = "); break; case 8: printf ("isophotal area = "); break; case 9: printf ("total area = "); break; case 10: printf ("isophote = "); break; case 11: printf ("average x width = "); break; case 12: printf ("average y width = "); break; case 13: printf ("x = "); break; case 14: printf ("y = "); break; case 15: printf ("ra = "); break; case 16: printf ("dec = "); break; case 17: printf ("isophotal luminosity= "); break; case 18: printf ("isophotal sigma = "); break; case 19: printf ("core luminosity = "); break; case 20: printf ("aperture luminosity = "); break; case 21: printf ("total luminosity = "); break; case 22: printf ("isophotal magnitude = "); break; case 23: printf ("x intensity centroid= "); break; case 24: printf ("y intensity centroid= "); break; case 25: printf ("ixx = "); break; case 26: printf ("iyy = "); break; case 27: printf ("ixy = "); break; case 28: printf ("ir1 = "); break; case 29: printf ("ir3 = "); break; case 30: printf ("ir4 = "); break; case 31: printf ("x centroid = "); break; case 32: printf ("y centroid = "); break; case 33: printf ("xx = "); break; case 34: printf ("yy = "); break; case 35: printf ("xy = "); break; case 36: printf ("r1 = "); break; case 37: printf ("x template center = "); break; case 38: printf ("y template center = "); break; case 39: printf ("resolution scale = "); break; case 40: printf ("resolution fraction = "); break; case 41: printf ("resolution prob = "); break; case 42: printf ("area file offset = "); break; case 43: printf ("object = "); break; case 44: printf ("ir2 = "); break; case 45: printf ("r2 = "); break; case 46: printf ("core magnitude = "); break; case 47: printf ("aperture magnitude = "); break; case 48: printf ("total magnitude = "); break; } return (0); }