IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 16, 2020, 1:54:47 PM (6 years ago)
Author:
tdeboer
Message:

revert to working Ohana build

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

Legend:

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

    r41158 r41340  
    3939  }
    4040
    41   int binning = 1;
    42   if ((N = get_argument (argc, argv, "-binning"))) {
    43     remove_argument (N, &argc, argv);
    44     binning = atoi(argv[N]);
    45     remove_argument (N, &argc, argv);
    46   }
    47 
    4841  int PSFTYPE = IS_DOT;
    4942  if ((N = get_argument (argc, argv, "-psf"))) {
     
    8780  Ymax = graphmode.ymax;
    8881  Ymin = graphmode.ymin;
    89 
    90   // (dX, dY) are the pixel scale of the output image (output pixels / input pixels)
    91 
    92   dX = binning * (Xmax - Xmin) / (Xpix - 1);
    93   dY = binning * (Ymax - Ymin) / (Ypix - 1);
     82  dX = (Xmax - Xmin) / (Xpix - 1);
     83  dY = (Ymax - Ymin) / (Ypix - 1);
    9484
    9585  CHECKVAL(Xmin);
  • trunk/Ohana/src/opihi/cmd.astro/cdhistogram.c

    r41158 r41340  
    1313  int kapa;
    1414  Graphdata graphmode;
    15 
    16   int binning = 1;
    17   if ((N = get_argument (argc, argv, "-binning"))) {
    18     remove_argument (N, &argc, argv);
    19     binning = atoi(argv[N]);
    20     remove_argument (N, &argc, argv);
    21   }
    2215
    2316  range = NULL;
     
    8679  Ymax = graphmode.ymax;
    8780  Ymin = graphmode.ymin;
    88 
    89   // (dX, dY) are the pixel scale of the output image (output pixels / input pixels)
    90 
    91   dX = binning * (Xmax - Xmin) / (Xpix - 1);
    92   dY = binning * (Ymax - Ymin) / (Ypix - 1);
     81  dX = (Xmax - Xmin) / (Xpix - 1);
     82  dY = (Ymax - Ymin) / (Ypix - 1);
    9383
    9484  CHECKVAL(Xmin);
     
    10090  CHECKVAL(dY);
    10191
    102   int Nx = abs((Xmax - Xmin) / dX) + 1;
    103   int Ny = abs((Ymax - Ymin) / dY) + 1;
     92  int Nx = (Xmax - Xmin) / dX + 1;
     93  int Ny = (Ymax - Ymin) / dY + 1;
    10494 
    10595  Coords newcoords = graphmode.coords;
  • trunk/Ohana/src/opihi/cmd.astro/cgrid.c

    r41326 r41340  
    8383  Graphdata graphmode;
    8484
    85   if ((N = get_argument (argc, argv, "-h"))) goto usage;
    86   if ((N = get_argument (argc, argv, "--help"))) goto usage;
    87 
    8885  RAbyHour = FALSE;
    8986  if ((N = get_argument (argc, argv, "-ra-by-hour"))) {
     
    118115  }
    119116
    120   int JustifyRA = 8;
    121   int JustifyDEC = 2;
     117  int JustifyRA = 5;
     118  double JustifyDEC = 5;
    122119  if ((N = get_argument (argc, argv, "-justify-ra"))) {
    123120    remove_argument (N, &argc, argv);
     
    154151  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    155152
    156   if (argc != 1) goto usage;
     153  if (argc != 1) {
     154    gprint (GP_ERR, "USAGE: cgrid [style] [-ra-by-hour] [-labels]\n");
     155    return (FALSE);
     156  }
    157157
    158158  /* are we plotting one of the poles? */
     
    182182    }
    183183  }
    184 
    185184 
    186185  /* set spacings for DEC */
     
    346345  return (TRUE);
    347346
    348  usage:
    349 
    350   gprint (GP_ERR, "USAGE: cgrid [style] [options]\n");
    351   gprint (GP_ERR, "  options:\n");
    352   gprint (GP_ERR, "  -h, --help: show this list\n");
    353   gprint (GP_ERR, "  -ra-by-hour : RA grid lines will be space on rounded hour lines (default is degrees)\n");
    354   gprint (GP_ERR, "  -labels : add RA & dec coordinates\n");
    355   gprint (GP_ERR, "  -major-spacing : grid lines drawn at major tickmarks, not minor tickmarks\n");
    356   gprint (GP_ERR, "  -ra-spacing : specify size of RA grid steps in degrees (ignores -ra-by-hour)\n");
    357   gprint (GP_ERR, "  -dec-spacing : specify size of dec grid steps in degrees\n");
    358   gprint (GP_ERR, "  -justify-ra : choose how RA labels are justified (see below)\n");
    359   gprint (GP_ERR, "  -justify-dec : choose how dec labels are justified (see below)\n");
    360   gprint (GP_ERR, "  -label-ra : RA coordinate of the Dec-line labels\n");
    361   gprint (GP_ERR, "  -label-dec : Dec coordinate of the RA-line labels\n");
    362   gprint (GP_ERR, "  -label-color : color for the labels (independent of grid lines)\n");
    363   gprint (GP_ERR, "  text justification: text is justified horizontally and vertically based on the following numbers:\n");
    364   gprint (GP_ERR, "   6 7 8\n");
    365   gprint (GP_ERR, "   3 4 5\n");
    366   gprint (GP_ERR, "   0 1 2\n");
    367   return (FALSE);
    368347}
    369 
  • trunk/Ohana/src/opihi/cmd.astro/csystem.c

    r41305 r41340  
    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   }
    2414
    2515  // transform proper motions at the same time
     
    9484
    9585    if (uXname) {
    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       }
     86      gprint (GP_LOG, "%10.6f %10.6f @ %10.6f %10.6f\n", x, y, ux, uy);
    11687    } else {
    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;
     88      gprint (GP_LOG, "%10.6f %10.6f\n", x, y);
    13789    }
    13890    free (transform);
     
    202154  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");
    203155  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");
    209156  return FALSE;
    210157}
  • trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c

    r41322 r41340  
    1111    remove_argument (N, &argc, argv);
    1212    if ((mvec = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE);
    13     remove_argument (N, &argc, argv);
    14   }
    15 
    16   Vector *WxOutV = NULL; // mask vector
    17   if ((N = get_argument (argc, argv, "-Wxvec"))) {
    18     remove_argument (N, &argc, argv);
    19     if ((WxOutV = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE);
    20     remove_argument (N, &argc, argv);
    21   }
    22   Vector *WyOutV = NULL; // mask vector
    23   if ((N = get_argument (argc, argv, "-Wyvec"))) {
    24     remove_argument (N, &argc, argv);
    25     if ((WyOutV = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE);
    2613    remove_argument (N, &argc, argv);
    2714  }
     
    114101      mask = mvec->elements.Int;
    115102    }
    116   }
    117 
    118   if (WxOutV) {
    119     ResetVector (WxOutV, OPIHI_FLT, Ntotal);
    120     for (i = 0; i < Ntotal; i++) { WxOutV->elements.Flt[i] = NAN; }
    121   }
    122   if (WyOutV) {
    123     ResetVector (WyOutV, OPIHI_FLT, Ntotal);
    124     for (i = 0; i < Ntotal; i++) { WyOutV->elements.Flt[i] = NAN; }
    125103  }
    126104
     
    191169        }
    192170      }
    193     }
    194   }
    195   if (WxOutV) {
    196     // save the calculated weights
    197     for (i = 0; i < fitdata.Npts; i++) {
    198       // fitdata only includes the previously unmasked points
    199       int n = fitdata.index[i];
    200       WxOutV->elements.Flt[n] = fitdata.Wx[i];
    201     }
    202   }
    203   if (WyOutV) {
    204     // save the calculated weights
    205     for (i = 0; i < fitdata.Npts; i++) {
    206       // fitdata only includes the previously unmasked points
    207       int n = fitdata.index[i];
    208       WyOutV->elements.Flt[n] = fitdata.Wy[i];
    209171    }
    210172  }
  • trunk/Ohana/src/opihi/cmd.astro/mkgauss.c

    r41305 r41340  
    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   }   
    1812
    1913  // this should be Nx/2, Ny/2 if not set
     
    6660  /* f = exp (-r), r = (x^2 / 2Sx) + (y^2 / 2Sy) + Sxy*x*y */
    6761
    68   double Io = Normalize ? 1.0 / (2.0 * M_PI * Sig_x * Sig_y) : 1.0;
    69 
    7062  in = (float *) buf[0].matrix.buffer;
    7163  for (j = 0; j < Ny; j++) {
     
    7567      y = j - Yo;
    7668      r = 0.5*x*x/Sx + 0.5*y*y/Sy + x*y*Sxy;
    77       f = Io * exp (-r);
     69      f = exp (-r);
    7870      *in += f;
    7971    }
  • trunk/Ohana/src/opihi/cmd.astro/region.c

    r41158 r41340  
    33int region (int argc, char **argv) {
    44 
    5   double Ra, Dec;
     5  double Ra, Dec, Radius;
    66  float dx, dy;
    77  int N, kapa, NoClear, dXpix, dYpix;
     
    5454  }
    5555
    56   float XSIZE = NAN;
    57   if ((N = get_argument (argc, argv, "-xsize"))) {
    58     remove_argument (N, &argc, argv);
    59     XSIZE = atof (argv[N]);
    60     remove_argument (N, &argc, argv);
    61     if (XSIZE <= 0) {
    62       gprint (GP_ERR, "ERROR: xsize <= 0\n");
    63       return FALSE;
    64     }
    65   }
    66 
    67   float YSIZE = NAN;
    68   if ((N = get_argument (argc, argv, "-ysize"))) {
    69     remove_argument (N, &argc, argv);
    70     YSIZE = atof (argv[N]);
    71     remove_argument (N, &argc, argv);
    72     if (YSIZE <= 0) {
    73       gprint (GP_ERR, "ERROR: xsize <= 0\n");
    74       return FALSE;
    75     }
    76   }
    77 
    7856  if ((N = get_argument (argc, argv, "-ew"))) {
    7957    remove_argument (N, &argc, argv);
     
    10381  }
    10482
    105   int RadiusArg, CtypeArg;
    106   if (!isnan(XSIZE) || !isnan(YSIZE)) {
    107     RadiusArg = -1;
    108     CtypeArg = 3;
    109     if ((argc != 3) && (argc != 4)) {
    110     gprint (GP_ERR, "USAGE: region Ra Dec [projection] [-xsize deg] [-ysize deg]\n");
    111     gprint (GP_ERR, "   OR: region Ra Dec Radius [projection]\n");
     83  if ((argc != 4) && (argc != 5)) {
     84    gprint (GP_ERR, "USAGE: region Ra Dec Radius [projection] [orientation]\n");
    11285    gprint (GP_ERR, "  [-image] [-ew] [+ew] [-ns] [+ns] [-no-clear] [-angle theta]\n");
    11386    gprint (GP_ERR, " current: %f %f (%f x %f) (%s)\n",
     
    11790             &graphmode.coords.ctype[5]);
    11891    return (FALSE);
    119     }
    120   } else {
    121     RadiusArg = 3;
    122     CtypeArg = 4;
    123     if ((argc != 4) && (argc != 5)) {
    124       gprint (GP_ERR, "USAGE: region Ra Dec Radius [projection]\n");
    125       gprint (GP_ERR, "   OR: region Ra Dec [projection] [-xsize deg] [-ysize deg]\n");
    126       gprint (GP_ERR, "  [-image] [-ew] [+ew] [-ns] [+ns] [-no-clear] [-angle theta]\n");
    127       gprint (GP_ERR, " current: %f %f (%f x %f) (%s)\n",
    128               graphmode.coords.crval1, graphmode.coords.crval2,
    129               fabs(graphmode.xmax - graphmode.xmin),
    130               fabs(graphmode.ymax - graphmode.ymin),
    131               &graphmode.coords.ctype[5]);
    132       return (FALSE);
    133     }
    134   } 
     92  }
     93 
    13594  if (!ohana_str_to_radec (&Ra, &Dec, argv[1], argv[2])) return (FALSE);
     95  Radius = atof (argv[3]);
     96  InitCoords (&graphmode.coords, "DEC--TAN");
    13697
    137   // region 0 0 sin -- should raise an error (radius = 0 or non-numeric)
    138 
    139   // I want to be able to support the old style call in which both of these were valid:
    140   // region 0 0 90 ait
    141   // region 0 0 90      <- uses existing, sticky projection type
    142   // but I also want to be able to use
    143   // region 0 0 ait -xsize 5
    144   // region 0 0 ait -ysize 5
    145 
    146   double Radius = NAN;
    147   if (RadiusArg >= 0) {
    148     Radius = atof (argv[RadiusArg]);
     98  if (argc == 5) {
     99    if (!strcasecmp (argv[4], "TAN"))
     100      strcpy (graphmode.coords.ctype, "DEC--TAN");
     101    if (!strcasecmp (argv[4], "SIN"))
     102      strcpy (graphmode.coords.ctype, "DEC--SIN");
     103    if (!strcasecmp (argv[4], "ARC"))
     104      strcpy (graphmode.coords.ctype, "DEC--ARC");
     105    if (!strcasecmp (argv[4], "STG"))
     106      strcpy (graphmode.coords.ctype, "DEC--STG");
     107    if (!strcasecmp (argv[4], "ZEA"))
     108      strcpy (graphmode.coords.ctype, "DEC--ZEA");
     109    if (!strcasecmp (argv[4], "AIT"))
     110      strcpy (graphmode.coords.ctype, "DEC--AIT");
     111    if (!strcasecmp (argv[4], "GLS"))
     112      strcpy (graphmode.coords.ctype, "DEC--GLS");
     113    if (!strcasecmp (argv[4], "PAR"))
     114      strcpy (graphmode.coords.ctype, "DEC--PAR");
    149115  }
    150 
    151   InitCoords (&graphmode.coords, "DEC--TAN");
    152   if (argc == CtypeArg + 1) {
    153     if (!strcasecmp (argv[CtypeArg], "TAN")) { strcpy (graphmode.coords.ctype, "DEC--TAN"); goto got_ctype; }
    154     if (!strcasecmp (argv[CtypeArg], "SIN")) { strcpy (graphmode.coords.ctype, "DEC--SIN"); goto got_ctype; }
    155     if (!strcasecmp (argv[CtypeArg], "ARC")) { strcpy (graphmode.coords.ctype, "DEC--ARC"); goto got_ctype; }
    156     if (!strcasecmp (argv[CtypeArg], "STG")) { strcpy (graphmode.coords.ctype, "DEC--STG"); goto got_ctype; }
    157     if (!strcasecmp (argv[CtypeArg], "ZEA")) { strcpy (graphmode.coords.ctype, "DEC--ZEA"); goto got_ctype; }
    158     if (!strcasecmp (argv[CtypeArg], "AIT")) { strcpy (graphmode.coords.ctype, "DEC--AIT"); goto got_ctype; }
    159     if (!strcasecmp (argv[CtypeArg], "GLS")) { strcpy (graphmode.coords.ctype, "DEC--GLS"); goto got_ctype; }
    160     if (!strcasecmp (argv[CtypeArg], "PAR")) { strcpy (graphmode.coords.ctype, "DEC--PAR"); goto got_ctype; }
    161     gprint (GP_ERR, "ERROR: invalid projection type %s\n", argv[CtypeArg]);
    162     gprint (GP_ERR, "allowed values: TAN, SIN, ARC, STG, ZEA, AIT, GLS, PAR\n");
    163     return FALSE;
    164   }
    165 got_ctype:
    166116 
    167117  graphmode.coords.crval1 = Ra;
     
    176126  graphmode.coords.pc2_2 =  cos(Angle*RAD_DEG)*pc2_2;
    177127
    178   // ask kapa for coordinate limits, to get the right aspect ratio
    179   // dx, dy are the size of the graph region in pixels
     128  /* ask kapa for coordinate limits, to get the right aspect ratio */
    180129  KapaGetLimits (kapa, &dx, &dy);
    181130  dx = fabs (dx);
     
    183132
    184133  /* define limits for Ra, Dec at center, grid in degrees */
    185   if (RadiusArg >= 0) {
    186     // force non-anamorphic projection with Radius set to smaller axis
    187     if (dy < dx) {
    188       graphmode.xmin = -(dx/dy)*Radius;
    189       graphmode.ymin = -Radius;
    190       graphmode.xmax = (dx/dy)*Radius;
    191       graphmode.ymax = Radius;
    192     } else {
    193       graphmode.xmin = -Radius;
    194       graphmode.ymin = -(dy/dx)*Radius;
    195       graphmode.xmax = Radius;
    196       graphmode.ymax = (dy/dx)*Radius;
    197     }
     134  if (dy < dx) {
     135    graphmode.xmin = -(dx/dy)*Radius;
     136    graphmode.ymin = -Radius;
     137    graphmode.xmax = (dx/dy)*Radius;
     138    graphmode.ymax = Radius;
    198139  } else {
    199     if (isnan(XSIZE)) {
    200       graphmode.xmin = -(dx/dy)*YSIZE/2.0;
    201       graphmode.ymin = -YSIZE/2.0;
    202       graphmode.xmax = (dx/dy)*YSIZE/2.0;
    203       graphmode.ymax = YSIZE/2.0;
    204     }
    205     if (isnan(YSIZE)) {
    206       graphmode.xmin = -XSIZE/2.0;
    207       graphmode.ymin = -(dy/dx)*XSIZE/2.0;
    208       graphmode.xmax = XSIZE/2.0;
    209       graphmode.ymax = (dy/dx)*XSIZE/2.0;
    210     }
    211     // anamorphic projection:
    212     if (!isnan(XSIZE) && !isnan(YSIZE)) {
    213       graphmode.xmin = -XSIZE/2.0;
    214       graphmode.ymin = -YSIZE/2.0;
    215       graphmode.xmax =  XSIZE/2.0;
    216       graphmode.ymax =  YSIZE/2.0;
    217     }
    218   }
     140    graphmode.xmin = -Radius;
     141    graphmode.ymin = -(dy/dx)*Radius;
     142    graphmode.xmax = Radius;
     143    graphmode.ymax = (dy/dx)*Radius;
     144  }
    219145
    220146  set_variable ("XMIN", graphmode.xmin);
Note: See TracChangeset for help on using the changeset viewer.