IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 10, 2020, 10:52:25 AM (6 years ago)
Author:
eugene
Message:

csystem: save scalar results to variables; mkgauss: add normalization option; read_vectors: add hms and date conversion options

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

Legend:

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

    r39926 r41305  
    1212  Vector *uxvec = NULL;
    1313  Vector *uyvec = NULL;
     14
     15  int Quiet = FALSE;
     16  if ((N = get_argument (argc, argv, "-q"))) {
     17    Quiet = TRUE;
     18    remove_argument (N, &argc, argv);
     19  }
     20  if ((N = get_argument (argc, argv, "-quiet"))) {
     21    Quiet = TRUE;
     22    remove_argument (N, &argc, argv);
     23  }
    1424
    1525  // transform proper motions at the same time
     
    8494
    8595    if (uXname) {
    86       gprint (GP_LOG, "%10.6f %10.6f @ %10.6f %10.6f\n", x, y, ux, uy);
     96      if (!Quiet) {
     97        gprint (GP_LOG, "%10.6f %10.6f @ %10.6f %10.6f\n", x, y, ux, uy);
     98        switch (output) {
     99          case COORD_CELESTIAL:
     100            set_variable ("uR", ux);
     101            set_variable ("uD", uy);
     102            break;
     103          case COORD_ECLIPTIC:
     104            set_variable ("uL", ux);
     105            set_variable ("uB", uy);
     106            break;
     107          case COORD_GALACTIC:
     108          case COORD_GALACTIC_REID_2004:
     109            set_variable ("uLon", ux);
     110            set_variable ("uLat", uy);
     111            break;
     112          default:
     113            break;
     114        }
     115      }
    87116    } else {
    88       gprint (GP_LOG, "%10.6f %10.6f\n", x, y);
     117      if (!Quiet) {
     118        gprint (GP_LOG, "%10.6f %10.6f\n", x, y);
     119      }
     120    }
     121    switch (output) {
     122      case COORD_CELESTIAL:
     123        set_variable ("RA", x);
     124        set_variable ("DEC", y);
     125        break;
     126      case COORD_ECLIPTIC:
     127        set_variable ("Lambda", x);
     128        set_variable ("Beta", y);
     129        break;
     130      case COORD_GALACTIC:
     131      case COORD_GALACTIC_REID_2004:
     132        set_variable ("gLon", x);
     133        set_variable ("gLat", y);
     134        break;
     135      default:
     136        break;
    89137    }
    90138    free (transform);
     
    154202  gprint (GP_ERR, " e.g.   : csystem C G R D -pm uR uD -> R D will contain glon, glat; uR, uD will contain uL, uB\n");
    155203  gprint (GP_ERR, " e.g.   : csystem C G R D -pmback uL uB -> R D will contain glon, glat; uL, uB will contain uR, uD\n");
     204  gprint (GP_ERR, "        :  if input values are vectors, their values are replaced with the transformed values\n");
     205  gprint (GP_ERR, "        :  if input values are scalars, the transformed coordinates are printed (disable with -q)\n");
     206  gprint (GP_ERR, "        :    and the following output variables will be set (names depend on output system)\n");
     207  gprint (GP_ERR, "        :  output positions (RA, DEC), (Lambda, Beta), (gLon, gLat)\n");
     208  gprint (GP_ERR, "        :  output motions   (uR, uD),  (uL, uB),       (uLon, uLat)\n");
    156209  return FALSE;
    157210}
  • trunk/Ohana/src/opihi/cmd.astro/mkgauss.c

    r26891 r41305  
    1010  double x, y, r, f, Xo, Yo;
    1111  Buffer *buf;
     12
     13  int Normalize = FALSE;
     14  if ((N = get_argument (argc, argv, "-norm"))) {
     15    Normalize = TRUE;
     16    remove_argument (N, &argc, argv);
     17  }   
    1218
    1319  // this should be Nx/2, Ny/2 if not set
     
    6066  /* f = exp (-r), r = (x^2 / 2Sx) + (y^2 / 2Sy) + Sxy*x*y */
    6167
     68  double Io = Normalize ? 1.0 / (2.0 * M_PI * Sig_x * Sig_y) : 1.0;
     69
    6270  in = (float *) buf[0].matrix.buffer;
    6371  for (j = 0; j < Ny; j++) {
     
    6775      y = j - Yo;
    6876      r = 0.5*x*x/Sx + 0.5*y*y/Sy + x*y*Sxy;
    69       f = exp (-r);
     77      f = Io * exp (-r);
    7078      *in += f;
    7179    }
Note: See TracChangeset for help on using the changeset viewer.