IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31536


Ignore:
Timestamp:
May 12, 2011, 9:43:31 AM (15 years ago)
Author:
eugene
Message:

fix czplot 0,360 wrap around

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110505/Ohana/src/opihi/cmd.astro/czplot.c

    r20936 r31536  
    33int czplot (int argc, char **argv) {
    44 
    5   int i, kapa;
     5  int i, kapa, Npts, status;
    66  double min, range, Rmin, Rmax;
    77  opihi_flt *out, *r, *d, *x, *y;
     
    1818  min = atof(argv[4]);
    1919  range = atof(argv[5]) - min;
    20   Rmin = graphmode.coords.crval1 - 180.0;
    21   Rmax = graphmode.coords.crval1 + 180.0;
     20  Rmin = graphmode.coords.crval1 - 182.0;
     21  Rmax = graphmode.coords.crval1 + 182.0;
    2222
    2323  /* find vectors */
     
    4646  x   = Xvec.elements.Flt;
    4747  y   = Yvec.elements.Flt;
    48   for (i = 0; i < Zvec.Nelements; i++, r++, d++, x++, y++) {
     48  out = Zvec.elements.Flt;
     49
     50  Npts = 0;
     51  for (i = 0; i < xvec[0].Nelements; i++, r++, d++) {
    4952    *r = ohana_normalize_angle (*r);
    50     RD_to_XY (x, y, *r, *d, &graphmode.coords);
     53    while (*r < Rmin) *r += 360.0;
     54    while (*r > Rmax) *r -= 360.0;
     55
     56    status = RD_to_XY (x, y, *r, *d, &graphmode.coords);
     57    if (!status) continue;
     58
     59    if (zvec->type == OPIHI_FLT) {
     60      opihi_flt *in  = zvec[0].elements.Flt;
     61      *out = MIN (1.0, MAX (0.01, (in[i] - min) / range));
     62    } else {
     63      opihi_int *in  = zvec[0].elements.Int;
     64      *out = MIN (1.0, MAX (0.01, (in[i] - min) / range));
     65    }
     66    x++;
     67    y++;
     68    out++;
     69    Npts++;
    5170  }
    52 
    53   out = Zvec.elements.Flt;
    54   if (zvec->type == OPIHI_FLT) {
    55     opihi_flt *in  = zvec[0].elements.Flt;
    56     for (i = 0; i < Zvec.Nelements; i++, in++, out++) {
    57       *out = MIN (1.0, MAX (0.01, (*in - min) / range));
    58     }
    59   } else {
    60     opihi_int *in  = zvec[0].elements.Int;
    61     for (i = 0; i < Zvec.Nelements; i++, in++, out++) {
    62       *out = MIN (1.0, MAX (0.01, (*in - min) / range));
    63     }
    64   }
     71  Xvec.Nelements = Npts;
     72  Yvec.Nelements = Npts;
     73  Zvec.Nelements = Npts;
    6574
    6675  graphmode.style = 2;
Note: See TracChangeset for help on using the changeset viewer.