Changeset 29001 for trunk/Ohana/src/relastro
- Timestamp:
- Aug 20, 2010, 12:05:07 PM (16 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 19 edited
- 1 copied
-
. (modified) (1 prop)
-
src/relastro/Makefile (modified) (1 diff)
-
src/relastro/doc/notes.txt (modified) (1 diff)
-
src/relastro/include/relastro.h (modified) (7 diffs)
-
src/relastro/src/ConfigInit.c (modified) (1 diff)
-
src/relastro/src/FitChip.c (modified) (10 diffs)
-
src/relastro/src/FitMosaic.c (modified) (1 diff)
-
src/relastro/src/FitSimple.c (modified) (1 diff)
-
src/relastro/src/ImageOps.c (modified) (5 diffs)
-
src/relastro/src/StarMaps.c (copied) (copied from branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/StarMaps.c )
-
src/relastro/src/UpdateChips.c (modified) (1 diff)
-
src/relastro/src/UpdateMeasures.c (modified) (2 diffs)
-
src/relastro/src/bcatalog.c (modified) (2 diffs)
-
src/relastro/src/fitpoly.c (modified) (5 diffs)
-
src/relastro/src/initialize.c (modified) (1 diff)
-
src/relastro/src/load_catalogs.c (modified) (2 diffs)
-
src/relastro/src/load_images.c (modified) (2 diffs)
-
src/relastro/src/mkpolyterm.c (modified) (1 diff)
-
src/relastro/src/relastro.c (modified) (4 diffs)
-
src/relastro/src/select_images.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo deleted
-
trunk/Ohana/src/relastro/Makefile
r28184 r29001 58 58 $(SRC)/CoordOps.$(ARCH).o \ 59 59 $(SRC)/FixProblemImages.$(ARCH).o \ 60 $(SRC)/StarMaps.$(ARCH).o \ 60 61 $(SRC)/high_speed_catalogs.$(ARCH).o \ 61 62 $(SRC)/high_speed_objects.$(ARCH).o \ -
trunk/Ohana/src/relastro/doc/notes.txt
r27435 r29001 1 2 2010.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. 1 27 2 28 2010.03.24 -
trunk/Ohana/src/relastro/include/relastro.h
r28184 r29001 3 3 # include <kapa.h> 4 4 # include <signal.h> 5 # include <assert.h> 5 6 6 7 typedef enum { … … 76 77 int Nmeas; 77 78 } 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__); } 78 85 79 86 /* global variables set in parameter file */ … … 145 152 int DoUpdateChips; 146 153 int DoUpdateMosaics; 154 155 // StarMap parameters: 156 int NX_MAP; 157 int NY_MAP; 158 double DPOS_MAX; 159 double ADDSTAR_RADIUS; 147 160 148 161 /*** relphot prototypes ***/ … … 207 220 void create_image_db (FITS_DB *db); 208 221 void save_catalogs (Catalog *catalog, int Ncatalog); 222 223 int reload_images (FITS_DB *db); 209 224 210 225 int main PROTO((int argc, char **argv)); … … 267 282 double **poly2d_copy (double **poly, int Nx, int Ny); 268 283 double poly2d_eval (double **poly, int Nx, int Ny, double x, double y); 269 int fit_apply_coords (CoordFit *fit, Coords *coords );284 int fit_apply_coords (CoordFit *fit, Coords *coords, int keepRef); 270 285 int CoordsGetCenter (CoordFit *fit, double tol, double *xo, double *yo); 271 286 CoordFit *CoordsSetCenter (CoordFit *input, double Xo, double Yo); 272 int FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords);287 int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image); 273 288 void FitMosaic (StarData *raw, StarData *ref, int Nmatch, Coords *coords); 274 289 void FitSimple (StarData *raw, StarData *ref, int Nmatch, Coords *coords); … … 293 308 StarData *getImageRef (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode); 294 309 StarData *getImageRaw (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode); 310 off_t getImageByID (off_t ID); 295 311 296 312 Mosaic *getmosaics (off_t *N); … … 331 347 int high_speed_objects (SkyRegion *region, Catalog *catalog); 332 348 int MeasMatchesPhotcode(Measure *measure, PhotCode **photcodeSet, int Nset); 349 350 int initStarMaps (); 351 int updateStarMaps(Catalog *catalog); 352 int createStarMapPoints(); 353 int checkStarMap(int N); -
trunk/Ohana/src/relastro/src/ConfigInit.c
r25757 r29001 32 32 GetConfig (config, "PM_TOOFEW", "%d", 0, &PM_TOOFEW); 33 33 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); 34 39 35 40 GetConfig (config, "GSCFILE", "%s", 0, GSCFILE); -
trunk/Ohana/src/relastro/src/FitChip.c
r27581 r29001 3 3 4 4 // XXX make these user parameters 5 # define FIT_CHIP_MAX_ERROR 0.056 5 # define FIT_CHIP_NITER 3 7 6 # define FIT_CHIP_NSIGMA 3.0 8 9 10 // XXX we should test if the fit is sufficiently constrained across the chip, or if the11 // new positions deviate too much from the old positions12 13 // XXX add visualization tools: per chip residual plots14 7 15 8 // XXX save the fit[0].Npts value in the image table? … … 17 10 // XXX save measurements of the fit quality (scatter, chisq) in the image table 18 11 19 int FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords) {12 int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image) { 20 13 21 14 int i, Nscatter, Niter, skip; … … 29 22 for (i = Nscatter = 0; i < Nmatch; i++) { 30 23 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; 32 25 33 26 dL = raw[i].L - ref[i].L; … … 39 32 } 40 33 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 } 46 44 47 45 // fit the requested order polynomial 48 46 if (CHIPORDER > 0) { 49 coords[0].Npolyterms = CHIPORDER;47 image[0].coords.Npolyterms = CHIPORDER; 50 48 } 51 fit = fit_init ( coords[0].Npolyterms);49 fit = fit_init (image[0].coords.Npolyterms); 52 50 53 51 // generate the fit matches … … 56 54 continue; 57 55 } 58 if (isnan(raw[i].dMag) || raw[i].dMag > FIT_CHIP_MAX_ERROR) {56 if (isnan(raw[i].dMag) || raw[i].dMag > SIGMA_LIM) { 59 57 continue; 60 58 } … … 64 62 dM = raw[i].M - ref[i].M; 65 63 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; 67 68 68 69 fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos); … … 71 72 // check if the fit has enough data points for the polynomial order 72 73 skip = FALSE; 73 switch ( coords[0].Npolyterms) {74 switch (image[0].coords.Npolyterms) { 74 75 case 0: 75 76 case 1: … … 83 84 break; 84 85 default: 85 fprintf (stderr, "invalid chip order %d\n", coords[0].Npolyterms);86 fprintf (stderr, "invalid chip order %d\n", image[0].coords.Npolyterms); 86 87 skip = TRUE; 87 88 } 88 89 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); 90 91 fit_free (fit); 91 92 free (values); 93 image[0].flags |= ID_IMAGE_ASTROM_FEW; 92 94 return FALSE; 93 95 } … … 98 100 if (!fit_eval (fit)) { 99 101 fprintf (stderr, "failed to fit new model\n"); 102 image[0].flags |= ID_IMAGE_ASTROM_FAIL; 100 103 return FALSE; 101 104 } 102 105 103 if (!fit_apply_coords (fit, coords)) {106 if (!fit_apply_coords (fit, &image[0].coords, FALSE)) { 104 107 fprintf (stderr, "failed to fit new model\n"); 108 image[0].flags |= ID_IMAGE_ASTROM_FAIL; 105 109 return FALSE; 106 110 } … … 109 113 110 114 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); 112 116 } 113 117 -
trunk/Ohana/src/relastro/src/FitMosaic.c
r16810 r29001 26 26 } 27 27 fit_eval (fit); 28 fit_apply_coords (fit, coords );28 fit_apply_coords (fit, coords, TRUE); 29 29 fit_free (fit); 30 30 -
trunk/Ohana/src/relastro/src/FitSimple.c
r27435 r29001 26 26 } 27 27 fit_eval (fit); 28 fit_apply_coords (fit, coords );28 fit_apply_coords (fit, coords, TRUE); 29 29 fit_free (fit); 30 30 -
trunk/Ohana/src/relastro/src/ImageOps.c
r28241 r29001 319 319 } 320 320 321 void 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 321 332 // return StarData values for detections in the specified image, converting coordinates from the 322 333 // chip positions: X,Y -> L,M -> P,Q -> R,D … … 325 336 off_t i, m, c, n, nPos; 326 337 double X, Y, L, M, P, Q, R, D, dR, dD; 327 double dPos ;338 double dPos, DPOS_MAX_ASEC; 328 339 329 340 Mosaic *mosaic; … … 341 352 } 342 353 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 } 343 360 344 361 // accumulate the rms position offsets. if this value, or any specific entry, is too … … 372 389 373 390 // 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 (); 383 401 } 384 402 385 403 // 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 image389 return;390 } 391 if (fabs(catalog[c].measure[m].dD - dD) > 2.0) {392 fprintf (stderr, " #");393 setBadCoords (im); // report a failure for this image394 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(); 395 413 } 396 414 … … 414 432 415 433 saveOffsets (dPos, nPos, im); 434 435 // XXX this function should probably update the average positions as well. 416 436 417 437 return; -
trunk/Ohana/src/relastro/src/UpdateChips.c
r28241 r29001 31 31 // FitChip does iterative, clipped fitting 32 32 // 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); 35 35 oldCoords = getCoords (i); 36 36 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; 37 47 } 38 48 -
trunk/Ohana/src/relastro/src/UpdateMeasures.c
r27435 r29001 5 5 off_t i, Nimage; 6 6 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; 7 14 8 15 image = getimages (&Nimage); … … 13 20 if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue; 14 21 22 // skip images that have failed solutions (divergent or otherwise) 23 if (image[i].flags & badImage) continue; 24 15 25 /* convert measure coordinates to raw entries */ 16 26 fixImageRaw (catalog, Ncatalog, i); -
trunk/Ohana/src/relastro/src/bcatalog.c
r28241 r29001 45 45 offset = catalog[0].average[i].measureOffset + j; 46 46 47 // filter objects based on user supplied criteria47 // filter objects based on user supplied criteria 48 48 if (!MeasFilterTest(&catalog[0].measure[offset])) { 49 49 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; … … 51 51 } 52 52 53 // filter out outliers53 // filter out outliers 54 54 if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) { 55 55 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; -
trunk/Ohana/src/relastro/src/fitpoly.c
r27581 r29001 110 110 if (fit[0].Npts == 0) { 111 111 fprintf (stderr, "warning: no valid pts\n"); 112 return (FALSE); 112 113 } 113 114 … … 140 141 } 141 142 142 for (i = 0; i < fit[0].Nelems; i++) {143 for (i = 0; FALSE && (i < fit[0].Nelems); i++) { 143 144 ix = i % fit[0].Nterms; 144 145 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]); 147 148 } 148 149 … … 151 152 } 152 153 153 for (i = 0; i < fit[0].Nelems; i++) {154 for (i = 0; FALSE && i < fit[0].Nelems; i++) { 154 155 ix = i % fit[0].Nterms; 155 156 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]); 158 159 } 159 160 … … 274 275 /* this should only apply to the polynomial, not the projection terms */ 275 276 /* compare with psastro supporting code */ 276 int fit_apply_coords (CoordFit *fit, Coords *coords ) {277 int fit_apply_coords (CoordFit *fit, Coords *coords, int keepRef) { 277 278 278 279 double Xo, Yo, R1, R2; 279 280 CoordFit *modfit; 280 281 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 } 297 308 298 309 // set cdelt1, cdelt2 … … 331 342 coords[0].polyterms[6][1] = modfit[0].yfit[0][3]*R2*R2*R2; 332 343 } 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 } 335 350 /* keep the order and type from initial values */ 336 351 -
trunk/Ohana/src/relastro/src/initialize.c
r28184 r29001 100 100 initstats (STATMODE); 101 101 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; 103 103 // STAR_BAD = ID_STAR_POOR | ID_STAR_FEW; 104 104 // 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 9 9 10 10 ALLOCATE (catalog, Catalog, skylist[0].Nregions); 11 12 initStarMaps(); 11 13 12 14 // load data from each region file, only use bright stars … … 34 36 FlagOutliers(&tcatalog); 35 37 } 38 39 updateStarMaps (&tcatalog); 36 40 37 41 // select only the brighter stars -
trunk/Ohana/src/relastro/src/load_images.c
r27581 r29001 33 33 // convert database table to internal structure 34 34 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 35 40 MARKTIME(" convert image table: %f sec\n", dtime); 36 41 … … 52 57 return (skylist); 53 58 } 59 60 int 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 66 66 Xo -= beta[0][0]; 67 67 Yo -= beta[1][0]; 68 68 69 dPos = hypot(beta[0][0], beta[1][0]); 69 70 if (i == 0) { -
trunk/Ohana/src/relastro/src/relastro.c
r28184 r29001 1 1 # 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__); }8 2 9 3 int main (int argc, char **argv) { … … 49 43 50 44 /* load catalog data from region files : subselect high-quality measurements */ 45 // XXX pass in the image table 46 // XXX who carries the image grid? 51 47 catalog = load_catalogs (skylist, &Ncatalog, TRUE); 52 48 MARKTIME("load catalog data: %f sec\n", dtime); … … 63 59 // plot_mosaic_fields (catalog); 64 60 } 61 62 // set test points based on the starmap 63 createStarMapPoints(); 65 64 66 65 /* major modes */ … … 98 97 freeImageBins (1); 99 98 99 reload_images (&db); 100 100 101 // iterate over catalogs to make detection coordinates consistant 101 102 UpdateObjectOffsets (skylist); 102 103 103 104 // iterate over catalogs to make detection coordinates consistant 104 FixProblemImages (skylist);105 // FixProblemImages (skylist); 105 106 106 107 // save the updated image parameters -
trunk/Ohana/src/relastro/src/select_images.c
r28241 r29001 28 28 double *RmaxSky; 29 29 off_t *index; 30 31 int badImage = 32 ID_IMAGE_ASTROM_POOR | 33 ID_IMAGE_ASTROM_FAIL | 34 ID_IMAGE_ASTROM_FEW; 30 35 31 36 if (skylist[0].Nregions < 1) { … … 171 176 image[nimage] = timage[i]; 172 177 /* 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; 175 180 } 176 181 if (RESET) { … … 178 183 assignMcal (&image[nimage], (double *) NULL, -1); 179 184 image[nimage].dMcal = NAN; 180 image[nimage].flags &= ~ ID_IMAGE_POOR;185 image[nimage].flags &= ~badImage; 181 186 } 182 187 line_number[nimage] = i;
Note:
See TracChangeset
for help on using the changeset viewer.
