Changeset 37699
- Timestamp:
- Nov 30, 2014, 12:54:00 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/relastro
- Files:
-
- 13 edited
-
include/relastro.h (modified) (1 diff)
-
src/FitChip.c (modified) (1 diff)
-
src/ImageOps.c (modified) (2 diffs)
-
src/ImagePosIO.c (modified) (1 diff)
-
src/UpdateChips.c (modified) (1 diff)
-
src/UpdateMeasures.c (modified) (2 diffs)
-
src/UpdateObjectOffsets.c (modified) (4 diffs)
-
src/args.c (modified) (4 diffs)
-
src/launch_region_hosts.c (modified) (1 diff)
-
src/relastro_images.c (modified) (1 diff)
-
src/relastro_parallel_images.c (modified) (1 diff)
-
src/relastro_parallel_regions.c (modified) (2 diffs)
-
src/share_images_pos.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/relastro/include/relastro.h
r37686 r37699 229 229 230 230 int RESET; 231 int RESET_IMAGES; 231 232 int RESET_BAD_IMAGES; 232 233 int NLOOP; -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FitChip.c
r37688 r37699 75 75 return FALSE; 76 76 } 77 if (!CHIPMAP) order_use = MIN(order_use, 3); // can only go up to 3rd order 77 if (CHIPMAP) { 78 order_use = MIN(MIN(order_use, CHIPMAP), 6); // can only go up to 6th order map (can be user limited) 79 } else { 80 order_use = MIN(order_use, 3); // can only go up to 3rd order for polynomials 81 } 82 78 83 if (VERBOSE2) fprintf (stderr, "using %d for %s\n", order_use, image[0].name); 79 84 -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ImageOps.c
r37697 r37699 125 125 126 126 if (imageSeq) { 127 myAssert (ID >= minImageID, "oops");128 myAssert (ID <= maxImageID, "oops");127 if (ID < minImageID) return (-1); 128 if (ID > maxImageID) return (-1); 129 129 off_t N = imageSeq[ID]; 130 130 return N; … … 276 276 } 277 277 } 278 279 if (!ID) return; // detection not associated with an image 278 280 279 281 idx = getImageByID (ID); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ImagePosIO.c
r37662 r37699 85 85 ALLOCATE (image_pos, ImagePos, Nrow); 86 86 for (i = 0; i < Nrow; i++) { 87 InitCoords(&image_pos[i].coords, NULL); 87 88 image_pos[i].coords.crval1 = crval1 [i]; 88 89 image_pos[i].coords.crval2 = crval2 [i]; -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/UpdateChips.c
r37686 r37699 564 564 AstromOffsetTableNewMap(table, tmpMap->Nx, tmpMap->Ny, image); // registers the map with the image 565 565 unlockUpdateChips (); 566 AstromOffsetMapCopyData ( truMap, tmpMap);566 AstromOffsetMapCopyData (image->coords.offsetMap, tmpMap); 567 567 return; 568 568 } -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/UpdateMeasures.c
r37697 r37699 1 1 # include "relastro.h" 2 void dump_measures (Average *average, Measure *measure); // in ImageOps.c 2 3 3 // this function operates on Measure, not MeasureTiny4 // this function is called by UpdateObjectOffsets or relastro_images.c for reset 4 5 int UpdateMeasures (Catalog *catalog, int Ncatalog) { 5 6 6 off_t i, Nimage;7 off_t i, j, Nimage; 7 8 Image *image; 9 double DPOS_MAX_ASEC; 8 10 9 11 int badImage = … … 18 20 image = getimages (&Nimage, NULL); 19 21 22 // track measurements which are far from their original position (poor at pole) 23 int NoffRAave = 0; int NoffRAori = 0; 24 int NoffDECave = 0; int NoffDECori = 0; 25 20 26 for (i = 0; i < Ncatalog; i++) { 27 myAssert (!catalog[i].Nmeasure || catalog[i].measureT, "programming error"); 21 28 for (j = 0; j < catalog[i].Nmeasure; j++) { 22 29 MeasureTiny *measureT = &catalog[i].measureT[j]; 23 Measure *measure =catalog[i].measure ? &catalog[i].measure[j] : NULL;30 Measure *measureB = catalog[i].measure ? &catalog[i].measure[j] : NULL; 24 31 25 32 off_t im = getImageByID (measureT->imageID); 33 if (im < 0) continue; // detections without imageIDs are not associated with a known image (eg, refs) 26 34 27 // check that we have the 35 // check that we have the right image: 36 myAssert (measureT->photcode == image[im].photcode, "image photcode mismatch"); 37 myAssert (measureT->t >= image[im].tzero, "image time mismatch (1)"); 38 myAssert (measureT->t <= image[im].tzero + image[im].NX*image[im].trate/5000.0, "image time mismatch (2)"); 39 // I'm allowing the trate*NX to be a factor of 2x too small 28 40 29 // skipimages that have failed solutions (divergent or otherwise)30 // XXX apply this or not??31 if (FALSE && (image[i].flags & badImage)) continue;41 // skip measurements on images that have failed solutions (divergent or otherwise) 42 // XXX apply this or not?? 43 if (FALSE && (image[im].flags & badImage)) continue; 32 44 45 Coords *moscoords = image[im].coords.mosaic; 46 Coords *imcoords = &image[im].coords; 47 48 if (moscoords) { 49 DPOS_MAX_ASEC = 3600.0*DPOS_MAX*hypot(moscoords->cdelt1, moscoords->cdelt2); 50 } else { 51 DPOS_MAX_ASEC = 3600.0*DPOS_MAX*hypot(imcoords->cdelt1, imcoords->cdelt2); 52 } 53 54 double X = measureT->Xccd; 55 double Y = measureT->Yccd; 56 if (USE_FIXED_PIXCOORDS) { 57 if (isfinite(measureT->Xfix) && isfinite(measureT->Yfix)) { 58 float dX = measureT->Xfix - measureT->Xccd; 59 float dY = measureT->Yfix - measureT->Yccd; 60 if (hypot(dX,dY) < 2.0) { 61 X = measureT->Xfix; 62 Y = measureT->Yfix; 63 } 64 } 65 } 66 67 double R, D; 68 double dR = NAN, dD = NAN; 69 XY_to_RD (&R, &D, X, Y, imcoords); 70 71 int n = measureT[0].averef; 72 Average *average = &catalog[i].average[n]; 73 74 // make sure detection is on the same side of the 0,360 boundary as the average 75 // this will give some funny results withing ~1 arcsec of the pol 76 if (dR > +180.0*3600.0) { 77 // average on high end of boundary, move star up 78 R += 360.0; 79 dR = 3600.0*(average[0].R - R); 80 } 81 if (dR < -180.0*3600.0) { 82 // average on low end of boundary, move star down 83 R -= 360.0; 84 dR = 3600.0*(average[0].R - R); 85 } 86 87 float csdec = cos(average[0].D * RAD_DEG); 88 89 // complain if the new location is far from the average location 90 // NOTE: This should never happen, or our StarMap tests are not working 91 if (fabs(dR*csdec) > 3.0*ADDSTAR_RADIUS) { 92 NoffRAave ++; 93 if (VERBOSE2 && catalog[i].measure) { 94 fprintf (stderr, "measurement is far from average location (R): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, dR*csdec, dD); 95 dump_measures (&average[0], catalog[i].measure); 96 } 97 } 98 if (fabs(dD) > 3.0*ADDSTAR_RADIUS) { 99 NoffDECave ++; 100 if (VERBOSE2 && catalog[i].measure) { 101 fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", average[0].R, average[0].D, dR, dD); 102 dump_measures (&average[0], catalog[i].measure); 103 } 104 } 105 106 // complain if the new location is far from the old location 107 if (fabs(csdec*(measureT[0].R - R)) > DPOS_MAX_ASEC) { 108 NoffRAori ++; 109 if (VERBOSE2 && catalog[i].measure) { 110 fprintf (stderr, "measurement moves far from original location (R): %f %f (%f %f %f %f)\n", average[0].R, average[0].D, measureT[0].R, dR, csdec*(measureT[0].R - R), dD); 111 dump_measures (&average[0], catalog[i].measure); 112 } 113 } 114 if (fabs(measureT[0].D - D) > DPOS_MAX_ASEC) { 115 NoffDECori ++; 116 if (VERBOSE2 && catalog[i].measure) { 117 fprintf (stderr, "measurement moves far from original location (D): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, measureT[0].D, dD); 118 dump_measures (&average[0], catalog[i].measure); 119 } 120 } 121 measureT->R = R; 122 measureT->D = D; 123 if (measureB) { 124 measureB->R = R; 125 measureB->D = D; 126 } 127 } 33 128 } 129 // printNcatTotal (); 34 130 35 // printNcatTotal (); 131 int Noff = NoffRAave + NoffDECave + NoffRAori + NoffDECori; 132 if (VERBOSE && (Noff > 0)) fprintf (stderr, "Noff ave RA %d, Noff ave DEC %d, Noff ori RA %d, Noff ori DEC %d\n", NoffRAave, NoffDECave, NoffRAori, NoffDECori); 36 133 37 134 return (TRUE); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/UpdateObjectOffsets.c
r37695 r37699 80 80 81 81 int UpdateObjectOffsets_parallel_group (HostTableGroup *group, SkyList *sky); 82 int UpdateObjectOffsets_parallel_table (HostTable *table, SkyList *sky); 82 83 83 84 // CATDIR is supplied globally … … 94 95 } 95 96 97 98 UpdateObjectOffsets_parallel_table (table, sky); 99 100 # if (0) 96 101 int Ngroups; 97 102 HostTableGroup *groups = HostTableGroups (table, &Ngroups); … … 103 108 UpdateObjectOffsets_parallel_group (&groups[i], sky); 104 109 } 110 # endif 105 111 106 112 return TRUE; … … 224 230 return TRUE; 225 231 } 232 233 // CATDIR is supplied globally 234 # define DEBUG 1 235 int UpdateObjectOffsets_parallel_table (HostTable *table, SkyList *sky) { 236 237 // launch the relastro_client jobs to the parallel hosts 238 239 int i, j; 240 for (i = 0; i < table->Nhosts; i++) { 241 242 if (sky->Nregions < table->Nhosts) { 243 // do any of the regions want this host? 244 int wantThisHost = FALSE; 245 for (j = 0; j < sky->Nregions; j++) { 246 if (HostTableTestHost (sky->regions[j], table->hosts[i].hostID)) { 247 wantThisHost = TRUE; 248 break; 249 } 250 } 251 if (!wantThisHost) { 252 // fprintf (stderr, "skip host %s\n", table->hosts[i].hostname); 253 continue; 254 } 255 } 256 257 // ensure that the paths are absolute path names 258 char *tmppath = abspath (table->hosts[i].pathname, DVO_MAX_PATH); 259 free (table->hosts[i].pathname); 260 table->hosts[i].pathname = tmppath; 261 262 // options / arguments that can affect relastro_client -load: 263 // VERBOSE, VERBOSE2 264 // RESET (-reset) 265 // TimeSelect -time 266 // (note that psfQF is applied rigidly at 0.85, as is the galaxy test) 267 // ImagSelect, ImagMin, ImagMax 268 // MaxDensityUse, MaxDensityValue 269 270 char command[1024]; 271 snprintf (command, 1024, "relastro_client -update-offsets -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f", 272 table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR); 273 274 if (FIT_MODE == FIT_PM_ONLY) strextend (command, "-pm"); 275 if (FIT_MODE == FIT_PAR_ONLY) strextend (command, "-par"); 276 if (FIT_MODE == FIT_PM_AND_PAR) strextend (command, "-pmpar"); 277 278 if (VERBOSE) strextend (command, "-v"); 279 if (VERBOSE2) strextend (command, "-vv"); 280 if (RESET) strextend (command, "-reset"); 281 if (UPDATE) strextend (command, "-update"); 282 283 if (RESET_BAD_IMAGES) strextend (command, "-reset-bad-images"); 284 285 if (ImagSelect) strextend (command, "-instmag %f %f", ImagMin, ImagMax); 286 if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue); 287 288 if (USE_BASIC_CHECK) strextend (command, "-basic-image-search"); 289 if (FlagOutlier) strextend (command, "-clip %d", CLIP_THRESH); 290 if (ExcludeBogus) strextend (command, "-exclude-bogus %f", ExcludeBogusRadius); 291 292 if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 293 294 if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST); 295 if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST); 296 if (PhotFlagSelect) strextend (command, "+photflags"); 297 if (PhotFlagBad) strextend (command, "+photflagbad %d", PhotFlagBad); 298 if (PhotFlagPoor) strextend (command, "+photflagpoor %d", PhotFlagPoor); 299 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 300 301 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 302 strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 303 } 304 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 305 strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 306 } 307 308 if (MinBadQF > 0.0) strextend (command, "-min-bad-psfqf %f", MinBadQF); 309 if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset %f", MaxMeanOffset); 310 311 if (TimeSelect) { 312 char *tstart = ohana_sec_to_date (TSTART); 313 char *tstop = ohana_sec_to_date (TSTOP); 314 strextend (command, "-time %s %s", tstart, tstop); 315 free (tstart); 316 free (tstop); 317 } 318 fprintf (stderr, "command: %s\n", command); 319 320 if (PARALLEL_MANUAL) continue; 321 322 if (PARALLEL_SERIAL) { 323 int status = system (command); 324 if (status) { 325 fprintf (stderr, "ERROR running relastro_client\n"); 326 exit (2); 327 } 328 } else { 329 // launch the job on the remote machine (no handshake) 330 int errorInfo = 0; 331 int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE); 332 if (!pid) { 333 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo); 334 exit (1); 335 } 336 table->hosts[i].pid = pid; // save for future reference 337 } 338 } 339 340 if (PARALLEL_MANUAL) { 341 fprintf (stderr, "run the relastro_client commands above. when these are done, hit return\n"); 342 getchar(); 343 } 344 if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) { 345 HostTableWaitJobsGetIO (table, __FILE__, __LINE__, VERBOSE); 346 } 347 348 return TRUE; 349 } -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/args.c
r37446 r37699 372 372 } 373 373 374 CHIPMAP = FALSE;374 CHIPMAP = 0; 375 375 if ((N = get_argument (argc, argv, "-chipmap"))) { 376 376 remove_argument (N, &argc, argv); 377 CHIPMAP = TRUE; 377 CHIPMAP = atoi(argv[N]); 378 remove_argument (N, &argc, argv); 379 378 380 } 379 381 … … 405 407 RESET = TRUE; 406 408 } 407 408 409 RESET_BAD_IMAGES = FALSE; 409 410 if ((N = get_argument (argc, argv, "-reset-bad-images"))) { 410 411 remove_argument (N, &argc, argv); 411 412 RESET_BAD_IMAGES = TRUE; 413 } 414 RESET_IMAGES = FALSE; 415 if ((N = get_argument (argc, argv, "-reset-images"))) { 416 remove_argument (N, &argc, argv); 417 RESET_IMAGES = TRUE; 412 418 } 413 419 … … 874 880 fprintf (stderr, " -high-speed (code[,code,code]) (code[,code,code]) (radius) (output catdir)\n"); 875 881 fprintf (stderr, " -hpm (radius) (output catdir)\n"); 882 fprintf (stderr, " -chipmap (MaxOrder)\n"); 876 883 fprintf (stderr, " -merge-source (objID) (catID) into (objID) (catID)\n\n"); 877 884 … … 886 893 fprintf (stderr, " -statmode (mode)\n"); 887 894 fprintf (stderr, " -reset\n"); 895 fprintf (stderr, " -reset-images\n"); 888 896 fprintf (stderr, " -nloop (N) : number of image-fit iterations\n"); 889 897 fprintf (stderr, " -update : apply new fit to database\n"); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/launch_region_hosts.c
r37665 r37699 128 128 if (PhotFlagPoor) strextend (command, "+photflagpoor %d", PhotFlagPoor); 129 129 130 if (CHIPMAP) strextend (command, "-chipmap %d", CHIPMAP); 131 if (RESET_IMAGES) strextend (command, "-reset-images"); 132 130 133 if (MinBadQF > 0.0) strextend (command, "-min-bad-psfqf %f", MinBadQF); 131 134 if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset %f", MaxMeanOffset); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_images.c
r37684 r37699 70 70 71 71 case TARGET_CHIPS: 72 if (RESET_IMAGES) UpdateMeasures (catalog, Ncatalog); 72 73 for (i = 0; i < NLOOP; i++) { 73 74 UpdateObjects (catalog, Ncatalog, (i > 0)); // calculate <R>,<D>; if (i > 0), apply Galaxy Motion Model (if desired) -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_parallel_images.c
r37694 r37699 103 103 case TARGET_CHIPS: 104 104 for (i = 0; i < NLOOP; i++) { 105 if (RESET_IMAGES) UpdateMeasures (catalog, Ncatalog); 105 106 UpdateObjects (catalog, Ncatalog, (i > 0)); 106 107 if ((i > 1) || !USE_GALAXY_MODEL) { -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_parallel_regions.c
r37665 r37699 63 63 64 64 if (PARALLEL) { 65 // save the updated image parameters 65 // save the updated image parameters. if we are NOT PARALLEL, we have to wait 66 // until after UpdateObjectOffsets, or the image parameters are swapped and/or freed 67 save_astrom_table (); 66 68 dvo_image_save (&db, VERBOSE); 67 69 dvo_image_unlock (&db); … … 73 75 if (!PARALLEL) { 74 76 // save the changes to the image parameters 77 save_astrom_table (); 75 78 dvo_image_save (&db, VERBOSE); 76 79 dvo_image_unlock (&db); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/share_images_pos.c
r37665 r37699 84 84 continue; 85 85 } 86 Coords *moscoords = images[seq].coords.mosaic; 86 87 images[seq].coords = image_pos[i].coords ; 88 images[seq].coords.mosaic = moscoords; 89 87 90 images[seq].dXpixSys = image_pos[i].dXpixSys ; 88 91 images[seq].dYpixSys = image_pos[i].dYpixSys ; … … 108 111 if (seq < 0) continue; 109 112 110 images[seq].coords.offsetMap = table->map[j]; 111 // is this sufficient? 113 AstromOffsetMap *oldMap = images[seq].coords.offsetMap; 114 AstromOffsetMap *newMap = table->map[j]; 115 116 if (oldMap) { 117 AstromOffsetMapSetOrder (oldMap, newMap->Nx, newMap->Ny, &images[seq]); 118 AstromOffsetMapCopyData (oldMap, newMap); 119 } else { 120 lockUpdateChips (); 121 AstromOffsetTable *FullTable = get_astrom_table (); 122 AstromOffsetTableNewMap(FullTable, newMap->Nx, newMap->Ny, &images[seq]); // registers the map with the image 123 unlockUpdateChips (); 124 AstromOffsetMapCopyData (images[seq].coords.offsetMap, newMap); // oldMap is now not valid 125 } 112 126 } 127 AstromOffsetTableFree(table); 113 128 } 114 129
Note:
See TracChangeset
for help on using the changeset viewer.
