IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 7, 2005, 10:21:59 PM (21 years ago)
Author:
eugene
Message:

added mosaic astrometry functions

Location:
trunk/Ohana/src/opihi/cmd.astro
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/coords.c

    r2843 r3393  
    11# include "astro.h"
     2
     3enum {NONE, SKY, PIXEL};
    24
    35int coords (int argc, char **argv) {
     
    57  int mode, N;
    68  double X, Y, R, D;
    7   Coords coords;
    8   Buffer *buf;
     9  char *MOSAIC;
     10  Coords coords, moscoords;
     11  Buffer *buf, *mosbuffer;
    912
    10   mode = 0;
     13  MOSAIC = NULL;
     14  if ((N = get_argument (argc, argv, "-mosaic"))) {
     15    remove_argument (N, &argc, argv);
     16    MOSAIC = strcreate (argv[N]);
     17    remove_argument (N, &argc, argv);
     18  }
     19
     20  mode = NONE;
    1121  if ((N = get_argument (argc, argv, "-p"))) {
    1222    remove_argument (N, &argc, argv);
     
    1525    Y = atof(argv[N]);
    1626    remove_argument (N, &argc, argv);
    17     mode = 1;
     27    mode = SKY;
    1828  }
    1929  if ((N = get_argument (argc, argv, "-c"))) {
    20     if (mode == 1) {
    21       fprintf (stderr, "only one of -p or -c can be used\n");
    22       return (FALSE);
    23     }
     30    if (mode == SKY) goto syntax;
    2431    remove_argument (N, &argc, argv);
    2532    R = atof(argv[N]);
     
    2734    D = atof(argv[N]);
    2835    remove_argument (N, &argc, argv);
    29     mode = 2;
     36    mode = PIXEL;
    3037  }
    31   if ((mode == 0) || (argc != 2)) {
    32     fprintf (stderr, "USAGE: coords [buffer] (-c R D) / (-p X Y)\n");
    33     return (FALSE);
    34   }   
     38  if (mode == NONE) goto syntax;
     39  if (argc != 2) goto syntax;
    3540
    36   if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) return (FALSE);
     41  if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) goto escape;
    3742  GetCoords (&coords, &buf[0].header);
     43  if (strcmp(&coords.ctype[4], "-WRP")) {
     44    if (MOSAIC == NULL) {
     45      fprintf (stderr, "must supply mosaic for WRP coords\n");
     46      return (FALSE);
     47    }
     48    if ((mosbuffer = SelectBuffer (MOSAIC, OLDBUFFER, TRUE)) == NULL) goto escape;
     49    GetCoords (&moscoords, &mosbuffer[0].header);
     50    RegisterMosaic (&moscoords);
     51  }
    3852 
    39   if (mode == 1) {
     53  if (mode == SKY) {
    4054    XY_to_RD (&R, &D, X, Y, &coords);
    4155    fprintf (stderr, "%10.6f %10.6f\n", R, D);
    4256    set_variable ("RA", R);
    4357    set_variable ("DEC", D);
     58    return (TRUE);
    4459  }
    4560   
    46   if (mode == 2) {
     61  if (mode == PIXEL) {
    4762    RD_to_XY (&X, &Y, R, D, &coords);
    4863    fprintf (stderr, "%7.2f %7.2f\n", X, Y);
    4964    set_variable ("Xc", X);
    5065    set_variable ("Yc", Y);
     66    return (TRUE);
    5167  }
     68  return (FALSE);
    5269
    53   return (TRUE);
    54 
     70 syntax:
     71  fprintf (stderr, "USAGE: coords [buffer] (-c R D) / (-p X Y)\n");
     72  fprintf (stderr, "only one of -p or -c can be used\n");
     73 escape:
     74  if (MOSAIC != NULL) free (MOSAIC);
     75  return (FALSE);
    5576}
  • trunk/Ohana/src/opihi/cmd.astro/drizzle.c

    r2843 r3393  
    11# include "astro.h"
     2
     3/*** needs mosaic astrometry ***/
    24
    35static double XO, XX, XY;
Note: See TracChangeset for help on using the changeset viewer.