IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 14, 2010, 4:02:44 PM (16 years ago)
Author:
eugene
Message:

updates to dvorepair; add ability to plot mosaics by photcode (requires FindMosaicForImage to return the mosaic sequence number)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101103/Ohana/src/opihi/dvo/images.c

    r28958 r29779  
    1111int images (int argc, char **argv) {
    1212
    13   off_t i, Nimage;
     13  off_t i, Nimage, Nmosaic;
    1414  int j, status, InPic, leftside, *plist, TimeSelect, ByName;
    1515  int WITH_MOSAIC, SOLO_MOSAIC, HIDDEN;
    1616  time_t tzero, tend;
    17   int N, NPTS, n, npts, Npts, kapa;
     17  int N, NPTS, n, npts, Npts, kapa, *foundMosaic;
    1818  Vector Xvec, Yvec;
    1919  double r[8], d[8], x[8], y[8], Rmin, Rmax, Rmid, trange, Radius;
     
    132132  BuildChipMatch (image, Nimage);
    133133
     134  if (SOLO_MOSAIC && photcode) {
     135    ALLOCATE(foundMosaic, int, Nimage);
     136    memset(foundMosaic, 0, Nimage*sizeof(int));
     137  }
     138
    134139  Rmin = graphmode.coords.crval1 - 180.0;
    135140  Rmax = graphmode.coords.crval1 + 180.0;
     
    137142 
    138143  int DistortImage = wordhash ("-DIS");
     144  int ChipImage    = wordhash ("-WRP");
    139145  int TriangleUp   = wordhash ("TRP-");
    140146  int TriangleDn   = wordhash ("TRM-");
     
    150156    if (ByName && strncmp (image[i].name, name, strlen(name))) continue;
    151157    if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue;
    152     if (!FindMosaicForImage (image, Nimage, i)) continue;
     158    if (!(Nmosaic = FindMosaicForImage (image, Nimage, i))) continue;
     159    Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1
    153160    if (photcode) {
    154161      if ( photcodeEquiv && (photcode[0].code != GetPhotcodeEquivCodebyCode(image[i].photcode))) continue;
     
    161168
    162169    typehash = wordhash (&image[i].coords.ctype[4]);
     170
     171    if (photcode && SOLO_MOSAIC) {
     172      // mosaic (DIS) images are not currently given a photcode : plot these via the WRP entries
     173      /* DIS images represent a field, not a chip */
     174      if (typehash != ChipImage) continue;
     175      if (foundMosaic[Nmosaic]) continue;
     176      x[0] = -0.5*image[Nmosaic].NX; y[0] = -0.5*image[Nmosaic].NY;
     177      x[1] = +0.5*image[Nmosaic].NX; y[1] = -0.5*image[Nmosaic].NY;
     178      x[2] = +0.5*image[Nmosaic].NX; y[2] = +0.5*image[Nmosaic].NY;
     179      x[3] = -0.5*image[Nmosaic].NX; y[3] = +0.5*image[Nmosaic].NY;
     180      for (j = 0; j < Npts; j++) {
     181        status = XY_to_RD (&r[j], &d[j], x[j], y[j], &image[Nmosaic].coords);
     182        if (!status) break;
     183        r[j] = ohana_normalize_angle (r[j]);
     184        while (r[j] < Rmin) { r[j] += 360.0; }
     185        while (r[j] > Rmax) { r[j] -= 360.0; }
     186        if (j == 0) {
     187          leftside = (r[j] < Rmid);
     188        }
     189        if (j > 0) {
     190          if ( leftside && (r[j] > Rmid + 90)) { r[j] -= 360.0; }
     191          if (!leftside && (r[j] < Rmid - 90)) { r[j] += 360.0; }
     192        }
     193      }
     194      foundMosaic[Nmosaic] = TRUE;
     195      goto plot_points;
     196    }
    163197
    164198    /* DIS images represent a field, not a chip */
     
    270304    if (Npts == 0) continue;
    271305
     306  plot_points:
     307
    272308    status = FALSE;
    273309    for (j = 0; j < Npts; j++) {
     
    320356  free (Yvec.elements.Flt);
    321357  FreeImages (image);
     358  free (foundMosaic);
    322359  return (TRUE);
    323360
Note: See TracChangeset for help on using the changeset viewer.