IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28720


Ignore:
Timestamp:
Jul 27, 2010, 3:12:18 PM (16 years ago)
Author:
eugene
Message:

star map now seems to work; updated flagging of images to be sensible; adjust fitting to allow reset of crpix1,2; fix image db table output

Location:
branches/eam_branches/ipp-20100621/Ohana/src/relastro
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/include/relastro.h

    r28703 r28720  
    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 */
     
    150157int NY_MAP;
    151158double DPOS_MAX;
     159double ADDSTAR_RADIUS;
    152160
    153161/*** relphot prototypes ***/
     
    212220void create_image_db (FITS_DB *db);
    213221void save_catalogs (Catalog *catalog, int Ncatalog);
     222
     223int reload_images (FITS_DB *db);
    214224
    215225int           main                PROTO((int argc, char **argv));
     
    272282double **poly2d_copy (double **poly, int Nx, int Ny);
    273283double poly2d_eval (double **poly, int Nx, int Ny, double x, double y);
    274 int fit_apply_coords (CoordFit *fit, Coords *coords);
     284int fit_apply_coords (CoordFit *fit, Coords *coords, int keepRef);
    275285int CoordsGetCenter (CoordFit *fit, double tol, double *xo, double *yo);
    276286CoordFit *CoordsSetCenter (CoordFit *input, double Xo, double Yo);
    277 int FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords);
     287int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image);
    278288void FitMosaic (StarData *raw, StarData *ref, int Nmatch, Coords *coords);
    279289void FitSimple (StarData *raw, StarData *ref, int Nmatch, Coords *coords);
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/ConfigInit.c

    r28703 r28720  
    3636  GetConfig (config, "RELASTRO_MAP_NY",        "%d",  0, &NY_MAP);
    3737  GetConfig (config, "RELASTRO_DPOS_MAX",      "%lf", 0, &DPOS_MAX);
     38  GetConfig (config, "ADDSTAR_RADIUS",         "%lf", 0, &ADDSTAR_RADIUS);
    3839
    3940  GetConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/FitChip.c

    r27581 r28720  
    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
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/FitMosaic.c

    r16810 r28720  
    2626  }
    2727  fit_eval (fit);
    28   fit_apply_coords (fit, coords);
     28  fit_apply_coords (fit, coords, TRUE);
    2929  fit_free (fit);
    3030
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/FitSimple.c

    r27435 r28720  
    2626  }
    2727  fit_eval (fit);
    28   fit_apply_coords (fit, coords);
     28  fit_apply_coords (fit, coords, TRUE);
    2929  fit_free (fit);
    3030
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/ImageOps.c

    r28695 r28720  
    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     // XXX warning or error here??
    375     if (fabs(dR) > 2.0) {
    376       fprintf (stderr, "!");
    377       setBadCoords (im); // report a failure for this image
    378       return;
    379     }
    380     if (fabs(dD) > 2.0) {
    381       fprintf (stderr, "*");
    382       setBadCoords (im); // report a failure for this image
    383       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 ();
    384401    }
    385402
    386403    // complain if the new location is far from the old location
    387     if (fabs(catalog[c].measure[m].dR - dR) > 2.0) {
    388       fprintf (stderr, "@");
    389       setBadCoords (im); // report a failure for this image
    390       return;
    391     }
    392     if (fabs(catalog[c].measure[m].dD - dD) > 2.0) {
    393       fprintf (stderr, "#");
    394       setBadCoords (im); // report a failure for this image
    395       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();
    396413    }
    397414
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/StarMaps.c

    r28703 r28720  
    2020  int  Nx;
    2121  int  Ny;
    22   int *stars;
    23   StarMapPoint *points;
     22  int *stars; // arrays to count the number of stars in each map bin
     23  StarMapPoint *points; // test points generated based on map
    2424  int Npoints;
    2525} StarMap;
     
    4545
    4646  for (i = 0; i < Nimages; i++) {
     47    starmap[i].Npoints = 0;
     48    starmap[i].points = NULL;
    4749    starmap[i].Nx = images[i].NX / NX_MAP;
    4850    starmap[i].Ny = images[i].NY / NY_MAP;
     
    5860  off_t i, N, Nimages;
    5961  int xbin, ybin;
     62  struct timeval start, stop;
     63
     64  gettimeofday (&start, (void *) NULL);
    6065
    6166  images = getimages(&Nimages);
     
    7479    starmap[N].stars[ybin*NX_MAP + xbin] ++;
    7580  }
     81  MARKTIME("assign stars to starmap bins: %f sec\n", dtime);
    7682
    7783  return (TRUE);
     
    8894  for (i = 0; i < Nimages; i++) {
    8995   
     96    assert (!starmap[i].points);
     97
    9098    ALLOCATE (starmap[i].points, StarMapPoint, NX_MAP*NY_MAP);
    9199    starmap[i].Npoints = 0;
     
    98106
    99107        // set the pixel coordinates
    100         point[0].X = ix * NX_MAP; // XXX fix 0.5 pixel offset
    101         point[0].Y = iy * NY_MAP; // XXX fix 0.5 pixel offset
     108        point[0].X = ix * starmap[i].Nx; // XXX fix 0.5 pixel offset
     109        point[0].Y = iy * starmap[i].Nx; // XXX fix 0.5 pixel offset
    102110
    103111        // set the transformed coordinates
     
    108116      }
    109117    }
     118
     119    if (VERBOSE) fprintf (stderr, "starmap: %d points for image %s\n", starmap[i].Npoints, images[i].name);
    110120  }
    111121
     
    131141    starmap[N].points[i].dM = starmap[N].points[i].M - M;
    132142
    133     dLmax = MAX(starmap[N].points[i].dL, dLmax);
    134     dMmax = MAX(starmap[N].points[i].dM, dMmax);
     143    dLmax = MAX(fabs(starmap[N].points[i].dL), dLmax);
     144    dMmax = MAX(fabs(starmap[N].points[i].dM), dMmax);
    135145  }
    136146
    137   // XXX these need to be set somehow
     147  if (VERBOSE) fprintf (stderr, "max deviations for %s using %d pts : %f, %f\n", images[N].name, starmap[N].Npoints, dLmax, dMmax);
     148
    138149  if (dLmax > DPOS_MAX) return (FALSE);
    139150  if (dMmax > DPOS_MAX) return (FALSE);
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/UpdateChips.c

    r28695 r28720  
    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       // XXX need to set some flag to note failure here
    3837      free (raw);
    3938      free (ref);
     
    4241
    4342    if (!checkStarMap (i)) {
    44       fprintf (stderr, "fit diverges too much for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name,  i,  Nraw);
     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);
    4544      oldCoords = getCoords (i);
    4645      memcpy (&image[i].coords, oldCoords, sizeof(Coords));
    47       // XXX need to set some flag to note failure here
     46      image[i].flags |= ID_IMAGE_ASTROM_POOR;
    4847    }
    4948
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/UpdateMeasures.c

    r28695 r28720  
    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);
     
    1421
    1522    // skip images that have failed solutions (divergent or otherwise)
     23    if (image[i].flags & badImage) continue;
    1624
    1725    /* convert measure coordinates to raw entries */
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/bcatalog.c

    r28241 r28720  
    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;
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/fitpoly.c

    r27581 r28720  
    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 
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/initialize.c

    r28184 r28720  
    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;
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/load_images.c

    r27581 r28720  
    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}
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/mkpolyterm.c

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

    r28695 r28720  
    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) {
     
    10397  freeImageBins (1);
    10498
     99  reload_images (&db);
     100   
    105101  // iterate over catalogs to make detection coordinates consistant
    106102  UpdateObjectOffsets (skylist);
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/select_images.c

    r28241 r28720  
    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.