IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 5, 2010, 10:04:42 PM (16 years ago)
Author:
eugene
Message:

handle errors in dvo I/O functions; better support for DIS images; merge in high-speed mods from Niall; systematic errors in astrometry (somewhat hackish); add fits I/O option to succeed reading a short file (padding as needed); various kapa improvements (frames consistent in X, PS, PNG; fix tick label signif digits; add function for image overlays; better thick box lines; PNG of the image); bDrawBuffer mods to drop static buffer and refer to passed through buffer; ResizeByImage; DefineSectionByImage; buutos to do png & jpeg; add program roc for raid over cluster; support for mosaic photcodes in dvo image plot; densify; section name [-image x y] : width based on current image; resize -by-image; threaded addstar -resort; threaded dvomerge; dvorepair; dvoverify; dvomerge continue; dvomerge from list (of regions)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/images.c

    r28958 r29938  
    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;
     
    3535
    3636  SOLO_MOSAIC = FALSE;
     37  foundMosaic = NULL;
    3738  if ((N = get_argument (argc, argv, "-mosaic"))) {
    3839    remove_argument (N, &argc, argv);
     
    132133  BuildChipMatch (image, Nimage);
    133134
     135  if (SOLO_MOSAIC && photcode) {
     136    ALLOCATE(foundMosaic, int, Nimage);
     137    memset(foundMosaic, 0, Nimage*sizeof(int));
     138  }
     139
    134140  Rmin = graphmode.coords.crval1 - 180.0;
    135141  Rmax = graphmode.coords.crval1 + 180.0;
     
    137143 
    138144  int DistortImage = wordhash ("-DIS");
     145  int ChipImage    = wordhash ("-WRP");
    139146  int TriangleUp   = wordhash ("TRP-");
    140147  int TriangleDn   = wordhash ("TRM-");
     
    150157    if (ByName && strncmp (image[i].name, name, strlen(name))) continue;
    151158    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;
     159    if (!(Nmosaic = FindMosaicForImage (image, Nimage, i))) continue;
     160    Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1
    153161    if (photcode) {
    154162      if ( photcodeEquiv && (photcode[0].code != GetPhotcodeEquivCodebyCode(image[i].photcode))) continue;
     
    161169
    162170    typehash = wordhash (&image[i].coords.ctype[4]);
     171
     172    if (photcode && SOLO_MOSAIC) {
     173      // mosaic (DIS) images are not currently given a photcode : plot these via the WRP entries
     174      /* DIS images represent a field, not a chip */
     175      if (typehash != ChipImage) continue;
     176      if (foundMosaic[Nmosaic]) continue;
     177      x[0] = -0.5*image[Nmosaic].NX; y[0] = -0.5*image[Nmosaic].NY;
     178      x[1] = +0.5*image[Nmosaic].NX; y[1] = -0.5*image[Nmosaic].NY;
     179      x[2] = +0.5*image[Nmosaic].NX; y[2] = +0.5*image[Nmosaic].NY;
     180      x[3] = -0.5*image[Nmosaic].NX; y[3] = +0.5*image[Nmosaic].NY;
     181      for (j = 0; j < Npts; j++) {
     182        status = XY_to_RD (&r[j], &d[j], x[j], y[j], &image[Nmosaic].coords);
     183        if (!status) break;
     184        r[j] = ohana_normalize_angle (r[j]);
     185        while (r[j] < Rmin) { r[j] += 360.0; }
     186        while (r[j] > Rmax) { r[j] -= 360.0; }
     187        if (j == 0) {
     188          leftside = (r[j] < Rmid);
     189        }
     190        if (j > 0) {
     191          if ( leftside && (r[j] > Rmid + 90)) { r[j] -= 360.0; }
     192          if (!leftside && (r[j] < Rmid - 90)) { r[j] += 360.0; }
     193        }
     194      }
     195      foundMosaic[Nmosaic] = TRUE;
     196      goto plot_points;
     197    }
    163198
    164199    /* DIS images represent a field, not a chip */
     
    270305    if (Npts == 0) continue;
    271306
     307  plot_points:
     308
    272309    status = FALSE;
    273310    for (j = 0; j < Npts; j++) {
     
    320357  free (Yvec.elements.Flt);
    321358  FreeImages (image);
     359  FREE (foundMosaic);
    322360  return (TRUE);
    323361
Note: See TracChangeset for help on using the changeset viewer.