Changeset 37446
- Timestamp:
- Sep 29, 2014, 8:42:00 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/relastro
- Files:
-
- 6 edited
-
include/relastro.h (modified) (2 diffs)
-
src/FitChip.c (modified) (5 diffs)
-
src/args.c (modified) (1 diff)
-
src/high_speed_utils.c (modified) (2 diffs)
-
src/load_images.c (modified) (3 diffs)
-
src/relastro_images.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/relastro/include/relastro.h
r37261 r37446 204 204 int PLOTDELAY; 205 205 int CHIPORDER; 206 int CHIPMAP; 206 207 207 208 int MaxDensityUse; … … 547 548 int isGPC1stack (int photcode); 548 549 int isGPC1warp (int photcode); 550 551 int save_astrom_table (); 552 AstromOffsetTable *get_astrom_table (); 553 554 int fit_map (AstromOffsetMap *map, StarData *raw, StarData *ref, int Npts); 555 -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FitChip.c
r37438 r37446 57 57 relastroVisualPlotChipFit(raw, ref, dRmax, Nmatch); 58 58 59 // for polynomial fits, I used (5,30,60) = (5,6,7) stars per term 60 59 61 // set the maximum order for the polynomial (based on number of stars kept above) 60 62 int order_use = 0; 61 if (Nkeep > 5) order_use = 1; // 4 stars per polynomial term (per dimension) 62 if (Nkeep > 30) order_use = 2; // 5 stars per polynomial term (per dimension) 63 if (Nkeep > 60) order_use = 3; // 6 stars per polynomial term (per dimension) 63 if (Nkeep > 5) order_use = 1; // 5 stars per cell 64 if (Nkeep > 24) order_use = 2; // 6 stars per cell 65 if (Nkeep > 63) order_use = 3; // 7 stars per cell 66 if (Nkeep > 128) order_use = 4; // 8 stars per cell 67 if (Nkeep > 225) order_use = 5; // 9 stars per cell 68 if (Nkeep > 360) order_use = 6; // 10 stars per cell 64 69 if (order_use < 1) { 65 70 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nkeep); … … 67 72 return FALSE; 68 73 } 74 // fprintf (stderr, "using %d for %s\n", order_use, image[0].name); 69 75 70 76 // when fitting the map, first fit a linear model (below? change Npolyterms to -1) 71 if ( MAP) {77 if (CHIPMAP) { 72 78 image[0].coords.Npolyterms = 1; 73 79 } else { … … 99 105 } 100 106 107 // apply fit to get the fitted X,Y coordinates. we need these to fit the residual map below 101 108 for (i = 0; i < Nmatch; i++) { 102 // we have not yet fitted the map, so image[0].coords.Npolyterms needs to 103 // be 1 here... 109 // we have not yet fitted the map, so Npolyterms needs to be 1 here: 110 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[0].coords); 111 } 112 113 if (CHIPMAP) { 114 if (image[0].coords.offsetMap == NULL) { 115 // allocate a new table and assign to this image 116 AstromOffsetTable *table = get_astrom_table (); 117 AstromOffsetTableNewMap(table, order_use, image); 118 } 119 fit_map (image[0].coords.offsetMap, raw, ref, Nmatch); 120 image[0].coords.Npolyterms = -1; 121 } 122 123 for (i = 0; i < Nmatch; i++) { 124 // if we have fitted the map above, Npolyterms needs to be -1 here: 104 125 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[0].coords); 105 }106 107 // where do we apply the fit all the way b108 109 if (MAP) {110 if (image[0].coords.offsetMap == NULL) {111 AstromOffsetMap *map = AstromOffsetTableNewMap(table, order);112 image[0].coords.offsetMap = map;113 }114 fit_map (image[0].coords.offsetMap, raw, ref);115 image[0].coords.Npolyterm = -1;116 126 } 117 127 } … … 274 284 */ 275 285 276 int fit_map (AstromOffsetMap *map ) {286 int fit_map (AstromOffsetMap *map, StarData *raw, StarData *ref, int Npts) { 277 287 278 288 // we are actually fitting the residual after the linear fit has been taken off … … 280 290 // fit the linear terms as above 281 291 // calculate dX (raw.X - ref.X) and dY 282 283 AstromOffsetMapFit (map, x, y, dX, Npts, TRUE); 284 AstromOffsetMapFit (map, x, y, dY, Npts, FALSE); 292 293 int i, N; 294 295 float *x, *y, *dX, *dY; 296 ALLOCATE (x, float, Npts); 297 ALLOCATE (y, float, Npts); 298 ALLOCATE (dX, float, Npts); 299 ALLOCATE (dY, float, Npts); 300 301 N = 0; 302 for (i = 0; i < Npts; i++) { 303 if (raw[i].mask) continue; 304 x[N] = raw[i].X; 305 y[N] = raw[i].Y; 306 dX[N] = ref[i].X - raw[i].X; 307 dY[N] = ref[i].Y - raw[i].Y; 308 N++; 309 } 310 311 // in coordsops.c:XY_to_LM, the map is defined to carry dX,dY so that: 312 // (L,M) = f(X',Y') : (X',Y') = (X,Y) + (dX,dY) 313 314 AstromOffsetMapFit (map, x, y, dX, N, TRUE); 315 AstromOffsetMapFit (map, x, y, dY, N, FALSE); 316 317 free (x); 318 free (y); 319 free (dX); 320 free (dY); 285 321 286 322 return TRUE; -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/args.c
r37038 r37446 370 370 CHIPORDER = atoi(argv[N]); 371 371 remove_argument (N, &argc, argv); 372 } 373 374 CHIPMAP = FALSE; 375 if ((N = get_argument (argc, argv, "-chipmap"))) { 376 remove_argument (N, &argc, argv); 377 CHIPMAP = TRUE; 372 378 } 373 379 -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/high_speed_utils.c
r33652 r37446 141 141 off_t n; 142 142 for (n = 0; n < NfieldsA; n++) { 143 valuesA[n] = dbExtractAverages (&catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt], &catalog[0].measure[m], &fieldsA[n]);143 valuesA[n] = dbExtractAverages (&catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt], &catalog[0].measure[m], NULL, NULL, &fieldsA[n]); 144 144 } 145 145 return dbBooleanCond(stackA, NstackA, valuesA); … … 155 155 off_t n; 156 156 for (n = 0; n < NfieldsB; n++) { 157 valuesB[n] = dbExtractAverages (&catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt], &catalog[0].measure[m], &fieldsB[n]);157 valuesB[n] = dbExtractAverages (&catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt], &catalog[0].measure[m], NULL, NULL, &fieldsB[n]); 158 158 } 159 159 return dbBooleanCond(stackB, NstackB, valuesB); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/load_images.c
r37378 r37446 1 1 # include "relastro.h" 2 3 static AstromOffsetTable *table = NULL; 4 5 /* AstromOffsetMap is the map of Astrometry Offsets for non-polynomial astrometric 6 * corrections for each chip. 7 */ 2 8 3 9 int load_images (FITS_DB *db, SkyList *skylist, int UseFullOverlap) { … … 17 23 MARKTIME(" convert image table: %f sec\n", dtime); 18 24 25 // assign image->parent and image->coords.mosaic 19 26 BuildChipMatch (image, Nimage); 20 27 MARKTIME("build chip match: %f sec\n", dtime); 28 29 char mapfile[DVO_MAX_PATH]; 30 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 31 table = AstromOffsetMapLoad (mapfile, VERBOSE); 32 33 // assign images.coords.offsetMap -> table->map[i] 34 if (table) { 35 AstromOffsetTableMatchChips (image, Nimage, table); 36 } else { 37 table = AstromOffsetTableInit (); 38 } 21 39 22 40 // select the images which overlap the selected sky regions … … 54 72 return TRUE; 55 73 } 74 75 int save_astrom_table () { 76 77 char mapfile[DVO_MAX_PATH]; 78 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 79 AstromOffsetMapSave (table, mapfile); 80 81 return TRUE; 82 } 83 84 AstromOffsetTable *get_astrom_table () { 85 return table; 86 } 87 -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_images.c
r36833 r37446 102 102 if (PARALLEL) { 103 103 // save the updated image parameters 104 // need to also save the image map table... 105 save_astrom_table (); 104 106 dvo_image_update (&db, VERBOSE); 105 107 dvo_image_unlock (&db); … … 114 116 if (!PARALLEL) { 115 117 // save the updated image parameters 118 save_astrom_table (); 116 119 dvo_image_update (&db, VERBOSE); 117 120 dvo_image_unlock (&db);
Note:
See TracChangeset
for help on using the changeset viewer.
