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)

Location:
trunk/Ohana/src/opihi
Files:
11 edited
1 copied

Legend:

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

    r27435 r29938  
    5555  if ((argc != 4) && (argc != 5)) {
    5656    gprint (GP_ERR, "USAGE: region Ra Dec Radius [projection] [orientation]\n");
     57    gprint (GP_ERR, "  [-image] [-ew] [+ew] [-ns] [+ns] [-no-clear]\n");
    5758    gprint (GP_ERR, " current: %f %f (%f x %f) (%s)\n",
    5859             graphmode.coords.crval1, graphmode.coords.crval2,
  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r29540 r29938  
    3636$(SRC)/cut.$(ARCH).o            \
    3737$(SRC)/delete.$(ARCH).o \
     38$(SRC)/densify.$(ARCH).o        \
    3839$(SRC)/device.$(ARCH).o \
    3940$(SRC)/dimendown.$(ARCH).o      \
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r29540 r29938  
    2525int dbselect         PROTO((int, char **));
    2626int delete           PROTO((int, char **));
     27int densify          PROTO((int, char **));
    2728int device           PROTO((int, char **));
    2829int dimendown        PROTO((int, char **));
     
    161162  {1, "dbselect",     dbselect,         "extract vectors from mysql database table"},
    162163  {1, "delete",       delete,           "delete vectors or images"},
     164  {1, "densify",      densify,          "create an image histogram from a set of vectors"},
    163165  {1, "device",       device,           "set / get current graphics device"},
    164166  {1, "dimendown",    dimendown,        "convert image to vector"},
  • trunk/Ohana/src/opihi/cmd.data/rd.c

    r28241 r29938  
    184184    ftable.header[0].buffer = NULL;
    185185    gfits_copy_header (&buf[0].header, ftable.header);
    186     status = gfits_fread_ftable_data (f, &ftable);  // this just reads the bytes (not even a SWAP)
     186    status = gfits_fread_ftable_data (f, &ftable, FALSE);  // this just reads the bytes (not even a SWAP)
    187187    status = gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable);
    188188    // uncompressing the image leaves the format as an extension
  • trunk/Ohana/src/opihi/cmd.data/read_vectors.c

    r29540 r29938  
    160160
    161161  off_t Nbytes;
    162   int i, j, k, N, Nextend, Ny, Binary, vecType;
     162  int i, j, k, N, Nextend, Ny, Binary, vecType, padIfShort;
    163163  char type[16], ID[80], *CCDKeyword;
    164164  FTable table;
     
    174174    CCDKeyword = strcreate (argv[N]);
    175175    remove_argument (N, &argc, argv);
     176  }
     177
     178  padIfShort = FALSE;
     179  if ((N = get_argument (argc, argv, "-pad-if-short"))) {
     180    remove_argument (N, &argc, argv);
     181    padIfShort = TRUE;
    176182  }
    177183
     
    205211    }
    206212    if (!gfits_load_header (f, &header)) ESCAPE ("error reading header for extension");
    207     if (!gfits_fread_ftable_data (f, &table)) ESCAPE ("error reading table for extension");
     213    if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension");
    208214
    209215  } else {
     
    236242        continue;
    237243      }
    238       if (!gfits_fread_ftable_data (f, &table)) ESCAPE ("error reading table for extension");
     244      if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension");
    239245      break;
    240246    }
  • trunk/Ohana/src/opihi/cmd.data/resize.c

    r13479 r29938  
    1717  if (!GetImage (NULL, &kapa, name)) return (FALSE);
    1818  FREE (name);
     19
     20  if ((N = get_argument (argc, argv, "-by-image"))) {
     21    remove_argument (N, &argc, argv);
     22    KiiResizeByImage (kapa);
     23    return (TRUE);
     24  }
    1925
    2026  if (argc != 3) {
  • trunk/Ohana/src/opihi/cmd.data/section.c

    r27790 r29938  
    11# include "data.h"
    22
    3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL, BG};
     3enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL, BG, IMAGE};
    44
    55int section (int argc, char **argv) {
     
    4949    remove_argument (N, &argc, argv);
    5050    action = BG;
     51  }
     52
     53  if ((N = get_argument (argc, argv, "-image"))) {
     54    remove_argument (N, &argc, argv);
     55    action = IMAGE;
    5156  }
    5257
     
    130135  }
    131136 
     137  if (argc == 4) {
     138    /* set section */
     139    section.name = argv[1];
     140    section.x = atof (argv[2]);
     141    section.y = atof (argv[3]);
     142    section.bg = background;
     143    KapaSetSectionByImage (kapa, &section);
     144    return (TRUE);
     145  }
     146
    132147  if (argc == 6) {
    133148    /* set section */
     
    142157  }
    143158  gprint (GP_ERR, "USAGE: section name [x y dx dy]\n");
     159  gprint (GP_ERR, "USAGE: section name [-image x y] : width based on current image\n");
    144160  gprint (GP_ERR, "USAGE: section name [-list] [-up] [-down] [-top] [-bottom]\n");
    145161  return (FALSE);
  • trunk/Ohana/src/opihi/cmd.data/vgauss.c

    r29001 r29938  
    4545  CastVector (yvec, OPIHI_FLT);
    4646  CastVector (svec, OPIHI_FLT);
     47  // XXX Cast is failing.
     48   
    4749
    4850  Npts = xvec[0].Nelements;
  • 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
  • trunk/Ohana/src/opihi/dvo/imlist.c

    r29540 r29938  
    104104      XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
    105105    }
    106     gprint (GP_LOG, "%3lld %s %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n",
    107             (long long) i, image[i].name, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal);
     106    gprint (GP_LOG, "%3lld %s %8lld %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n",
     107            (long long) i, image[i].name, (long long) image[i].imageID, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal);
    108108  }
    109109
  • trunk/Ohana/src/opihi/lib.data/starfuncs.c

    r20936 r29938  
    55  double *ring;
    66  double x, y, x2, y2, xy, I, sky, FWHMx, FWHMy, value, mag, Sxy;
    7   int i, j, n, Npix2, Nring, Nmax;
     7  int i, j, n, Radius, Nring, Nmax;
    88  double Npts, gain, dsky2, dmag, peak, offset;
    99  char *string;
     
    1919  Nborder = MIN (1000, Nborder);
    2020 
    21   Npix2 = (int)(0.5*Npix);
    22   Npix = 2 * Npix2 + 1;
     21  Radius = (int)(0.5*Npix);
     22  Npix = 2 * Radius + 1;
    2323  Nring = 4*Nborder*(Nborder + Npix);
    2424  ALLOCATE (ring, double, Nring);
     
    2727  n = 0; 
    2828  for (j = 0; j < Nborder; j++) {
    29     for (i = X - Npix2 - Nborder; i < X + Npix2 + Nborder + 1; i++, n+=2) {
    30       ring[n]   = gfits_get_matrix_value (matrix, i, (int)(Y - Npix2 - j));
    31       ring[n+1] = gfits_get_matrix_value (matrix, i, (int)(Y + Npix2 + j));
    32     }
    33     for (i = Y - Npix2; i < Y + Npix2 + 1; i++, n+=2) {
    34       ring[n]   = gfits_get_matrix_value (matrix, (int)(X - Npix2 - j), i);
    35       ring[n+1] = gfits_get_matrix_value (matrix, (int)(X + Npix2 + j), i);
     29    for (i = X - Radius - Nborder; i < X + Radius + Nborder + 1; i++, n+=2) {
     30      ring[n]   = gfits_get_matrix_value (matrix, i, (int)(Y - Radius - j));
     31      ring[n+1] = gfits_get_matrix_value (matrix, i, (int)(Y + Radius + j));
     32    }
     33    for (i = Y - Radius; i < Y + Radius + 1; i++, n+=2) {
     34      ring[n]   = gfits_get_matrix_value (matrix, (int)(X - Radius - j), i);
     35      ring[n+1] = gfits_get_matrix_value (matrix, (int)(X + Radius + j), i);
    3636    }
    3737  }
     
    5050  Npts = Nmax = 0;
    5151  x = y = x2 = y2 = xy = I = 0;
    52   for (i = X - Npix2; i < X + Npix2 + 1; i++) {
    53     for (j = Y - Npix2; j < Y + Npix2 + 1; j++) {
     52  for (i = X - Radius; i < X + Radius + 1; i++) {
     53    for (j = Y - Radius; j < Y + Radius + 1; j++) {
     54      if (hypot((i-X), (j-Y)) > Radius) continue;
    5455      value = gfits_get_matrix_value (matrix, i, j);
    5556      offset = value - sky;
     
    9293  set_variable ("Zpk", peak);
    9394  set_int_variable ("Nsat", Nmax);
     95  set_int_variable ("Npts", Npts);
    9496 
    9597  gprint (GP_LOG, "%f %f %f %f %f %f %f %f\n", x, y, FWHMx, FWHMy, sky, I, mag, dmag);
Note: See TracChangeset for help on using the changeset viewer.