Changeset 36833 for trunk/Ohana/src/relastro
- Timestamp:
- Jun 7, 2014, 6:33:11 AM (12 years ago)
- Location:
- trunk/Ohana/src/relastro
- Files:
-
- 18 edited
-
Makefile (modified) (1 diff)
-
include/relastro.h (modified) (7 diffs)
-
src/BrightCatalog.c (modified) (8 diffs)
-
src/FitChip.c (modified) (7 diffs)
-
src/GetAstromError.c (modified) (2 diffs)
-
src/ImageOps.c (modified) (12 diffs)
-
src/UpdateObjectOffsets.c (modified) (1 diff)
-
src/UpdateObjects.c (modified) (14 diffs)
-
src/args.c (modified) (6 diffs)
-
src/bcatalog.c (modified) (10 diffs)
-
src/dvo_astrom_ops.c (modified) (2 diffs)
-
src/initialize.c (modified) (2 diffs)
-
src/launch_region_hosts.c (modified) (3 diffs)
-
src/load_catalogs.c (modified) (8 diffs)
-
src/relastro_client.c (modified) (1 diff)
-
src/relastro_images.c (modified) (2 diffs)
-
src/relastro_objects.c (modified) (1 diff)
-
src/relastro_parallel_images.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relastro/Makefile
r36630 r36833 127 127 $(SRC)/plotstuff.$(ARCH).o \ 128 128 $(SRC)/relastroVisual.$(ARCH).o \ 129 $(SRC)/syncfile.$(ARCH).o \ 129 130 $(SRC)/BrightCatalog.$(ARCH).o 130 131 -
trunk/Ohana/src/relastro/include/relastro.h
r36630 r36833 83 83 double L, M; /* Focal Plane - pixels */ 84 84 double X, Y; /* Chip Coords - pixels */ 85 double Mag; 86 double dMag; 87 double dPos; 85 float Mag; 86 float Color; 87 float dMag; 88 float dPos; 88 89 int mask; 89 90 int Nmeas; … … 207 208 double MaxDensityValue; 208 209 209 char *PHOTCODE_KEEP_LIST, *PHOTCODE_SKIP_LIST ;210 int NphotcodesKeep, NphotcodesSkip ;211 PhotCode **photcodesKeep, **photcodesSkip ;210 char *PHOTCODE_KEEP_LIST, *PHOTCODE_SKIP_LIST, *PHOTCODE_RESET_LIST; 211 int NphotcodesKeep, NphotcodesSkip, NphotcodesReset; 212 PhotCode **photcodesKeep, **photcodesSkip, **photcodesReset; 212 213 213 214 char *PHOTCODE_A_LIST, *PHOTCODE_B_LIST; … … 217 218 SkyRegionSelection SELECTION; 218 219 220 char *DCR_COLOR_POS, *DCR_COLOR_NEG; 221 PhotCode *DCR_PHOTCODE_POS, *DCR_PHOTCODE_NEG; 222 int DCR_NSEC_POS, DCR_NSEC_NEG; 223 219 224 int ImagSelect; 220 225 double ImagMin, ImagMax; … … 233 238 int CLIP_THRESH; 234 239 int USE_BASIC_CHECK; 240 241 int ExcludeBogus; 242 double ExcludeBogusRadius; 235 243 236 244 FitMode FIT_MODE; … … 307 315 int liststats PROTO((double *value, double *dvalue, int N, StatType *stats)); 308 316 int liststats_pos PROTO((double *value, double *dvalue, int N, StatType *stats, int XVERB)); 309 Catalog *load_catalogs PROTO((SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath ));317 Catalog *load_catalogs PROTO((SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath, char *syncfile)); 310 318 int load_images PROTO((FITS_DB *db, SkyList *skylist, int UseFullOverlap)); 311 319 Image *select_images PROTO((SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage, int UseFullOverlap)); … … 417 425 int setMeanR (double ra_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt); 418 426 int setMeanD (double dec_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt); 427 double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt); 428 double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt); 419 429 int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt); 420 430 int setMeanD_Big (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt); … … 521 531 int ImageTableSave (char *filename, Image *images, off_t Nimages); 522 532 int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage); 533 534 float getColor (off_t meas, int cat); 535 536 int strextend (char *input, char *format,...); 537 538 int areImagesLoaded (); 539 int areImagesMatched (); -
trunk/Ohana/src/relastro/src/BrightCatalog.c
r35105 r36833 167 167 GET_COLUMN(measureOffset, "OFF_MEASURE", int); 168 168 GET_COLUMN(missingOffset, "OFF_MISSING", int); 169 GET_COLUMN( extendOffset, "OFF_EXTEND", int);169 GET_COLUMN(refColor, "REF_COLOR", float); 170 170 GET_COLUMN(flags, "FLAGS", int); 171 171 GET_COLUMN(photFlagsUpper, "PHOTFLAGS_U", int); … … 202 202 average[i].measureOffset = measureOffset[i] ; 203 203 average[i].missingOffset = missingOffset[i] ; 204 average[i]. extendOffset = extendOffset[i] ;204 average[i].refColor = refColor[i] ; 205 205 average[i].flags = flags[i] ; 206 206 average[i].photFlagsUpper = photFlagsUpper[i] ; … … 234 234 free (measureOffset); 235 235 free (missingOffset); 236 free ( extendOffset);236 free (refColor); 237 237 free (flags); 238 238 free (photFlagsUpper); … … 476 476 gfits_define_bintable_column (&theader, "J", "OFF_MEASURE", "offset to first psf measurement", "", 1.0, 1.0*0x8000); 477 477 gfits_define_bintable_column (&theader, "J", "OFF_MISSING", "offset to first missing obs", "", 1.0, 1.0*0x8000); 478 gfits_define_bintable_column (&theader, " J", "OFF_EXTEND", "offset to first extended measurement", "", 1.0, 1.0*0x8000);478 gfits_define_bintable_column (&theader, "E", "REF_COLOR", "reference color", "", 1.0, 0.0); 479 479 gfits_define_bintable_column (&theader, "J", "FLAGS", "average object flags (star; ghost; etc)", "", 1.0, 1.0*0x8000); 480 480 gfits_define_bintable_column (&theader, "J", "PHOTFLAGS_U", "upper bit of 2 bit summary of per-measure photflags", "", 1.0, 1.0*0x8000); … … 510 510 int *measureOffset ; ALLOCATE (measureOffset , int , catalog->Naverage); 511 511 int *missingOffset ; ALLOCATE (missingOffset , int , catalog->Naverage); 512 int *extendOffset ; ALLOCATE (extendOffset , int , catalog->Naverage);512 float *refColor ; ALLOCATE (refColor , float , catalog->Naverage); 513 513 int *flags ; ALLOCATE (flags , int , catalog->Naverage); 514 514 int *photFlagsUpper; ALLOCATE (photFlagsUpper, int , catalog->Naverage); … … 543 543 measureOffset[i] = average[i].measureOffset ; 544 544 missingOffset[i] = average[i].missingOffset ; 545 extendOffset[i] = average[i].extendOffset;545 refColor[i] = average[i].refColor ; 546 546 flags[i] = average[i].flags ; 547 547 photFlagsUpper[i] = average[i].photFlagsUpper ; … … 575 575 gfits_set_bintable_column (&theader, &ftable, "OFF_MEASURE", measureOffset, catalog->Naverage); 576 576 gfits_set_bintable_column (&theader, &ftable, "OFF_MISSING", missingOffset, catalog->Naverage); 577 gfits_set_bintable_column (&theader, &ftable, " OFF_EXTEND", extendOffset,catalog->Naverage);577 gfits_set_bintable_column (&theader, &ftable, "REF_COLOR", refColor, catalog->Naverage); 578 578 gfits_set_bintable_column (&theader, &ftable, "FLAGS", flags, catalog->Naverage); 579 579 gfits_set_bintable_column (&theader, &ftable, "PHOTFLAGS_U", photFlagsUpper, catalog->Naverage); … … 605 605 free (measureOffset); 606 606 free (missingOffset); 607 free ( extendOffset);607 free (refColor); 608 608 free (flags); 609 609 free (photFlagsUpper); -
trunk/Ohana/src/relastro/src/FitChip.c
r33652 r36833 4 4 int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image) { 5 5 6 int i, NstatFull, Nstat, Niter ;6 int i, NstatFull, Nstat, Niter, Nkeep; 7 7 float dLsig, dMsig, dRsig; 8 8 float dLsigFull, dMsigFull, dRsigFull; … … 24 24 25 25 // measure the scatter distribution (use only the bright end detections) 26 Nkeep = 0; 26 27 for (i = 0; i < Nmatch; i++) { 27 28 if (raw[i].mask) continue; … … 42 43 continue; 43 44 } 44 } 45 Nkeep ++; 46 } 47 48 // I'm rejecting some points from the fit above; I count the remainders and actually 49 // use that count to set order_use below 45 50 46 51 // figures to assess the fitting process: … … 50 55 relastroVisualPlotChipFit(raw, ref, dRmax, Nmatch); 51 56 52 // fit the requested order polynomial 53 if (CHIPORDER > 0) { 54 int Ndof_min = 3; 55 int order_max = 0.5*(sqrt(4*Nmatch - 4*Ndof_min + 1) - 3); 56 int order_use = MIN (CHIPORDER, order_max); 57 if (order_use < 1) { 58 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nmatch); 59 image[0].flags |= ID_IMAGE_ASTROM_FEW; 60 return FALSE; 61 } 62 image[0].coords.Npolyterms = order_use; 63 } 57 // set the maximum order for the polynomial (based on number of stars kept above) 58 int order_use = 0; 59 if (Nkeep > 5) order_use = 1; // 4 stars per polynomial term (per dimension) 60 if (Nkeep > 30) order_use = 2; // 5 stars per polynomial term (per dimension) 61 if (Nkeep > 60) order_use = 3; // 6 stars per polynomial term (per dimension) 62 if (order_use < 1) { 63 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nkeep); 64 image[0].flags |= ID_IMAGE_ASTROM_FEW; 65 return FALSE; 66 } 67 image[0].coords.Npolyterms = order_use; 64 68 65 69 if (fit) fit_free (fit); … … 71 75 fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos); 72 76 } 73 74 # if (0)75 // check if the fit has enough data points for the polynomial order76 skip = FALSE;77 switch (image[0].coords.Npolyterms) {78 case 0:79 case 1:80 skip = (fit[0].Npts < 8);81 break;82 case 2:83 skip = (fit[0].Npts < 11);84 break;85 case 3:86 skip = (fit[0].Npts < 15);87 break;88 default:89 fprintf (stderr, "invalid chip order %d\n", image[0].coords.Npolyterms);90 skip = TRUE;91 }92 if (skip) {93 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for requested order (%d)\n", fit[0].Npts, image[0].coords.Npolyterms);94 fit_free (fit);95 image[0].flags |= ID_IMAGE_ASTROM_FEW;96 return FALSE;97 }98 # endif99 77 100 78 // measure the fit, update the coords & object coordinates … … 134 112 } 135 113 114 int Ncolor = 0; 115 float *colorList = NULL; 116 ALLOCATE (colorList, float, Nmatch); 117 118 for (i = 0; i < Nmatch; i++) { 119 if (!raw[i].mask) continue; 120 if (!isnan(ref[i].Color)) { 121 colorList[Ncolor] = ref[i].Color; 122 Ncolor ++; 123 } 124 } 125 fsort (colorList, Ncolor); 126 float colorMedian = (Ncolor > 0) ? colorList[(int)(0.5*Ncolor)] : NAN; 127 image[0].refColor = colorMedian; 128 free (colorList); 129 136 130 GetScatterRawRef(&dLsigFull, &dMsigFull, &dRsigFull, &NstatFull, raw, ref, Nmatch, SIGMA_LIM); 137 131 GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nmatch, IMFIT_SYS_SIGMA_LIM); … … 151 145 image[0].dYpixSys = dMsig; 152 146 image[0].nFitAstrom = fit[0].Npts; 147 148 // fprintf (stderr, "%s %6.3f %4d %4d\n", image[0].name, image[0].refColor, Ncolor, image[0].nFitAstrom); 153 149 154 150 if (fit) fit_free (fit); -
trunk/Ohana/src/relastro/src/GetAstromError.c
r33652 r36833 30 30 31 31 code = GetPhotcodebyCode (measure[0].photcode); 32 if (!code) return NAN; 32 33 33 34 // do not raise an exception, just send back the result … … 72 73 73 74 code = GetPhotcodebyCode (measure[0].photcode); 75 if (!code) return NAN; 74 76 75 77 // do not raise an exception, just send back the result -
trunk/Ohana/src/relastro/src/ImageOps.c
r36630 r36833 39 39 // N_onImage was 'Nlist' 40 40 // N_ONIMAGE was 'NLIST' 41 42 int areImagesLoaded () { 43 44 if (image) return TRUE; 45 return FALSE; 46 } 47 48 int areImagesMatched () { 49 50 if (MeasureToImage) return TRUE; 51 return FALSE; 52 } 41 53 42 54 Image *getimages (off_t *N, off_t **line_number) { … … 333 345 */ 334 346 347 float getColor (off_t meas, int cat) { 348 349 off_t i; 350 351 i = MeasureToImage[cat][meas]; 352 if (i == -1) return (NAN); 353 return (image[i].refColor); 354 } 355 335 356 void plot_images () { 336 357 … … 468 489 } 469 490 491 X = measure[0].Xccd; 492 Y = measure[0].Yccd; 470 493 if (USE_FIXED_PIXCOORDS) { 471 X = isfinite(measure[0].Xfix) ? measure[0].Xfix : measure[0].Xccd; 472 Y = isfinite(measure[0].Yfix) ? measure[0].Yfix : measure[0].Yccd; 473 } else { 474 X = measure[0].Xccd; 475 Y = measure[0].Yccd; 494 if (isfinite(measure[0].Xfix) && isfinite(measure[0].Yfix)) { 495 float dX = measure[0].Xfix - measure[0].Xccd; 496 float dY = measure[0].Yfix - measure[0].Yccd; 497 if (hypot(dX,dY) < 2.0) { 498 X = measure[0].Xfix; 499 Y = measure[0].Yfix; 500 } 501 } 476 502 } 477 503 n = measure[0].averef; … … 560 586 561 587 int Noff = NoffRAave + NoffDECave + NoffRAori + NoffDECori; 562 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);588 if (VERBOSE2 && (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); 563 589 saveOffsets (dPos, nPos, im); 564 590 … … 609 635 Measure *measure = &catalog[c].measure[m]; 610 636 637 X = measure[0].Xccd; 638 Y = measure[0].Yccd; 611 639 if (USE_FIXED_PIXCOORDS) { 612 X = isfinite(measure[0].Xfix) ? measure[0].Xfix : measure[0].Xccd; 613 Y = isfinite(measure[0].Yfix) ? measure[0].Yfix : measure[0].Yccd; 614 } else { 615 X = measure[0].Xccd; 616 Y = measure[0].Yccd; 640 if (isfinite(measure[0].Xfix) && isfinite(measure[0].Yfix)) { 641 float dX = measure[0].Xfix - measure[0].Xccd; 642 float dY = measure[0].Yfix - measure[0].Yccd; 643 if (hypot(dX,dY) < 2.0) { 644 X = measure[0].Xfix; 645 Y = measure[0].Yfix; 646 } 647 } 617 648 } 618 649 n = measure[0].averef; … … 679 710 680 711 /* apply the current image transformation or use the current value of R+dR, D+dD? */ 712 raw[i].X = measure[0].Xccd; 713 raw[i].Y = measure[0].Yccd; 681 714 if (USE_FIXED_PIXCOORDS) { 682 raw[i].X = isfinite(measure[0].Xfix) ? measure[0].Xfix : measure[0].Xccd; 683 raw[i].Y = isfinite(measure[0].Yfix) ? measure[0].Yfix : measure[0].Yccd; 684 } else { 685 raw[i].X = measure[0].Xccd; 686 raw[i].Y = measure[0].Yccd; 687 } 688 715 if (isfinite(measure[0].Xfix) && isfinite(measure[0].Yfix)) { 716 float dX = measure[0].Xfix - measure[0].Xccd; 717 float dY = measure[0].Yfix - measure[0].Yccd; 718 if (hypot(dX,dY) < 2.0) { 719 raw[i].X = measure[0].Xfix; 720 raw[i].Y = measure[0].Yfix; 721 } 722 } 723 } 689 724 raw[i].Mag = measure[0].M; 690 725 raw[i].dMag = measure[0].dM; … … 738 773 StarData *ref; 739 774 775 int Nsecfilt = GetPhotcodeNsecfilt(); 776 740 777 mosaic = NULL; 741 778 moscoords = NULL; … … 765 802 ref[i].dMag = measure[0].dM; 766 803 ref[i].dPos = GetAstromErrorTiny (&measure[0], ERROR_MODE_POS); 804 805 if ((DCR_NSEC_POS >= 0) && (DCR_NSEC_NEG >= -1)) { 806 ref[i].Color = catalog[c].secfilt[n*Nsecfilt + DCR_NSEC_POS].M - catalog[c].secfilt[n*Nsecfilt + DCR_NSEC_NEG].M; 807 } 767 808 768 809 ref[i].mask = FALSE; … … 859 900 N = 0; 860 901 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) { 861 // reset flag on each invocation902 // reset flag on each invocation 862 903 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM; 863 904 … … 898 939 double *R, *D, *dR, *dD, *d2; 899 940 StatType statsR, statsD; 941 942 // XXX we are not going to use this for now 943 return; 900 944 901 945 Nsecfilt = GetPhotcodeNsecfilt(); … … 1063 1107 } else { 1064 1108 code = GetPhotcodebyCode (measure[0].photcode); 1109 if (!code) return FALSE; 1065 1110 mask = code[0].astromBadMask; 1066 1111 } … … 1129 1174 } else { 1130 1175 code = GetPhotcodebyCode (measure[0].photcode); 1176 if (!code) return FALSE; 1131 1177 mask = code[0].astromBadMask; 1132 1178 } -
trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
r35763 r36833 126 126 table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR); 127 127 128 char tmpline[1024]; 129 if (FIT_MODE == FIT_PM_ONLY) { snprintf (tmpline, 1024, "%s -pm", command); strcpy (command, tmpline); } 130 if (FIT_MODE == FIT_PAR_ONLY) { snprintf (tmpline, 1024, "%s -par", command); strcpy (command, tmpline); } 131 if (FIT_MODE == FIT_PM_AND_PAR) { snprintf (tmpline, 1024, "%s -pmpar", command); strcpy (command, tmpline); } 132 133 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 134 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 135 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 136 if (UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline); } 137 138 if (RESET_BAD_IMAGES) { snprintf (tmpline, 1024, "%s -reset-bad-images", command); strcpy (command, tmpline); } 139 140 if (ImagSelect) { snprintf (tmpline, 1024, "%s -instmag %f %f", command, ImagMin, ImagMax); strcpy (command, tmpline); } 141 if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue); strcpy (command, tmpline); } 128 if (FIT_MODE == FIT_PM_ONLY) strextend (command, "-pm"); 129 if (FIT_MODE == FIT_PAR_ONLY) strextend (command, "-par"); 130 if (FIT_MODE == FIT_PM_AND_PAR) strextend (command, "-pmpar"); 131 132 if (VERBOSE) strextend (command, "-v"); 133 if (VERBOSE2) strextend (command, "-vv"); 134 if (RESET) strextend (command, "-reset"); 135 if (UPDATE) strextend (command, "-update"); 136 137 if (RESET_BAD_IMAGES) strextend (command, "-reset-bad-images"); 138 139 if (ImagSelect) strextend (command, "-instmag %f %f", ImagMin, ImagMax); 140 if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue); 142 141 143 if (USE_BASIC_CHECK) { snprintf (tmpline, 1024, "%s -basic-image-search", command); strcpy (command, tmpline); } 144 if (FlagOutlier) { snprintf (tmpline, 1024, "%s -clip %d", command, CLIP_THRESH); strcpy (command, tmpline); } 142 if (USE_BASIC_CHECK) strextend (command, "-basic-image-search"); 143 if (FlagOutlier) strextend (command, "-clip %d", CLIP_THRESH); 144 if (ExcludeBogus) strextend (command, "-exclude-bogus %f", ExcludeBogusRadius); 145 145 146 if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command); strcpy (command, tmpline); }147 148 if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }149 if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }150 if (PhotFlagSelect) { snprintf (tmpline, 1024, "%s +photflags", command); strcpy (command, tmpline); }151 if (PhotFlagBad) { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad); strcpy (command, tmpline); }152 if (PhotFlagPoor) { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor); strcpy (command, tmpline); }146 if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 147 148 if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST); 149 if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST); 150 if (PhotFlagSelect) strextend (command, "+photflags"); 151 if (PhotFlagBad) strextend (command, "+photflagbad %d", PhotFlagBad); 152 if (PhotFlagPoor) strextend (command, "+photflagpoor %d", PhotFlagPoor); 153 153 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 154 154 155 if (MinBadQF > 0.0) { snprintf (tmpline, 1024, "%s -min-bad-psfqf %f", command, MinBadQF); strcpy (command, tmpline); } 156 if (MaxMeanOffset != 10.0) { snprintf (tmpline, 1024, "%s -max-mean-offset %f", command, MaxMeanOffset); strcpy (command, tmpline); } 155 if (DCR_COLOR_POS && DCR_COLOR_NEG) { 156 strextend (command, "-dcr-color %s %s", DCR_COLOR_POS, DCR_COLOR_NEG); 157 } 158 159 if (MinBadQF > 0.0) strextend (command, "-min-bad-psfqf %f", MinBadQF); 160 if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset %f", MaxMeanOffset); 157 161 158 162 if (TimeSelect) { 159 163 char *tstart = ohana_sec_to_date (TSTART); 160 164 char *tstop = ohana_sec_to_date (TSTOP); 161 s nprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop);165 strextend (command, "-time %s %s", tstart, tstop); 162 166 free (tstart); 163 167 free (tstop); 164 strcpy (command, tmpline);165 168 } 166 169 fprintf (stderr, "command: %s\n", command); -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r36630 r36833 10 10 static double *T; 11 11 static double *dT; 12 static double *C; 12 13 13 14 void initObjectData (Catalog *catalog, int Ncatalog) { … … 36 37 ALLOCATE (pX, double, MAX (1, Nmax)); 37 38 ALLOCATE (pY, double, MAX (1, Nmax)); 39 40 ALLOCATE (C, double, MAX (1, Nmax)); 38 41 } 39 42 … … 54 57 free (pX); 55 58 free (pY); 59 60 free (C); 56 61 } 57 62 … … 61 66 62 67 off_t j, k, m; 63 int i, N, N secfilt, mode, result, status, XVERB;68 int i, N, Nc, Nsecfilt, mode, result, status, XVERB; 64 69 StatType statsR, statsD; 65 70 Coords coords; … … 75 80 memset (&fitPAR, 0, sizeof(fitPAR)); 76 81 initObjectData (catalog, Ncatalog); 82 83 int setRefColor = areImagesMatched(); 77 84 78 85 /* project coordinates to a plane centered on the object with units of arcsec */ … … 112 119 fitPAR.chisq = NAN; 113 120 121 // if we fail to fit the astrometry for some reason, we need to set/reset these 122 catalog[i].average[j].flags |= ID_STAR_NO_ASTROM; 123 catalog[i].average[j].ChiSqAve = NAN; 124 catalog[i].average[j].ChiSqPM = NAN; 125 catalog[i].average[j].ChiSqPar = NAN; 126 catalog[i].average[j].Npos = 0; 127 114 128 if (catalog[i].average[j].Nmeasure == 0) { 115 continue; 116 } 117 129 continue; 130 } 131 132 Nc = 0; 118 133 N = 0; 119 134 m = catalog[i].average[j].measureOffset; … … 138 153 } 139 154 155 // reset the bit to note that a detection was used (or not) 156 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 157 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; } 158 140 159 // does the measurement pass the supplied filtering constraints? 141 160 // MeasFilterTestTiny does not test psfQF 161 // exclude bad detections based on: photcodes, psfQF, time range, photflags & astromBadMask, mag_inst 142 162 int keepMeasure = measureBig ? MeasFilterTest(&measureBig[k], FALSE) : MeasFilterTestTiny(&measure[k], FALSE); 143 163 if (!keepMeasure) { 144 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ;145 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; }146 164 continue; 147 165 } 148 166 167 // mark (as POOR) any measurements which are deviant from the mean by > ExcludeBogusRadius 168 if (ExcludeBogus) { 169 double Ri = getMeanR (&measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 170 double Di = getMeanD (&measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 171 coords.crval1 = catalog[i].average[j].R; 172 coords.crval2 = catalog[i].average[j].D; 173 double Xi, Yi; 174 RD_to_XY (&Xi, &Yi, Ri, Di, &coords); 175 double radius = hypot(Xi, Yi); 176 if (radius > ExcludeBogusRadius) { 177 measure[k].dbFlags |= ID_MEAS_POOR_ASTROM; 178 if (measureBig) { measureBig[k].dbFlags |= ID_MEAS_POOR_ASTROM; } 179 continue; 180 } 181 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM; 182 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_POOR_ASTROM; } 183 } 184 149 185 // outlier rejection 150 if (FlagOutlier && (measure[k].dbFlags & ID_MEAS_POOR_ASTROM)) { 151 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 152 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; } 186 if (FALSE && FlagOutlier && (measure[k].dbFlags & ID_MEAS_POOR_ASTROM)) { 153 187 continue; 154 188 } 155 156 measure[k].dbFlags |= ID_MEAS_USED_OBJ;157 if (measureBig) { measureBig[k].dbFlags |= ID_MEAS_USED_OBJ; }158 189 159 190 R[N] = getMeanR (&measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); … … 170 201 // allow a given photcode or measurement to be 171 202 // ignored if the error is NAN (for photcode, set astromErrSys to NaN) 172 if (isnan(dX[N])) { 173 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 174 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; } 175 continue; 176 } 177 if (isnan(dY[N])) { 178 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 179 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; } 180 continue; 181 } 203 if (isnan(dX[N])) continue; 204 if (isnan(dY[N])) continue; 182 205 183 206 // add systematic error in quadrature, if desired … … 201 224 dD[N] = dY[N] / 3600.0; 202 225 226 if (setRefColor) { 227 float color = getColor (m+k, i); 228 if (!isnan(color)) { 229 C[Nc] = color; 230 Nc++; 231 } 232 } 233 234 measure[k].dbFlags |= ID_MEAS_USED_OBJ; 235 if (measureBig) { measureBig[k].dbFlags |= ID_MEAS_USED_OBJ; } 236 203 237 N++; 204 } 238 } // loop over measurements : catalog[i].average[j].Nmeasure 205 239 206 240 // if we have too few good detections for the desired fit, or too limited a 207 241 // baseline, use a fit with fewer parameters. XXX if we have too few measurements 208 242 // for even the average position, consider including the lower-quality detections? 209 210 catalog[i].average[j].flags &= ~ID_STAR_NO_ASTROM;211 243 212 244 // find Tmin & Tmax from the list of accepted measurements … … 231 263 // too few measurements for average position (require 2 values) 232 264 if (N < SRC_MEAS_TOOFEW) { 233 // XXX need to define PHOTOM and ASTROM object flags234 // XXX reset the average value fields?235 catalog[i].average[j].flags |= ID_STAR_NO_ASTROM;236 catalog[i].average[j].ChiSqAve = NAN;237 catalog[i].average[j].ChiSqPM = NAN;238 catalog[i].average[j].ChiSqPar = NAN;239 265 if (N < 2) continue; 240 266 } … … 268 294 catalog[i].average[j].flags |= ID_STAR_FIT_PM; 269 295 Npm ++; 296 297 // XXX a hard-wired hack... 298 if ((fabs(fitPM.uR) > 2.0) || (fabs(fitPM.uD) > 2.0)) { 299 mode = FIT_AVERAGE; 300 catalog[i].average[j].flags |= ID_STAR_BAD_PM; 301 } 270 302 } 271 303 272 304 if (mode == FIT_PM_AND_PAR) { 273 // fprintf (stderr, "parallax fitting is still untested (%s, %d)\n", __FILE__, __LINE__);274 275 305 float pXmin = +2.0; 276 306 float pXmax = -2.0; … … 296 326 catalog[i].average[j].flags |= ID_STAR_FIT_PAR; 297 327 Npar ++; 328 329 // XXX a hard-wired hack... 330 if ((fabs(fitPAR.uR) > 2.0) || (fabs(fitPAR.uD) > 2.0)) { 331 mode = FIT_AVERAGE; 332 catalog[i].average[j].flags |= ID_STAR_BAD_PM; 333 } 298 334 } else { 299 335 // need to set mode = FIT_PM_ONLY if we do not fit for parallax … … 321 357 catalog[i].average[j].flags |= ID_STAR_FIT_AVE; 322 358 Nave ++; 359 } 360 361 if (setRefColor) { 362 dsort (C, Nc); 363 float colorMedian = (Nc > 0) ? C[(int)(0.5*Nc)] : NAN; 364 catalog[i].average[j].refColor = colorMedian; 323 365 } 324 366 … … 411 453 catalog[i].average[j].Trange = (Trange * 86400 * 365.25); 412 454 catalog[i].average[j].Npos = fit.Nfit; 455 456 // unset the NO_ASTROM bit (not(NO_ASTROM) == HAVE_ASTROM) 457 catalog[i].average[j].flags &= ~ID_STAR_NO_ASTROM; 458 413 459 if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f) chisq=(%f, %f, %f)\n", 414 460 catalog[i].average[j].R, -
trunk/Ohana/src/relastro/src/args.c
r36630 r36833 179 179 FlagOutlier = FALSE; 180 180 if ((N = get_argument (argc, argv, "-clip"))) { 181 fprintf (stderr, "-clip is currently disabled\n"); 181 182 remove_argument (N, &argc, argv); 182 183 CLIP_THRESH = atof (argv[N]); 183 184 remove_argument (N, &argc, argv); 184 185 FlagOutlier = TRUE; 186 } 187 188 ExcludeBogus = FALSE; 189 ExcludeBogusRadius = 0.0; 190 if ((N = get_argument (argc, argv, "-exclude-bogus"))) { 191 remove_argument (N, &argc, argv); 192 ExcludeBogusRadius = atof (argv[N]); 193 remove_argument (N, &argc, argv); 194 ExcludeBogus = TRUE; 185 195 } 186 196 … … 284 294 } 285 295 296 DCR_COLOR_POS = NULL; 297 DCR_COLOR_NEG = NULL; 298 if ((N = get_argument (argc, argv, "-dcr-color"))) { 299 remove_argument (N, &argc, argv); 300 DCR_COLOR_POS = strcreate(argv[N]); 301 remove_argument (N, &argc, argv); 302 DCR_COLOR_NEG = strcreate(argv[N]); 303 remove_argument (N, &argc, argv); 304 } 305 306 PHOTCODE_RESET_LIST = NULL; 307 if ((N = get_argument (argc, argv, "-reset-to-photcode"))) { 308 remove_argument (N, &argc, argv); 309 PHOTCODE_RESET_LIST = strcreate(argv[N]); 310 remove_argument (N, &argc, argv); 311 } 312 286 313 PHOTCODE_KEEP_LIST = NULL; 287 314 if ((N = get_argument (argc, argv, "+photcode"))) { … … 291 318 } 292 319 293 PHOTCODE_SKIP_LIST = strcreate("SCOS.103a.E,SCOS.4414.OG590,SCOS.4415.OG590,SCOS.IIIaF.OG590,SCOS.IIIaF.RG610,SCOS.IIIaF.RG630,SCOS.IIIaJ.GG385,SCOS.IIIaJ.GG395,SCOS.IVN.RG715,SCOS.IVN.RG9"); 320 char *SuperCOSMOS_SKIP = strcreate("SCOS.103a.E,SCOS.4414.OG590,SCOS.4415.OG590,SCOS.IIIaF.OG590,SCOS.IIIaF.RG610,SCOS.IIIaF.RG630,SCOS.IIIaJ.GG385,SCOS.IIIaJ.GG395,SCOS.IVN.RG715,SCOS.IVN.RG9"); 321 322 PHOTCODE_SKIP_LIST = NULL; 294 323 if ((N = get_argument (argc, argv, "-photcode"))) { 295 324 remove_argument (N, &argc, argv); 296 char * tmp1= strcreate(argv[N]);297 298 int Ntotal = strlen(tmp1) + strlen(PHOTCODE_SKIP_LIST) + 5;299 300 char *tmp2 = NULL;301 ALLOCATE (tmp2, char, Ntotal);302 snprintf (tmp2, Ntotal, "%s,%s", PHOTCODE_SKIP_LIST, tmp1);303 304 free (tmp1);305 free (PHOTCODE_SKIP_LIST);306 307 PHOTCODE_SKIP_LIST = tmp2;325 char *RawSkip = strcreate(argv[N]); 326 327 char *GotSkip = strstr (RawSkip, SuperCOSMOS_SKIP); 328 if (!GotSkip) { 329 int Ntotal = strlen(RawSkip) + strlen(SuperCOSMOS_SKIP) + 5; 330 ALLOCATE (PHOTCODE_SKIP_LIST, char, Ntotal); 331 snprintf (PHOTCODE_SKIP_LIST, Ntotal, "%s,%s", SuperCOSMOS_SKIP, RawSkip); 332 free (RawSkip); 333 free (SuperCOSMOS_SKIP); 334 } else { 335 PHOTCODE_SKIP_LIST = RawSkip; 336 } 308 337 remove_argument (N, &argc, argv); 309 338 } … … 582 611 FlagOutlier = FALSE; 583 612 if ((N = get_argument (argc, argv, "-clip"))) { 613 fprintf (stderr, "-clip is currently disabled\n"); 584 614 remove_argument (N, &argc, argv); 585 615 CLIP_THRESH = atof (argv[N]); 586 616 remove_argument (N, &argc, argv); 587 617 FlagOutlier = TRUE; 618 } 619 620 ExcludeBogus = FALSE; 621 ExcludeBogusRadius = 0.0; 622 if ((N = get_argument (argc, argv, "-exclude-bogus"))) { 623 remove_argument (N, &argc, argv); 624 ExcludeBogusRadius = atof (argv[N]); 625 remove_argument (N, &argc, argv); 626 ExcludeBogus = TRUE; 588 627 } 589 628 … … 655 694 remove_argument (N, &argc, argv); 656 695 TimeSelect = TRUE; 696 } 697 698 DCR_COLOR_POS = NULL; 699 DCR_COLOR_NEG = NULL; 700 if ((N = get_argument (argc, argv, "-dcr-color"))) { 701 remove_argument (N, &argc, argv); 702 DCR_COLOR_POS = strcreate(argv[N]); 703 remove_argument (N, &argc, argv); 704 DCR_COLOR_NEG = strcreate(argv[N]); 705 remove_argument (N, &argc, argv); 706 } 707 708 PHOTCODE_RESET_LIST = NULL; 709 if ((N = get_argument (argc, argv, "-reset-to-photcode"))) { 710 remove_argument (N, &argc, argv); 711 PHOTCODE_RESET_LIST = strcreate(argv[N]); 712 remove_argument (N, &argc, argv); 657 713 } 658 714 … … 861 917 exit (2); 862 918 } 919 920 int strextend (char *input, char *format,...) { 921 922 char tmpextra[1024], tmpline[1024]; 923 va_list argp; 924 925 va_start (argp, format); 926 vsnprintf (tmpextra, 1024, format, argp); 927 snprintf (tmpline, 1024, "%s %s", input, tmpextra); 928 strcpy (input, tmpline); 929 930 return TRUE; 931 } -
trunk/Ohana/src/relastro/src/bcatalog.c
r34429 r36833 1 1 # include "relastro.h" 2 2 3 static int Nkeep1 = 0; 4 static int Nkeep2 = 0; 3 5 static int Nskip1 = 0; 4 6 static int Nskip2 = 0; 5 static unsigned int Tref = 1323353985; 6 static short Cref = 10355; 7 8 FILE *fbogus = NULL; 9 static int NskipBogus = 0; 10 11 // test image: 2013/06/15,13:25:51, GPC1.r.XY50 12 static int CHECK_TEST_IMAGE = FALSE; 13 // static unsigned int Tref = 1378812312; 14 // static short Cref = 10001; 15 16 static unsigned int Tref = 1379570672; 17 static short Cref = 10341; 18 19 int LimitDensityCatalog_ByNmeasureGrid (Catalog *subcatalog, Catalog *oldcatalog); 7 20 8 21 int bcatalog (Catalog *subcatalog, Catalog *catalog) { … … 11 24 off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm; 12 25 int Nsecfilt; 26 Coords coords; 27 28 /* for outlier rejection, project coordinates to a plane centered on the object with units of arcsec */ 29 coords.crval1 = 0; 30 coords.crval2 = 0; 31 coords.crpix1 = 0; 32 coords.crpix2 = 0; 33 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 34 coords.pc1_1 = coords.pc2_2 = 1.0; 35 coords.pc1_2 = coords.pc2_1 = 0.0; 36 coords.Npolyterms = 1; 37 strcpy (coords.ctype, "DEC--SIN"); 13 38 14 39 // XXX in the future, use catalog[0].Nsecfilt only? allow catalogs to have variable Nsecfilt? … … 34 59 ID_STAR_NO_ASTROM ; 35 60 61 if (VERBOSE2 && ExcludeBogus && (fbogus == NULL)) { 62 char name[1024]; 63 snprintf (name, 1024, "%s/bogus.%02d.dat", CATDIR, HOST_ID); 64 fbogus = fopen (name, "w"); 65 if (!fbogus) { 66 fprintf (stderr, "trouble opening bogus detection dump : %s\n", name); 67 } 68 } 69 36 70 /* exclude stars not in range or with too few measurements */ 37 71 for (i = 0; i < catalog[0].Naverage; i++) { … … 60 94 if (!MeasFilterTest(&catalog[0].measure[offset], TRUE)) { 61 95 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; 62 if ( FALSE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) {96 if (CHECK_TEST_IMAGE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { 63 97 Nskip1 ++; 64 98 } 65 99 continue; 66 100 } 67 68 // filter out outliers 69 if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) { 101 if (CHECK_TEST_IMAGE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { 102 Nkeep1 ++; 103 } 104 105 // filter out outliers - these are detections inconsistent with the offset distribution 106 // XXX disable this for now 107 if (FALSE && FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) { 70 108 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; 71 109 if (FALSE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { … … 76 114 catalog[0].measure[offset].dbFlags |= ID_MEAS_USED_CHIP; 77 115 116 // exclude bogus 117 if (ExcludeBogus) { 118 double Ri = getMeanR_Big (&catalog[0].measure[offset], &catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt]); 119 double Di = getMeanD_Big (&catalog[0].measure[offset], &catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt]); 120 coords.crval1 = catalog[0].average[i].R; 121 coords.crval2 = catalog[0].average[i].D; 122 double Xi, Yi; 123 RD_to_XY (&Xi, &Yi, Ri, Di, &coords); 124 double radius = hypot(Xi, Yi); 125 if (radius > ExcludeBogusRadius) { 126 NskipBogus ++; 127 if (VERBOSE2) { 128 FILE *foutput = fbogus ? fbogus : stderr; 129 char *date = ohana_sec_to_date(catalog[0].measure[offset].t); 130 fprintf (foutput, "exclude bogus: %10.6f %10.6f : %10.6f %10.6f : %6.2f %6.2f : %6.2f : %5d %s\n", catalog[0].average[i].R, catalog[0].average[i].D, Ri, Di, Xi, Yi, radius, catalog[0].measure[offset].photcode, date); 131 free (date); 132 } 133 continue; 134 } 135 } 136 78 137 // re-assess on each run of relastro if a measurement should be used 79 138 … … 87 146 // but before the final average properties are calculated, these measurements may be 88 147 // allowed. 148 149 if (CHECK_TEST_IMAGE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { 150 Nkeep2 ++; 151 } 89 152 90 153 CopyMeasureToTiny (&subcatalog[0].measureT[Nmeasure], &catalog[0].measure[offset]); … … 125 188 // limit the total number of stars in the catalog 126 189 if (MaxDensityUse) { 127 LimitDensityCatalog_ByNmeasure (subcatalog, catalog);190 LimitDensityCatalog_ByNmeasureGrid (subcatalog, catalog); 128 191 } else { 129 192 if (VERBOSE2) { … … 134 197 } 135 198 } 199 if (CHECK_TEST_IMAGE && (Nkeep1 + Nkeep2 + Nskip1 + Nskip2 > 0)) { 200 fprintf (stderr, "kept %d %d, skipped %d %d\n", Nkeep1, Nkeep2, Nskip1, Nskip2); 201 } 202 136 203 return (TRUE); 137 204 } 138 205 139 206 void bcatalog_show_skips () { 140 fprintf (stderr, "Nskip: %d, %d\n", Nskip1, Nskip2); 207 if (ExcludeBogus) { 208 if (fbogus) fclose (fbogus); 209 fprintf (stderr, "NskipBogus: %d\n", NskipBogus); 210 // fprintf (stderr, "Nskip: %d, %d\n", Nskip1, Nskip2); 211 // fprintf (stderr, "Nkeep: %d, %d\n", Nkeep1, Nkeep2); 212 } 141 213 } 142 214 … … 155 227 # undef COMPARE 156 228 229 } 230 231 /* generate a grid in a locally-projected coordinate system, try to select average entries 232 from each grid cell in decending Nmeasure order. 233 */ 234 int LimitDensityCatalog_ByNmeasureGrid (Catalog *subcatalog, Catalog *oldcatalog) { 235 236 off_t i, j; 237 int ix, iy; 238 239 Catalog tmpcatalog; 240 241 double Rmin, Rmax, Dmin, Dmax; 242 243 int Nsecfilt = GetPhotcodeNsecfilt (); 244 245 gfits_scan (&oldcatalog[0].header, "RA0", "%lf", 1, &Rmin); 246 gfits_scan (&oldcatalog[0].header, "DEC0", "%lf", 1, &Dmin); 247 gfits_scan (&oldcatalog[0].header, "RA1", "%lf", 1, &Rmax); 248 gfits_scan (&oldcatalog[0].header, "DEC1", "%lf", 1, &Dmax); 249 250 if (VERBOSE2) fprintf (stderr, "extracting from catalog covering region %f,%f to %f,%f\n", Rmin, Dmin, Rmax, Dmax); 251 252 float AREA = fabs(Dmax - Dmin) * fabs(Rmax - Rmin) * cos (0.5*RAD_DEG*(Dmax + Dmin)); 253 assert (AREA > 0); 254 255 off_t Nmax = MaxDensityValue * AREA; 256 if (subcatalog[0].Naverage <= Nmax) { 257 if (VERBOSE) { 258 fprintf (stderr, "subcatalog has less than the max density\n"); 259 } 260 return (TRUE); 261 } 262 263 off_t Naverage = subcatalog[0].Naverage; 264 265 // generate a grid in locally projected space 266 double Rc = 0.5*(Rmin + Rmax); 267 double Dc = 0.5*(Dmin + Dmax); 268 269 /* project coordinates to a plane centered on the object with units of arcsec */ 270 Coords coords; 271 coords.crval1 = Rc; 272 coords.crval2 = Dc; 273 coords.crpix1 = 0; 274 coords.crpix2 = 0; 275 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 276 coords.pc1_1 = coords.pc2_2 = 1.0; 277 coords.pc1_2 = coords.pc2_1 = 0.0; 278 coords.Npolyterms = 1; 279 strcpy (coords.ctype, "DEC--SIN"); 280 281 // convert all average R,D values to X,Y: 282 double *X, *Y; 283 ALLOCATE (X, double, Naverage); 284 ALLOCATE (Y, double, Naverage); 285 float Xmin = +10000.0, Ymin = +10000.0; 286 float Xmax = -10000.0, Ymax = -10000.0; 287 for (i = 0; i < Naverage; i++) { 288 X[i] = NAN; 289 Y[i] = NAN; 290 // skip any stars which are outside of nominal catalog range 291 if (subcatalog[0].average[i].R < Rmin) continue; 292 if (subcatalog[0].average[i].R > Rmax) continue; 293 if (subcatalog[0].average[i].D < Dmin) continue; 294 if (subcatalog[0].average[i].D > Dmax) continue; 295 RD_to_XY (&X[i], &Y[i], subcatalog[0].average[i].R, subcatalog[0].average[i].D, &coords); 296 Xmin = MIN (Xmin, X[i]); 297 Xmax = MAX (Xmax, X[i]); 298 Ymin = MIN (Ymin, Y[i]); 299 Ymax = MAX (Ymax, Y[i]); 300 } 301 302 // how many grid cells? what is the grid spacing? 303 float dX = Xmax - Xmin; 304 float dY = Ymax - Ymin; 305 306 // *** XXX for the moment, I'm using a hard-wired cell size (200 arcsec ~ 3.3 arcmin) 307 int NX = (int)(dX / 200) + 1; 308 int NY = (int)(dY / 200) + 1; 309 // fprintf (stderr, "Density Grid: %d x %d\n", NX, NY); 310 // XXX check that NX,NY are sensible (5 degrees / 200 arcsec seems like the absolute max) 311 if (NX > 1000) { 312 fprintf (stderr, "serious problem with %s: NX = %d\n", subcatalog[0].filename, NX); 313 exit (3); 314 } 315 if (NY > 1000) { 316 fprintf (stderr, "serious problem with %s: NY = %d\n", subcatalog[0].filename, NY); 317 exit (3); 318 } 319 320 // kind of ugly : generate a grid of index, Nmeasure arrays 321 // to be filled below (I also need NN and Nn to track the number of 322 // entries in each). 323 int **NN_grid; 324 int **Nn_grid; 325 int ***Nm_grid; 326 off_t ***idxgrid; 327 ALLOCATE (NN_grid, int *, NX); 328 ALLOCATE (Nn_grid, int *, NX); 329 ALLOCATE (Nm_grid, int **, NX); 330 ALLOCATE (idxgrid, off_t **, NX); 331 332 for (ix = 0; ix < NX; ix++) { 333 ALLOCATE (NN_grid[ix], int, NY); 334 ALLOCATE (Nn_grid[ix], int, NY); 335 ALLOCATE (Nm_grid[ix], int *, NY); 336 ALLOCATE (idxgrid[ix], off_t *, NY); 337 for (iy = 0; iy < NY; iy++) { 338 Nn_grid[ix][iy] = 0; 339 NN_grid[ix][iy] = 100; 340 ALLOCATE (Nm_grid[ix][iy], int, NN_grid[ix][iy]); 341 ALLOCATE (idxgrid[ix][iy], off_t, NN_grid[ix][iy]); 342 } 343 } 344 345 // assign all of the average entries to a grid cell 346 for (i = 0; i < Naverage; i++) { 347 if (isnan(X[i])) continue; 348 if (isnan(Y[i])) continue; 349 ix = (X[i] - Xmin) / 200.0; 350 iy = (Y[i] - Ymin) / 200.0; 351 int Nn = Nn_grid[ix][iy]; 352 Nm_grid[ix][iy][Nn] = subcatalog[0].average[i].Nmeasure; 353 354 // if we are resetting to a given photcode, we need to have that photcode... 355 if (NphotcodesReset) { 356 int k; 357 int foundReset = FALSE; 358 int m = subcatalog[0].average[i].measureOffset; 359 MeasureTiny *measure = &subcatalog[0].measureT[m]; 360 for (j = 0; (j < subcatalog[0].average[i].Nmeasure) && !foundReset; j++) { 361 if (CHECK_TEST_IMAGE && (abs(measure[j].t - Tref) < 10) && (measure[j].photcode == Cref)) { 362 fprintf (stderr, "."); 363 } 364 for (k = 0; (k < NphotcodesReset) && !foundReset; k++) { 365 if (photcodesReset[k][0].code == measure[j].photcode) foundReset = TRUE; 366 } 367 } 368 if (!foundReset) { 369 Nm_grid[ix][iy][Nn] = 0; 370 } 371 } 372 373 idxgrid[ix][iy][Nn] = i; 374 Nn_grid[ix][iy] ++; 375 if (Nn_grid[ix][iy] >= NN_grid[ix][iy]) { 376 NN_grid[ix][iy] += 100; 377 REALLOCATE (Nm_grid[ix][iy], int, NN_grid[ix][iy]); 378 REALLOCATE (idxgrid[ix][iy], off_t, NN_grid[ix][iy]); 379 } 380 } 381 382 // sort all of the grid cells 383 for (ix = 0; ix < NX; ix++) { 384 for (iy = 0; iy < NY; iy++) { 385 sort_by_Nmeasure (Nm_grid[ix][iy], idxgrid[ix][iy], Nn_grid[ix][iy]); 386 NN_grid[ix][iy] = 0; // I'm going to use this array to track which element I've already selected 387 } 388 } 389 390 // cycle over the grid until we ready Nmax 391 off_t *keepidx = NULL; 392 ALLOCATE (keepidx, off_t, Naverage); 393 memset (keepidx, 0, Naverage*sizeof(off_t)); 394 int Nkeep = 0; 395 396 for (i = 0; (i < 20) && (Nkeep < Nmax); i++) { 397 for (ix = 0; (ix < NX) && (Nkeep < Nmax); ix++) { 398 for (iy = 0; (iy < NY) && (Nkeep < Nmax); iy++) { 399 if (NN_grid[ix][iy] >= Nn_grid[ix][iy]) continue; // all used up! 400 int Nn = NN_grid[ix][iy]; 401 keepidx[Nkeep] = idxgrid[ix][iy][Nn]; 402 Nkeep ++; 403 NN_grid[ix][iy] ++; 404 } 405 } 406 } 407 408 // count the number of measurements this selection will yield 409 off_t ave, NMEASURE = 0; 410 for (i = 0; i < Nkeep; i++) { 411 ave = keepidx[i]; 412 NMEASURE += subcatalog[0].average[ave].Nmeasure; 413 } 414 415 // test catID : 37262 37261 37257 37258 416 int dumpit = FALSE; 417 dumpit |= (oldcatalog[0].catID == 37007); 418 // dumpit |= (oldcatalog[0].catID == 37261); 419 // dumpit |= (oldcatalog[0].catID == 37257); 420 // dumpit |= (oldcatalog[0].catID == 37258); 421 if (dumpit) { 422 char name[64]; 423 snprintf (name, 64, "cat.%05d.dump.dat", oldcatalog[0].catID); 424 FILE *fdump = fopen (name, "w"); 425 for (i = 0; i < Nkeep; i++) { 426 ave = keepidx[i]; 427 fprintf (fdump, "%10.6f %10.6f %d\n", subcatalog[0].average[ave].R, subcatalog[0].average[ave].D, subcatalog[0].average[ave].Nmeasure); 428 } 429 fclose (fdump); 430 } 431 432 // allocate the output data 433 ALLOCATE (tmpcatalog.average, Average, Nkeep); 434 ALLOCATE (tmpcatalog.measureT, MeasureTiny, NMEASURE); 435 ALLOCATE (tmpcatalog.secfilt, SecFilt, Nkeep * Nsecfilt); 436 437 off_t Nmeasure = 0; 438 439 // copy the Nkeep selected entries from subcatalog to tmpcatalog (adjusting links) 440 for (i = 0; i < Nkeep; i++) { 441 ave = keepidx[i]; 442 tmpcatalog.average[i] = subcatalog[0].average[ave]; 443 tmpcatalog.average[i].measureOffset = Nmeasure; 444 for (j = 0; j < tmpcatalog.average[i].Nmeasure; j++) { 445 off_t offset = subcatalog[0].average[ave].measureOffset + j; 446 tmpcatalog.measureT[Nmeasure] = subcatalog[0].measureT[offset]; 447 tmpcatalog.measureT[Nmeasure].averef = i; 448 Nmeasure ++; 449 } 450 for (j = 0; j < Nsecfilt; j++) { 451 tmpcatalog.secfilt[i*Nsecfilt + j] = subcatalog[0].secfilt[ave*Nsecfilt + j]; 452 } 453 } 454 455 if (VERBOSE2) { 456 char *basename = filebasename (oldcatalog[0].filename); 457 fprintf (stderr, "limited to %d ("OFF_T_FMT" subset, "OFF_T_FMT" total) stars, "OFF_T_FMT" ("OFF_T_FMT" subset, "OFF_T_FMT" total) measures for catalog %s\n", 458 Nkeep, subcatalog[0].Naverage, oldcatalog[0].Naverage, Nmeasure, subcatalog[0].Nmeasure, oldcatalog[0].Nmeasure, basename); 459 free (basename); 460 } 461 462 free (X); 463 free (Y); 464 465 for (ix = 0; ix < NX; ix++) { 466 for (iy = 0; iy < NY; iy++) { 467 free (Nm_grid[ix][iy]); 468 free (idxgrid[ix][iy]); 469 } 470 free (NN_grid[ix]); 471 free (Nn_grid[ix]); 472 free (Nm_grid[ix]); 473 free (idxgrid[ix]); 474 } 475 free (NN_grid); 476 free (Nn_grid); 477 free (Nm_grid); 478 free (idxgrid); 479 480 free (keepidx); 481 482 free (subcatalog[0].average); 483 free (subcatalog[0].measureT); 484 free (subcatalog[0].secfilt); 485 486 subcatalog[0].average = tmpcatalog.average; 487 subcatalog[0].measureT = tmpcatalog.measureT; 488 subcatalog[0].secfilt = tmpcatalog.secfilt; 489 subcatalog[0].Naverage = Nkeep; 490 subcatalog[0].Nmeasure = Nmeasure; 491 subcatalog[0].Nsecfilt = oldcatalog[0].Nsecfilt; 492 subcatalog[0].Nsecf_mem = Naverage * oldcatalog[0].Nsecfilt; 493 494 return (TRUE); 157 495 } 158 496 … … 205 543 NMEASURE += subcatalog[0].average[ave].Nmeasure; 206 544 } 545 546 # if (0) 547 if (oldcatalog[0].catID == 59962) { 548 FILE *fdump = fopen ("cat.dump.dat", "w"); 549 for (i = 0; i < Nmax; i++) { 550 ave = index[i]; 551 fprintf (fdump, "%10.6f %10.6f %d\n", subcatalog[0].average[ave].R, subcatalog[0].average[ave].D, subcatalog[0].average[ave].Nmeasure); 552 } 553 fclose (fdump); 554 } 555 # endif 207 556 208 557 // allocate the output data -
trunk/Ohana/src/relastro/src/dvo_astrom_ops.c
r33652 r36833 91 91 } 92 92 93 double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt) { 94 95 double ra; 96 97 /* the measure carries the instantaneous mean position at the epoch t */ 98 ra = average[0].R - measure[0].dR / 3600.0; 99 100 /* possible corrections to mean ra: 101 102 - proper-motion and parallax 103 - abberation 104 - precession and nutation, etc 105 - refraction 106 - DCR 107 108 */ 109 110 return (ra); 111 } 112 113 double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt) { 114 115 double dec; 116 117 /* the measure carries the instantaneous mean position at the epoch t */ 118 dec = average[0].D - measure[0].dD / 3600.0; 119 120 /* possible corrections to mean ra: 121 122 - proper-motion and parallax 123 - abberation 124 - precession and nutation, etc 125 - refraction 126 - DCR 127 128 */ 129 130 return (dec); 131 } 132 93 133 int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) { 94 134 … … 144 184 return (TRUE); 145 185 } 186 -
trunk/Ohana/src/relastro/src/initialize.c
r36630 r36833 8 8 if (RELASTRO_OP == OP_MERGE_SOURCE) return; 9 9 10 fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); 11 fprintf (stderr, "PHOTCODE_SKIP_LIST: %s\n", PHOTCODE_SKIP_LIST); 12 fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST); 13 fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST); 10 if (DCR_COLOR_POS) fprintf (stderr, "DCR_COLOR_POS: %s\n", DCR_COLOR_POS); 11 if (DCR_COLOR_NEG) fprintf (stderr, "DCR_COLOR_NEG: %s\n", DCR_COLOR_NEG); 14 12 15 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 16 photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE); 17 photcodesGroupA = ParsePhotcodeList (PHOTCODE_A_LIST, &NphotcodesGroupA, TRUE); 18 photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST, &NphotcodesGroupB, TRUE); 13 if (PHOTCODE_KEEP_LIST) fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); 14 if (PHOTCODE_SKIP_LIST) fprintf (stderr, "PHOTCODE_SKIP_LIST: %s\n", PHOTCODE_SKIP_LIST); 15 if (PHOTCODE_RESET_LIST) fprintf (stderr, "PHOTCODE_RESET_LIST: %s\n", PHOTCODE_RESET_LIST); 16 if (PHOTCODE_A_LIST) fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST); 17 if (PHOTCODE_B_LIST) fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST); 18 19 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 20 photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE); 21 photcodesReset = ParsePhotcodeList (PHOTCODE_RESET_LIST, &NphotcodesReset, FALSE); 22 photcodesGroupA = ParsePhotcodeList (PHOTCODE_A_LIST, &NphotcodesGroupA, TRUE); 23 photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST, &NphotcodesGroupB, TRUE); 24 25 DCR_NSEC_POS = DCR_NSEC_NEG = -1; 26 if (DCR_COLOR_POS) { 27 DCR_PHOTCODE_POS = GetPhotcodebyName (DCR_COLOR_POS); 28 if (!DCR_PHOTCODE_POS) { 29 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_COLOR_POS); 30 exit (1); 31 } 32 DCR_NSEC_POS = GetPhotcodeNsec (DCR_PHOTCODE_POS[0].code); 33 } 34 if (DCR_COLOR_NEG) { 35 DCR_PHOTCODE_NEG = GetPhotcodebyName (DCR_COLOR_NEG); 36 if (!DCR_PHOTCODE_NEG) { 37 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_COLOR_NEG); 38 exit (1); 39 } 40 DCR_NSEC_NEG = GetPhotcodeNsec (DCR_PHOTCODE_NEG[0].code); 41 } 19 42 20 43 initstats (STATMODE); … … 42 65 args_client (argc, argv); 43 66 44 fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); 45 fprintf (stderr, "PHOTCODE_SKIP_LIST: %s\n", PHOTCODE_SKIP_LIST); 46 fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST); 47 fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST); 67 if (PHOTCODE_KEEP_LIST) fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); 68 if (PHOTCODE_SKIP_LIST) fprintf (stderr, "PHOTCODE_SKIP_LIST: %s\n", PHOTCODE_SKIP_LIST); 69 if (PHOTCODE_RESET_LIST) fprintf (stderr, "PHOTCODE_RESET_LIST: %s\n", PHOTCODE_RESET_LIST); 70 if (PHOTCODE_A_LIST) fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST); 71 if (PHOTCODE_B_LIST) fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST); 48 72 49 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 50 photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE); 51 photcodesGroupA = ParsePhotcodeList (PHOTCODE_A_LIST, &NphotcodesGroupA, TRUE); 52 photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST, &NphotcodesGroupB, TRUE); 73 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 74 photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE); 75 photcodesReset = ParsePhotcodeList (PHOTCODE_RESET_LIST, &NphotcodesReset, FALSE); 76 photcodesGroupA = ParsePhotcodeList (PHOTCODE_A_LIST, &NphotcodesGroupA, TRUE); 77 photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST, &NphotcodesGroupB, TRUE); 53 78 54 79 initstats (STATMODE); -
trunk/Ohana/src/relastro/src/launch_region_hosts.c
r36630 r36833 1 1 # include "relastro.h" 2 2 # define DEBUG 0 3 4 int strextend (char *input, char *format,...) {5 6 char tmpextra[1024], tmpline[1024];7 va_list argp;8 9 va_start (argp, format);10 vsnprintf (tmpextra, 1024, format, argp);11 snprintf (tmpline, 1024, "%s %s", input, tmpextra);12 strcpy (input, tmpline);13 14 return TRUE;15 }16 3 17 4 int launch_region_hosts (RegionHostTable *regionHosts) { … … 88 75 if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST); 89 76 if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST); 77 if (PHOTCODE_RESET_LIST) strextend (command, "-reset-to-photcode %s", PHOTCODE_RESET_LIST); 90 78 91 79 if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue); 92 80 if (ImagSelect) strextend (command, "-instmag %f %f", ImagMin, ImagMax); 81 if (ExcludeBogus) strextend (command, "-exclude-bogus %f", ExcludeBogusRadius); 82 83 if (DCR_COLOR_POS && DCR_COLOR_NEG) { 84 strextend (command, "-dcr-color %s %s", DCR_COLOR_POS, DCR_COLOR_NEG); 85 } 86 93 87 if (PhotFlagSelect) strextend (command, "+photflags"); 94 88 if (PhotFlagBad) strextend (command, "+photflagbad %d", PhotFlagBad); … … 97 91 if (MinBadQF > 0.0) strextend (command, "-min-bad-psfqf %f", MinBadQF); 98 92 if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset %f", MaxMeanOffset); 93 94 strextend (command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 95 strextend (command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 96 strextend (command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX); 97 strextend (command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS); 98 99 if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 99 100 100 101 if (TimeSelect) { -
trunk/Ohana/src/relastro/src/load_catalogs.c
r36630 r36833 1 1 # include "relastro.h" 2 2 3 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog );3 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog, char *syncfile); 4 4 void bcatalog_show_skips (); 5 5 6 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath) { 7 8 int i, j, k, m, Nstar; 6 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath, char *syncfile) { 7 8 int i, j, Nstar; 9 // int k, m; 9 10 Catalog *catalog, *pcatalog, tcatalog; 10 11 11 12 // XXX need to decide how to determine PARALLEL mode... 12 13 if (PARALLEL && !hostID) { 13 catalog = load_catalogs_parallel (skylist, Ncatalog );14 catalog = load_catalogs_parallel (skylist, Ncatalog, syncfile); 14 15 return catalog; 15 16 } … … 73 74 if (RESET) { 74 75 for (j = 0; j < catalog[Ncat].Naverage; j++) { 76 # if (0) 75 77 catalog[Ncat].average[j].flags = 0; 76 78 m = catalog[Ncat].average[j].measureOffset; … … 78 80 catalog[Ncat].measure[m+k].dbFlags = 0; 79 81 } 82 # endif 80 83 } 81 84 } … … 84 87 } 85 88 86 // XXX TEST :bcatalog_show_skips();89 bcatalog_show_skips(); 87 90 88 91 Nstar = 0; … … 113 116 // CATDIR is supplied globally 114 117 # define DEBUG 1 115 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog ) {118 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog, char *syncfile) { 116 119 117 120 char uniquer[12]; … … 150 153 table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR, SIGMA_LIM); 151 154 152 char tmpline[1024]; 153 if (FIT_MODE == FIT_PM_ONLY) { snprintf (tmpline, 1024, "%s -pm", command); strcpy (command, tmpline); } 154 if (FIT_MODE == FIT_PAR_ONLY) { snprintf (tmpline, 1024, "%s -par", command); strcpy (command, tmpline); } 155 if (FIT_MODE == FIT_PM_AND_PAR) { snprintf (tmpline, 1024, "%s -pmpar", command); strcpy (command, tmpline); } 156 157 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 158 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 159 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 160 if (ImagSelect) { snprintf (tmpline, 1024, "%s -instmag %f %f", command, ImagMin, ImagMax); strcpy (command, tmpline); } 161 if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue); strcpy (command, tmpline); } 155 if (FIT_MODE == FIT_PM_ONLY) strextend (command, "-pm"); 156 if (FIT_MODE == FIT_PAR_ONLY) strextend (command, "-par"); 157 if (FIT_MODE == FIT_PM_AND_PAR) strextend (command, "-pmpar"); 158 159 if (VERBOSE) strextend (command, "-v"); 160 if (VERBOSE2) strextend (command, "-vv"); 161 if (RESET) strextend (command, "-reset"); 162 if (ImagSelect) strextend (command, "-instmag %f %f", ImagMin, ImagMax); 163 if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue); 164 if (FlagOutlier) strextend (command, "-clip %d", CLIP_THRESH); 165 if (ExcludeBogus) strextend (command, "-exclude-bogus %f", ExcludeBogusRadius); 162 166 163 if (FlagOutlier) { snprintf (tmpline, 1024, "%s -clip %d", command, CLIP_THRESH); strcpy (command, tmpline); } 164 165 if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command); strcpy (command, tmpline); } 166 167 if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); } 168 if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); } 169 if (PhotFlagSelect) { snprintf (tmpline, 1024, "%s +photflags", command); strcpy (command, tmpline); } 170 if (PhotFlagBad) { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad); strcpy (command, tmpline); } 171 if (PhotFlagPoor) { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor); strcpy (command, tmpline); } 167 if (DCR_COLOR_POS && DCR_COLOR_NEG) { 168 strextend (command, "-dcr-color %s %s", DCR_COLOR_POS, DCR_COLOR_NEG); 169 } 170 171 if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 172 if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST); 173 if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST); 174 if (PhotFlagSelect) strextend (command, "+photflags"); 175 if (PhotFlagBad) strextend (command, "+photflagbad %d", PhotFlagBad); 176 if (PhotFlagPoor) strextend (command, "+photflagpoor %d", PhotFlagPoor); 172 177 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 173 178 … … 175 180 char *tstart = ohana_sec_to_date (TSTART); 176 181 char *tstop = ohana_sec_to_date (TSTOP); 177 s nprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop);182 strextend (command, "-time %s %s", tstart, tstop); 178 183 free (tstart); 179 184 free (tstop); 180 strcpy (command, tmpline);181 185 } 182 186 … … 211 215 } 212 216 217 // update syncfile here (save lots of I/O time) 218 219 // NOTE: if I let all hosts load blindly, I saturate the data clients with too many 220 // relastro_client requests. I need to have the master mediate this. the master 221 // will not launch the next remote job until this one says it is done 222 if (syncfile) { 223 update_sync_file (syncfile, 1); 224 } 225 213 226 // each host generates a BrightCatalog structure, with the measure, average, etc value 214 227 // loaded into a single set of arrays (of MeasureTiny, AverageTiny, Secfilt). I need to -
trunk/Ohana/src/relastro/src/relastro_client.c
r36630 r36833 33 33 // USAGE: relastro_client -load-objects 34 34 int Ncatalog; 35 Catalog *catalog = load_catalogs (skylist, &Ncatalog, TRUE, HOST_ID, HOSTDIR );35 Catalog *catalog = load_catalogs (skylist, &Ncatalog, TRUE, HOST_ID, HOSTDIR, NULL); 36 36 if (!catalog) { 37 37 fprintf (stderr, "ERROR loading catalogs from %s\n", CATDIR); -
trunk/Ohana/src/relastro/src/relastro_images.c
r36630 r36833 28 28 // XXX pass in the image table 29 29 // XXX who carries the image grid? 30 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL); 30 31 // photcodesKeep is used here to allow measurements from the images being calibrated 32 // note if -reset-to-photcode is selected, photocodesKeep is replaced with below with photcodesReset 33 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL, NULL); 31 34 MARKTIME("load catalog data: %f sec\n", dtime); 35 36 if (photcodesReset) { 37 photcodesKeep = photcodesReset; 38 NphotcodesKeep = NphotcodesReset; 39 } 32 40 33 41 if (Ncatalog == 0) { … … 50 58 // set test points based on the starmap 51 59 createStarMap (catalog, Ncatalog); 60 61 // XXX NOTE : for 2mass reset, photcodesKeep should now limit to 2MASS measurements 52 62 53 63 /* major modes */ -
trunk/Ohana/src/relastro/src/relastro_objects.c
r36630 r36833 40 40 snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name); 41 41 catalog.filename = hostID ? hostfile : skylist[0].filename[i]; 42 43 // set up the basic catalog info 42 44 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 43 45 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data -
trunk/Ohana/src/relastro/src/relastro_parallel_images.c
r36630 r36833 45 45 46 46 /* load catalog data from region files (hostID is 0 since we are not a client */ 47 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL); 47 char *syncfile = make_filename (CATDIR, regionHosts->hosts[myHost].hostname, REGION_HOST_ID, "loadcat.sync"); 48 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL, syncfile); 48 49 MARKTIME("-- load catalog data: %f sec\n", dtime); 50 free (syncfile); 49 51 50 // NOTE: if I let all hosts load blindly, I saturate the data clients with too many 51 // relastro_client requests. I need to have the master mediate this. the master 52 // will not launch the next remote job until this one says it is done 53 char *syncfile = make_filename (CATDIR, regionHosts->hosts[myHost].hostname, REGION_HOST_ID, "loadcat.sync"); 54 update_sync_file (syncfile, 1); 55 52 if (photcodesReset) { 53 photcodesKeep = photcodesReset; 54 NphotcodesKeep = NphotcodesReset; 55 } 56 56 57 // generate tables go from catID,objID -> catSeq,objSeq 57 58 indexCatalogs (catalog, Ncatalog);
Note:
See TracChangeset
for help on using the changeset viewer.
