IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26288


Ignore:
Timestamp:
Nov 29, 2009, 3:16:26 PM (16 years ago)
Author:
bills
Message:

change command line arguments to dvoImagesAtCoords
Make coordinate file a named option. If not supplied
require ra and dec as arguments. Add option to print full "image" names

Location:
trunk/Ohana/src/getstar
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/getstar/include/dvoImagesAtCoords.h

    r25208 r26288  
    2727} Point;
    2828
     29char *astromFile;
     30char *coordsFile;
     31double cmd_line_ra;
     32double cmd_line_dec;
     33int fullNames;
    2934int WITH_PHU;
    3035int SOLO_PHU;
    3136int ACCEPT_ASTROM;
    32 char *astromFile;
    3337
    34 // These functions belong to dvoImageOverap
     38// These functions belong to dvoImagesAtCoords
    3539int  args_coords         PROTO((int argc, char **argv));
    3640int  ConfigInit_coords PROTO((int *argc, char **argv));
  • trunk/Ohana/src/getstar/src/args_coords.c

    r24914 r26288  
    33void help () {
    44  fprintf (stderr, "USAGE: \n"
    5            "dvoImagesAtCoords [-astrom astrom_file] (coords_file)\n"
     5           "dvoImagesAtCoords [-astrom astrom_file] -coords coords_file\n"
     6           "dvoImagesAtCoords [-astrom astrom_file] (ra) (dec))\n"
    67    );
    78  exit (2);
     
    1819  }
    1920
     21  coordsFile = NULL;
     22  if ((N = get_argument(argc, argv, "-coords"))) {
     23    remove_argument (N, &argc, argv);
     24    if (argv[N] == NULL) {
     25      fprintf (stderr, "ERROR: no file provided with -coords\n");
     26      exit (1);
     27    }
     28    coordsFile = strdup(argv[N]);
     29    remove_argument (N, &argc, argv);
     30  }
    2031  astromFile = NULL;
    2132  if ((N = get_argument(argc, argv, "-astrom"))) {
     
    8192  }
    8293
    83   if (argc != 2) help();
     94  fullNames = 0;
     95  if ((N = get_argument(argc, argv, "-full-names"))) {
     96    remove_argument (N, &argc, argv);
     97    fullNames = 1;
     98  }
     99
     100  if (coordsFile) {
     101      if (argc != 1) help();
     102  } else {
     103      // expect RA and DEC on command line
     104      if (argc != 3) help();
     105
     106      cmd_line_ra = atof(argv[1]);
     107      cmd_line_dec = atof(argv[2]);
     108  }
    84109
    85110  return (TRUE);
  • trunk/Ohana/src/getstar/src/dvoImagesAtCoords.c

    r25707 r26288  
    77
    88static int readPoints(char *filename, Point **pointsOut);
     9static int makePoint(double ra, double dec, Point **pointsOut);
    910static int ListImagesAtCoords (Image *dbImages, Point *points, int Npoints);
    1011
     
    2223 
    2324  Point *points;
    24   Npoints = readPoints(argv[1], &points);
     25  if (coordsFile) {
     26      Npoints = readPoints(coordsFile, &points);
     27  } else {
     28      Npoints = makePoint(cmd_line_ra, cmd_line_dec, &points);
     29  }
    2530  if (!Npoints) {
    2631    exit(1);
     
    100105}
    101106
     107static int makePoint(double ra, double dec, Point **pointsOut)
     108{
     109    Point *pts;
     110    ALLOCATE(pts, Point, 1);
     111
     112    pts[0].id = 1;
     113    pts[0].ra = ra;
     114    pts[0].dec = dec;
     115    pts[0].Nmatches = 0;
     116    ALLOCATE(pts[0].matches, int, 20);
     117    pts[0].arrayLength = 20;
     118
     119    *pointsOut = pts;
     120
     121    return 1;
     122}
     123
    102124static int ListImagesAtCoords (Image *dbImages, Point *points, int Npoints)
    103125{
     
    113135        // output of lookup is filename[class_id.hdr] for astrometry files
    114136        char *left_bracket = rindex(dbImages[N].name, '[');
    115         if (left_bracket) {
     137        if (!fullNames && left_bracket) {
    116138            copy = strdup(left_bracket + 1);
    117139            name = copy;
Note: See TracChangeset for help on using the changeset viewer.