IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 20, 2010, 12:05:07 PM (16 years ago)
Author:
eugene
Message:

optimizations for dvomerge and relastro; complete checks of db I/O success; fix overloaded image flags

Location:
trunk/Ohana
Files:
19 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

    • Property svn:mergeinfo deleted
  • trunk/Ohana/src/relastro/Makefile

    r28184 r29001  
    5858$(SRC)/CoordOps.$(ARCH).o            \
    5959$(SRC)/FixProblemImages.$(ARCH).o    \
     60$(SRC)/StarMaps.$(ARCH).o    \
    6061$(SRC)/high_speed_catalogs.$(ARCH).o  \
    6162$(SRC)/high_speed_objects.$(ARCH).o  \
  • trunk/Ohana/src/relastro/doc/notes.txt

    r27435 r29001  
     1
     22010.07.15
     3
     4  Some issues:
     5
     6  * when I apply the fitted image parameters (UpdateObjectOffsets), I
     7    currently check for good/bad fits and warn if the image is bad.
     8    But the correction requires multiple re-loads of the catalog
     9    tables.
     10
     11  * I would like to check for bad fits by defining a grid of test
     12    points and seeing how much they move.  However, for some chips,
     13    the region of valid data is much smaller than the regino with any
     14    data. 
     15
     16  * I would like to define a grid (say, Nx * Ny with Nx >> polynomial
     17    order) and only use those grid regions in testing the solution
     18
     19  * This means knowing which detections belong on a specific image.
     20    I'm not sure if there is a good way to do this.  at the moment, it
     21    is easy to do detection -> image, but not so easy to do
     22    image->detection.
     23
     24  * That might argue for generating the grid for each image, then
     25    running through all detections and, as detections are examined,
     26    populate the grid elements for their own image.
    127
    2282010.03.24
  • trunk/Ohana/src/relastro/include/relastro.h

    r28184 r29001  
    33# include <kapa.h>
    44# include <signal.h>
     5# include <assert.h>
    56
    67typedef enum {
     
    7677  int    Nmeas;
    7778} StatType;
     79
     80# define MARKTIME(MSG,...) { \
     81  float dtime; \
     82  gettimeofday (&stop, (void *) NULL); \
     83  dtime = DTIME (stop, start); \
     84  fprintf (stderr, MSG, __VA_ARGS__); }
    7885
    7986/* global variables set in parameter file */
     
    145152int DoUpdateChips;
    146153int DoUpdateMosaics;
     154
     155// StarMap parameters:
     156int NX_MAP;
     157int NY_MAP;
     158double DPOS_MAX;
     159double ADDSTAR_RADIUS;
    147160
    148161/*** relphot prototypes ***/
     
    207220void create_image_db (FITS_DB *db);
    208221void save_catalogs (Catalog *catalog, int Ncatalog);
     222
     223int reload_images (FITS_DB *db);
    209224
    210225int           main                PROTO((int argc, char **argv));
     
    267282double **poly2d_copy (double **poly, int Nx, int Ny);
    268283double poly2d_eval (double **poly, int Nx, int Ny, double x, double y);
    269 int fit_apply_coords (CoordFit *fit, Coords *coords);
     284int fit_apply_coords (CoordFit *fit, Coords *coords, int keepRef);
    270285int CoordsGetCenter (CoordFit *fit, double tol, double *xo, double *yo);
    271286CoordFit *CoordsSetCenter (CoordFit *input, double Xo, double Yo);
    272 int FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords);
     287int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image);
    273288void FitMosaic (StarData *raw, StarData *ref, int Nmatch, Coords *coords);
    274289void FitSimple (StarData *raw, StarData *ref, int Nmatch, Coords *coords);
     
    293308StarData *getImageRef (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode);
    294309StarData *getImageRaw (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode);
     310off_t getImageByID (off_t ID);
    295311
    296312Mosaic *getmosaics (off_t *N);
     
    331347int high_speed_objects (SkyRegion *region, Catalog *catalog);
    332348int MeasMatchesPhotcode(Measure *measure, PhotCode **photcodeSet, int Nset);
     349
     350int initStarMaps ();
     351int updateStarMaps(Catalog *catalog);
     352int createStarMapPoints();
     353int checkStarMap(int N);
  • trunk/Ohana/src/relastro/src/ConfigInit.c

    r25757 r29001  
    3232  GetConfig (config, "PM_TOOFEW",              "%d",  0, &PM_TOOFEW);
    3333  GetConfig (config, "POS_TOOFEW",             "%d",  0, &POS_TOOFEW);
     34
     35  GetConfig (config, "RELASTRO_MAP_NX",        "%d",  0, &NX_MAP);
     36  GetConfig (config, "RELASTRO_MAP_NY",        "%d",  0, &NY_MAP);
     37  GetConfig (config, "RELASTRO_DPOS_MAX",      "%lf", 0, &DPOS_MAX);
     38  GetConfig (config, "ADDSTAR_RADIUS",         "%lf", 0, &ADDSTAR_RADIUS);
    3439
    3540  GetConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
  • trunk/Ohana/src/relastro/src/FitChip.c

    r27581 r29001  
    33
    44// XXX make these user parameters
    5 # define FIT_CHIP_MAX_ERROR 0.05
    65# define FIT_CHIP_NITER     3
    76# define FIT_CHIP_NSIGMA    3.0
    8 
    9 
    10 // XXX we should test if the fit is sufficiently constrained across the chip, or if the
    11 // new positions deviate too much from the old positions
    12 
    13 // XXX add visualization tools: per chip residual plots
    147
    158// XXX save the fit[0].Npts value in the image table?
     
    1710// XXX save measurements of the fit quality (scatter, chisq) in the image table
    1811
    19 int FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords) {
     12int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image) {
    2013
    2114  int i, Nscatter, Niter, skip;
     
    2922    for (i = Nscatter = 0; i < Nmatch; i++) {
    3023      if (raw[i].mask) continue;
    31       if (isnan(raw[i].dMag) || raw[i].dMag > FIT_CHIP_MAX_ERROR) continue;
     24      if (isnan(raw[i].dMag) || raw[i].dMag > SIGMA_LIM) continue;
    3225
    3326      dL = raw[i].L - ref[i].L;
     
    3932    }
    4033
    41     // for a 2D Gaussian, 40% of the points are within 1 sigma; dRmax is ~ 3 sigma
    42     dsort (values, Nscatter);
    43     dRmax = FIT_CHIP_NSIGMA*values[(int)(0.40*Nscatter)];
    44     relastroVisualPlotScatter(values, dRmax, Nscatter);
    45     relastroVisualPlotRawRef(raw, ref, dRmax, Nmatch);
     34    if (Nscatter > 5) {
     35      // for a 2D Gaussian, 40% of the points are within 1 sigma; dRmax is ~ 3 sigma
     36      // XXX this test is not sensible for Nscatter < XXX (5?)
     37      dsort (values, Nscatter);
     38      dRmax = FIT_CHIP_NSIGMA*values[(int)(0.40*Nscatter)];
     39      relastroVisualPlotScatter(values, dRmax, Nscatter);
     40      relastroVisualPlotRawRef(raw, ref, dRmax, Nmatch);
     41    } else {
     42      dRmax = 0;
     43    }
    4644
    4745    // fit the requested order polynomial
    4846    if (CHIPORDER > 0) {
    49       coords[0].Npolyterms = CHIPORDER;
     47      image[0].coords.Npolyterms = CHIPORDER;
    5048    }
    51     fit = fit_init (coords[0].Npolyterms);
     49    fit = fit_init (image[0].coords.Npolyterms);
    5250
    5351    // generate the fit matches
     
    5654        continue;
    5755      }
    58       if (isnan(raw[i].dMag) || raw[i].dMag > FIT_CHIP_MAX_ERROR) {
     56      if (isnan(raw[i].dMag) || raw[i].dMag > SIGMA_LIM) {
    5957        continue;
    6058      }
     
    6462      dM = raw[i].M - ref[i].M;
    6563      dR = hypot (dL, dM);
    66       if (dR > dRmax) continue;
     64
     65      // fprintf (stderr, "fit %f %f -> %f %f : %f %f (%f vs %f) wt: %f\n", raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].L, raw[i].M, dR, dRmax, raw[i].dPos);
     66
     67      if ((dRmax > 0.0) && (dR > dRmax)) continue;
    6768
    6869      fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos);
     
    7172    // check if the fit has enough data points for the polynomial order
    7273    skip = FALSE;
    73     switch (coords[0].Npolyterms) {
     74    switch (image[0].coords.Npolyterms) {
    7475      case 0:
    7576      case 1:
     
    8384        break;
    8485      default:
    85         fprintf (stderr, "invalid chip order %d\n", coords[0].Npolyterms);
     86        fprintf (stderr, "invalid chip order %d\n", image[0].coords.Npolyterms);
    8687        skip = TRUE;
    8788    }
    8889    if (skip) {
    89       fprintf (stderr, "insufficient measurements (%d) for requested order (%d)\n", fit[0].Npts, coords[0].Npolyterms);
     90      if (VERBOSE) fprintf (stderr, "insufficient measurements (%d) for requested order (%d)\n", fit[0].Npts, image[0].coords.Npolyterms);
    9091      fit_free (fit);
    9192      free (values);
     93      image[0].flags |= ID_IMAGE_ASTROM_FEW;
    9294      return FALSE;
    9395    }
     
    98100    if (!fit_eval (fit)) {
    99101      fprintf (stderr, "failed to fit new model\n");
     102      image[0].flags |= ID_IMAGE_ASTROM_FAIL;
    100103      return FALSE;
    101104    }
    102105
    103     if (!fit_apply_coords (fit, coords)) {
     106    if (!fit_apply_coords (fit, &image[0].coords, FALSE)) {
    104107      fprintf (stderr, "failed to fit new model\n");
     108      image[0].flags |= ID_IMAGE_ASTROM_FAIL;
    105109      return FALSE;
    106110    }
     
    109113
    110114    for (i = 0; i < Nmatch; i++) {
    111       XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, coords);
     115      XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[0].coords);
    112116    }
    113117
  • trunk/Ohana/src/relastro/src/FitMosaic.c

    r16810 r29001  
    2626  }
    2727  fit_eval (fit);
    28   fit_apply_coords (fit, coords);
     28  fit_apply_coords (fit, coords, TRUE);
    2929  fit_free (fit);
    3030
  • trunk/Ohana/src/relastro/src/FitSimple.c

    r27435 r29001  
    2626  }
    2727  fit_eval (fit);
    28   fit_apply_coords (fit, coords);
     28  fit_apply_coords (fit, coords, TRUE);
    2929  fit_free (fit);
    3030
  • trunk/Ohana/src/relastro/src/ImageOps.c

    r28241 r29001  
    319319}
    320320
     321void dump_measures(Average *average, Measure *measure) {
     322
     323  off_t j, off;
     324
     325  for (j = 0; j < average[0].Nmeasure; j++) {
     326    off = average[0].measureOffset + j;
     327    fprintf (stderr, "%f, %f\n", measure[off].dR, measure[off].dD);
     328  }
     329  return;
     330}
     331
    321332// return StarData values for detections in the specified image, converting coordinates from the
    322333// chip positions: X,Y -> L,M -> P,Q -> R,D
     
    325336  off_t i, m, c, n, nPos;
    326337  double X, Y, L, M, P, Q, R, D, dR, dD;
    327   double dPos;
     338  double dPos, DPOS_MAX_ASEC;
    328339
    329340  Mosaic *mosaic;
     
    341352  }
    342353  imcoords = &image[im].coords;
     354
     355  if (moscoords) {
     356    DPOS_MAX_ASEC = 3600.0*DPOS_MAX*hypot(moscoords[0].cdelt1, moscoords[0].cdelt2);
     357  } else {
     358    DPOS_MAX_ASEC = 3600.0*DPOS_MAX*hypot(imcoords[0].cdelt1, imcoords[0].cdelt2);
     359  }
    343360
    344361  // accumulate the rms position offsets.  if this value, or any specific entry, is too
     
    372389
    373390    // complain if the new location is far from the average location
    374     if (fabs(dR) > 2.0) {
    375       fprintf (stderr, "!");
    376       setBadCoords (im); // report a failure for this image
    377       return;
    378     }
    379     if (fabs(dD) > 2.0) {
    380       fprintf (stderr, "*");
    381       setBadCoords (im); // report a failure for this image
    382       return;
     391    // NOTE: This should never happen, or our StarMap tests are not working
     392    if (fabs(dR) > 1.5*ADDSTAR_RADIUS) {
     393      fprintf (stderr, "measurement is far from average location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
     394      dump_measures (&catalog[c].average[n], catalog[c].measure);
     395      // abort ();
     396    }
     397    if (fabs(dD) > 1.5*ADDSTAR_RADIUS) {
     398      fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
     399      dump_measures (&catalog[c].average[n], catalog[c].measure);
     400      // abort ();
    383401    }
    384402
    385403    // complain if the new location is far from the old location
    386     if (fabs(catalog[c].measure[m].dR - dR) > 2.0) {
    387       fprintf (stderr, "@");
    388       setBadCoords (im); // report a failure for this image
    389       return;
    390     }
    391     if (fabs(catalog[c].measure[m].dD - dD) > 2.0) {
    392       fprintf (stderr, "#");
    393       setBadCoords (im); // report a failure for this image
    394       return;
     404    if (fabs(catalog[c].measure[m].dR - dR) > DPOS_MAX_ASEC) {
     405      fprintf (stderr, "measurement is far from original location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
     406      dump_measures (&catalog[c].average[n], catalog[c].measure);
     407      // abort();
     408    }
     409    if (fabs(catalog[c].measure[m].dD - dD) > DPOS_MAX_ASEC) {
     410      fprintf (stderr, "measurement is far from original location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
     411      dump_measures (&catalog[c].average[n], catalog[c].measure);
     412      // abort();
    395413    }
    396414
     
    414432
    415433  saveOffsets (dPos, nPos, im);
     434
     435  // XXX this function should probably update the average positions as well.
    416436
    417437  return;
  • trunk/Ohana/src/relastro/src/UpdateChips.c

    r28241 r29001  
    3131    // FitChip does iterative, clipped fitting
    3232    // fprintf (stderr, "image "OFF_T_FMT" : Nstars: "OFF_T_FMT"\n",  i,  Nraw);
    33     if (!FitChip (raw, ref, Nraw, &image[i].coords)) {
    34       fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name,  i,  Nraw);
     33    if (!FitChip (raw, ref, Nraw, &image[i])) {
     34      if (VERBOSE) fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name,  i,  Nraw);
    3535      oldCoords = getCoords (i);
    3636      memcpy (&image[i].coords, oldCoords, sizeof(Coords));
     37      free (raw);
     38      free (ref);
     39      continue;
     40    }
     41
     42    if (!checkStarMap (i)) {
     43      if (VERBOSE) fprintf (stderr, "fit diverges too much for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name,  i,  Nraw);
     44      oldCoords = getCoords (i);
     45      memcpy (&image[i].coords, oldCoords, sizeof(Coords));
     46      image[i].flags |= ID_IMAGE_ASTROM_POOR;
    3747    }
    3848
  • trunk/Ohana/src/relastro/src/UpdateMeasures.c

    r27435 r29001  
    55  off_t i, Nimage;
    66  Image *image;
     7
     8  int badImage =
     9    ID_IMAGE_ASTROM_NOCAL |
     10    ID_IMAGE_ASTROM_POOR |
     11    ID_IMAGE_ASTROM_FAIL |
     12    ID_IMAGE_ASTROM_SKIP |
     13    ID_IMAGE_ASTROM_FEW;
    714
    815  image = getimages (&Nimage);
     
    1320    if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue;
    1421
     22    // skip images that have failed solutions (divergent or otherwise)
     23    if (image[i].flags & badImage) continue;
     24
    1525    /* convert measure coordinates to raw entries */
    1626    fixImageRaw (catalog, Ncatalog, i);
  • trunk/Ohana/src/relastro/src/bcatalog.c

    r28241 r29001  
    4545      offset = catalog[0].average[i].measureOffset + j;
    4646     
    47       //filter objects based on user supplied criteria
     47      // filter objects based on user supplied criteria
    4848      if (!MeasFilterTest(&catalog[0].measure[offset])) {
    4949        catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP;
     
    5151      }
    5252
    53       //filter out outliers
     53      // filter out outliers
    5454      if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) {
    5555        catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP;
  • trunk/Ohana/src/relastro/src/fitpoly.c

    r27581 r29001  
    110110  if (fit[0].Npts == 0) {
    111111    fprintf (stderr, "warning: no valid pts\n");
     112    return (FALSE);
    112113  }
    113114
     
    140141  }
    141142
    142   for (i = 0; i < fit[0].Nelems; i++) {
     143  for (i = 0; FALSE && (i < fit[0].Nelems); i++) {
    143144    ix = i % fit[0].Nterms;
    144145    iy = i / fit[0].Nterms;
    145     // fprintf (stderr, "x2 : x^%dy^%d: %10.4g    y2 : x^%dy^%d: %10.4g \n",
    146     // ix, iy, vector[i][0], ix, iy, vector[i][1]);
     146    fprintf (stderr, "x2 : x^%dy^%d: %10.4g    y2 : x^%dy^%d: %10.4g \n",
     147    ix, iy, vector[i][0], ix, iy, vector[i][1]);
    147148  }     
    148149 
     
    151152  }
    152153
    153   for (i = 0; i < fit[0].Nelems; i++) {
     154  for (i = 0; FALSE && i < fit[0].Nelems; i++) {
    154155    ix = i % fit[0].Nterms;
    155156    iy = i / fit[0].Nterms;
    156     // fprintf (stderr, "x2 : x^%dy^%d: %10.4g    y2 : x^%dy^%d: %10.4g \n",
    157     // ix, iy, vector[i][0], ix, iy, vector[i][1]);
     157    fprintf (stderr, "x2 : x^%dy^%d: %10.4g    y2 : x^%dy^%d: %10.4g \n",
     158    ix, iy, vector[i][0], ix, iy, vector[i][1]);
    158159  }     
    159160
     
    274275/* this should only apply to the polynomial, not the projection terms */
    275276/* compare with psastro supporting code */
    276 int fit_apply_coords (CoordFit *fit, Coords *coords) {
     277int fit_apply_coords (CoordFit *fit, Coords *coords, int keepRef) {
    277278
    278279  double Xo, Yo, R1, R2;
    279280  CoordFit *modfit;
    280281
    281   /* I have L,M = fit(X,Y). set corresponding terms for coords */
    282 
    283   // L = a[0][0] + a[1][0]x^1 y^0 + a[0][1] x^0 y^1 + ...
    284   // L = pc1_1*cd1*(x - cp1) + pc1_2*cd2*(y - cp2) + ...
    285 
    286   if (!CoordsGetCenter (fit, 0.001, &Xo, &Yo)) {
    287     fprintf (stderr, "failed to modify model\n");
    288     return (FALSE);
    289   }
    290   coords[0].crpix1 = Xo;
    291   coords[0].crpix2 = Yo;
    292  
    293   // resulting fit should have zero constant terms
    294   modfit = CoordsSetCenter (fit, Xo, Yo);
    295 
    296   /* we do not modify crval1,2: these are kept at the default values */
     282  if (keepRef) {
     283    // adjust crpix1,2 as needed:
     284    // L = a[0][0] + a[1][0]x^1 y^0 + a[0][1] x^0 y^1 + ...
     285    // L = pc1_1*cd1*(x - cp1) + pc1_2*cd2*(y - cp2) + ...
     286
     287    if (!CoordsGetCenter (fit, 0.001, &Xo, &Yo)) {
     288      fprintf (stderr, "failed to modify model\n");
     289      return (FALSE);
     290    }
     291    coords[0].crpix1 = Xo;
     292    coords[0].crpix2 = Yo;
     293    /* we do not modify crval1,2: these are kept at the default values */
     294 
     295    // resulting fit should have zero constant terms
     296    modfit = CoordsSetCenter (fit, Xo, Yo);
     297  } else {
     298    // L = a[0][0] + a[1][0]x^1 y^0 + a[0][1] x^0 y^1 + ...
     299    // P = cd1*x, Q = cd2*y
     300    // L = pc1_1*P + pc1_2*Q + ...
     301
     302    /* modify crval1,2: these are kept at the default values */
     303
     304    coords[0].crpix1 = 0.0;
     305    coords[0].crpix2 = 0.0;
     306    modfit = fit;
     307  }
    297308
    298309  // set cdelt1, cdelt2
     
    331342    coords[0].polyterms[6][1] = modfit[0].yfit[0][3]*R2*R2*R2;
    332343  }
    333 
    334   fit_free (modfit);
     344 
     345  if (keepRef) {
     346    fit_free (modfit);
     347  } else {
     348    fit_apply (fit, &coords[0].crval1, &coords[0].crval2, coords[0].crpix1, coords[0].crpix2);
     349  }
    335350  /* keep the order and type from initial values */
    336351 
  • trunk/Ohana/src/relastro/src/initialize.c

    r28184 r29001  
    100100  initstats (STATMODE);
    101101
    102   // IMAGE_BAD = ID_IMAGE_POOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;
     102  // IMAGE_BAD = ID_IMAGE_ASTROM_POOR | ID_IMAGE_ASTROM_FEW | ID_IMAGE_ASTROM_SKIP;
    103103  // STAR_BAD  = ID_STAR_POOR | ID_STAR_FEW;
    104104  // MEAS_BAD  = ID_MEAS_NOCAL | ID_MEAS_POOR_ASTROM | ID_MEAS_SKIP_ASTROM | ID_MEAS_AREA;
  • trunk/Ohana/src/relastro/src/load_catalogs.c

    r24308 r29001  
    99
    1010  ALLOCATE (catalog, Catalog, skylist[0].Nregions);
     11
     12  initStarMaps();
    1113
    1214  // load data from each region file, only use bright stars
     
    3436      FlagOutliers(&tcatalog);
    3537    }
     38
     39    updateStarMaps (&tcatalog);
    3640
    3741    // select only the brighter stars
  • trunk/Ohana/src/relastro/src/load_images.c

    r27581 r29001  
    3333  // convert database table to internal structure
    3434  image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped);
     35  if (!image) {
     36      fprintf (stderr, "ERROR: failed to read images\n");
     37      exit (2);
     38  }
     39
    3540  MARKTIME("  convert image table: %f sec\n", dtime);
    3641
     
    5257  return (skylist);
    5358}
     59
     60int reload_images (FITS_DB *db) {
     61
     62  Image     *image;
     63  off_t     Nimage, Nx, i;
     64  VTable    *vtable;
     65
     66  image = getimages (&Nimage);
     67
     68  vtable = &db[0].vtable;
     69
     70  gfits_scan (vtable[0].header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
     71  for (i = 0; i < Nimage; i++) {
     72    memcpy (vtable[0].buffer[i], &image[i], Nx);
     73  }
     74  return (TRUE);
     75}
  • trunk/Ohana/src/relastro/src/mkpolyterm.c

    r27581 r29001  
    6666      Xo -= beta[0][0];
    6767      Yo -= beta[1][0];
     68
    6869      dPos = hypot(beta[0][0], beta[1][0]);
    6970      if (i == 0) {
  • trunk/Ohana/src/relastro/src/relastro.c

    r28184 r29001  
    11# include "relastro.h"
    2 
    3 # define MARKTIME(MSG,...) { \
    4   float dtime; \
    5   gettimeofday (&stop, (void *) NULL); \
    6   dtime = DTIME (stop, start); \
    7   fprintf (stderr, MSG, __VA_ARGS__); }
    82
    93int main (int argc, char **argv) {
     
    4943
    5044  /* load catalog data from region files : subselect high-quality measurements */
     45  // XXX pass in the image table
     46  // XXX who carries the image grid?
    5147  catalog = load_catalogs (skylist, &Ncatalog, TRUE);
    5248  MARKTIME("load catalog data: %f sec\n", dtime);
     
    6359    // plot_mosaic_fields (catalog);
    6460  }
     61
     62  // set test points based on the starmap
     63  createStarMapPoints();
    6564
    6665  /* major modes */
     
    9897  freeImageBins (1);
    9998
     99  reload_images (&db);
     100   
    100101  // iterate over catalogs to make detection coordinates consistant
    101102  UpdateObjectOffsets (skylist);
    102103
    103104  // iterate over catalogs to make detection coordinates consistant
    104   FixProblemImages (skylist);
     105  // FixProblemImages (skylist);
    105106
    106107  // save the updated image parameters
  • trunk/Ohana/src/relastro/src/select_images.c

    r28241 r29001  
    2828  double *RmaxSky;
    2929  off_t *index;
     30
     31  int badImage =
     32    ID_IMAGE_ASTROM_POOR |
     33    ID_IMAGE_ASTROM_FAIL |
     34    ID_IMAGE_ASTROM_FEW;
    3035
    3136  if (skylist[0].Nregions < 1) {
     
    171176      image[nimage] = timage[i];
    172177      /* always allow 'few' images to succeed, if possible */
    173       if (image[nimage].flags & ID_IMAGE_FEW) {
    174         image[nimage].flags &= ~(ID_IMAGE_FEW | ID_IMAGE_POOR);
     178      if (image[nimage].flags & ID_IMAGE_ASTROM_FEW) {
     179        image[nimage].flags &= ~ID_IMAGE_ASTROM_FEW;
    175180      }
    176181      if (RESET) {
     
    178183        assignMcal (&image[nimage], (double *) NULL, -1);
    179184        image[nimage].dMcal = NAN;
    180         image[nimage].flags &= ~ID_IMAGE_POOR;
     185        image[nimage].flags &= ~badImage;
    181186      }
    182187      line_number[nimage] = i;
Note: See TracChangeset for help on using the changeset viewer.