Changeset 38317
- Timestamp:
- May 25, 2015, 12:41:40 PM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150419/Ohana/src/relphot/src
- Files:
-
- 9 edited
-
StarOps.c (modified) (5 diffs)
-
args.c (modified) (3 diffs)
-
bcatalog.c (modified) (2 diffs)
-
global_stats.c (modified) (2 diffs)
-
liststats.c (modified) (1 diff)
-
reload_catalogs.c (modified) (2 diffs)
-
relphot_objects.c (modified) (3 diffs)
-
setMrelCatalog.c (modified) (23 diffs)
-
setMrelFinal.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/StarOps.c
r38316 r38317 106 106 results->needSYN[i] = FALSE; 107 107 results->measSYN[i] = -1; 108 results->minSYN[i] = NAN;109 108 110 109 results->psfQfMax[i] = NAN; … … 151 150 ALLOCATE (results->minSYN, float, results->Nsecfilt); 152 151 153 ALLOCATE (results->psfQfMax, float, results->Nsecfilt);152 ALLOCATE (results->psfQfMax, float, results->Nsecfilt); 154 153 ALLOCATE (results->psfQfPerfMax, float, results->Nsecfilt); 155 154 … … 158 157 ALLOCATE (results->Next, int, results->Nsecfilt); 159 158 ALLOCATE (results->NexpPS1, int, results->Nsecfilt); 160 ALLOCATE (results->havePS1, int, results->Nsecfilt);161 159 ALLOCATE (results->haveUbercal, int, results->Nsecfilt); 162 160 … … 199 197 results->Next = NULL; 200 198 results->NexpPS1 = NULL; 201 results->havePS1 = NULL;202 199 results->haveUbercal = NULL; 203 200 … … 231 228 FREE (results->Next); 232 229 FREE (results->NexpPS1); 233 FREE (results->havePS1);234 230 FREE (results->haveUbercal); 235 231 -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/args.c
r38298 r38317 331 331 } 332 332 333 // if -synthphot_zpts is supplied, the map of corrections needed for the synthetic photometry is supplied334 // and used to tie down the synthetic magnitudes335 SYNTH_ZERO_POINTS = NULL;336 if ((N = get_argument (argc, argv, "-synthphot_zpts"))) {337 remove_argument (N, &argc, argv);338 myAssert (N < argc, "missing argument to -synthphot_means");339 SYNTH_ZERO_POINTS = strcreate (argv[N]);340 remove_argument (N, &argc, argv);341 }342 343 333 // if -synthphot is chosen, an artificial w-band measurement is generated for each object 344 334 // with r and i photometry. this was used to apply the ubercal photometry to w-band images. … … 384 374 mode = UPDATE_AVERAGES; 385 375 } 376 377 // if -synthphot_zpts is supplied, the map of corrections needed for the synthetic photometry is supplied 378 // and used to tie down the synthetic magnitudes 379 // NOTE: SYNTH_ZERO_POINTS is used for the same file in both -synthphot_zpts and -synthphot_means 386 380 SYNTH_ZERO_POINTS = NULL; 381 if ((N = get_argument (argc, argv, "-synthphot_zpts"))) { 382 remove_argument (N, &argc, argv); 383 myAssert (N < argc, "missing argument to -synthphot_zpts"); 384 SYNTH_ZERO_POINTS = strcreate (argv[N]); 385 remove_argument (N, &argc, argv); 386 } 387 387 if ((N = get_argument (argc, argv, "-synthphot_means"))) { 388 388 mode = SYNTH_PHOT; … … 495 495 } 496 496 SYNTH_ZERO_POINTS = NULL; 497 if ((N = get_argument (argc, argv, "-synthphot_zpts"))) { 498 remove_argument (N, &argc, argv); 499 myAssert (N < argc, "missing argument to -synthphot_zpts"); 500 SYNTH_ZERO_POINTS = strcreate (argv[N]); 501 remove_argument (N, &argc, argv); 502 } 497 503 if ((N = get_argument (argc, argv, "-synthphot_means"))) { 498 504 MODE = MODE_SYNTH_PHOT; -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/bcatalog.c
r38314 r38317 65 65 int Ns; 66 66 67 # if (0)68 DVOSecfiltFlags secfiltBits =69 ID_SECF_STAR_FEW |70 ID_SECF_STAR_POOR |71 ID_PHOTOM_PASS_0 |72 ID_PHOTOM_PASS_1 |73 ID_PHOTOM_PASS_2 |74 ID_PHOTOM_PASS_3 |75 ID_PHOTOM_PASS_4 |76 ID_SECF_USE_SYNTH |77 ID_SECF_USE_UBERCAL |78 ID_SECF_OBJ_EXT;79 # endif80 81 67 for (Ns = 0; Ns < Nphotcodes; Ns++) { 82 68 … … 84 70 int Nsec = GetPhotcodeNsec(thisCode); 85 71 86 // fprintf (stderr, "really use dvo_secfilt_init?"); 87 dvo_secfilt_init (&subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec]); 88 89 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M = NAN; 90 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Map = NAN; 91 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].dM = NAN; 92 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Mstdev = NAN_S_SHORT; 93 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Mchisq = NAN; 94 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_20 = NAN_S_SHORT; 95 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_80 = NAN_S_SHORT; 96 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Ncode = 0; 97 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Nused = 0; 98 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].flags &= ~secfiltBits; 99 // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].ubercalDist = 1000; 72 dvo_secfilt_init (&subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec], SECFILT_RESET_ALL); 100 73 } 101 74 } -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/global_stats.c
r35416 r38317 4 4 5 5 StatType stN, stX, stS, imN, imX, imM, imD, msM, msX, msN, msD; 6 7 liststats_init (&stN); 8 liststats_init (&stX); 9 liststats_init (&stS); 10 liststats_init (&imN); 11 liststats_init (&imX); 12 liststats_init (&imM); 13 liststats_init (&imD); 14 liststats_init (&msN); 15 liststats_init (&msX); 16 liststats_init (&msM); 17 liststats_init (&msD); 6 18 7 19 // INITTIME; … … 26 38 27 39 fprintf (stderr, " --- stats for %s ---\n", photcodes[Ns][0].name); 28 fprintf (stderr, "meas / star: %7.0f %7.1f %7.1f %7.0f %7.0f %6d\n", stN.median, stN.mean, stN.sigma, stN.min, stN.max, stN.Nmeas);40 fprintf (stderr, "meas / star: %7.0f %7.1f %7.1f %7.0f %7.0f %6d\n", stN.median, stN.mean, stN.sigma, stN.min, stN.max, stN.Nmeas); 29 41 fprintf (stderr, "dMrel star: %7.4f %7.4f %7.4f %7.4f %7.4f %6d\n", stS.median, stS.mean, stS.sigma, stS.min, stS.max, stS.Nmeas); 30 fprintf (stderr, "chisq star: %7.1f %7.1f %7.1f %7.1f %7.1f %6d\n", stX.median, stX.mean, stX.sigma, stX.min, stX.max, stX.Nmeas);42 fprintf (stderr, "chisq star: %7.1f %7.1f %7.1f %7.1f %7.1f %6d\n", stX.median, stX.mean, stX.sigma, stX.min, stX.max, stX.Nmeas); 31 43 } 32 44 -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/liststats.c
r38293 r38317 37 37 38 38 myAssert (stats->statmode != STATS_NONE, "programming error, liststats mode not set"); 39 40 liststats_init (stats); 39 41 40 42 ke = ks = dMo = 0; -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/reload_catalogs.c
r38298 r38317 170 170 free (BOUNDARY_TREE); 171 171 BOUNDARY_TREE = tmppath; 172 } 173 if (SYNTH_ZERO_POINTS) { 174 char *tmppath = abspath(SYNTH_ZERO_POINTS, DVO_MAX_PATH); 175 free (SYNTH_ZERO_POINTS); 176 SYNTH_ZERO_POINTS = tmppath; 172 177 } 173 178 … … 224 229 225 230 char tmpline[1024]; 226 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); }227 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); }228 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); }229 if (RESET_ZEROPTS) { snprintf (tmpline, 1024, "%s -reset-zpts", command); strcpy (command, tmpline); }230 if (UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline); }231 if (IS_DIFF_DB) { snprintf (tmpline, 1024, "%s -is-diff-db", command); strcpy (command, tmpline); }232 if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal", command); strcpy (command, tmpline); }233 if (UPDATE_CATFORMAT) { snprintf (tmpline, 1024, "%s -update-catformat %s", command, UPDATE_CATFORMAT); strcpy (command, tmpline); }234 if (BOUNDARY_TREE) { snprintf (tmpline, 1024, "%s -boundary-tree %s", command, BOUNDARY_TREE); strcpy (command, tmpline); }231 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 232 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 233 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 234 if (RESET_ZEROPTS) { snprintf (tmpline, 1024, "%s -reset-zpts", command); strcpy (command, tmpline); } 235 if (UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline); } 236 if (IS_DIFF_DB) { snprintf (tmpline, 1024, "%s -is-diff-db", command); strcpy (command, tmpline); } 237 if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal", command); strcpy (command, tmpline); } 238 if (UPDATE_CATFORMAT) { snprintf (tmpline, 1024, "%s -update-catformat %s", command, UPDATE_CATFORMAT); strcpy (command, tmpline); } 239 if (BOUNDARY_TREE) { snprintf (tmpline, 1024, "%s -boundary-tree %s", command, BOUNDARY_TREE); strcpy (command, tmpline); } 235 240 if (SYNTH_ZERO_POINTS) { snprintf (tmpline, 1024, "%s -synthphot-zpts %s", command, SYNTH_ZERO_POINTS); strcpy (command, tmpline); } 236 241 if (SET_MREL_VERSION != 1) { snprintf (tmpline, 1024, "%s -set-mrel-version %d", command, SET_MREL_VERSION); strcpy (command, tmpline); } -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/relphot_objects.c
r38298 r38317 62 62 if (RESET) { 63 63 Nsecfilt = catalog.Nsecfilt; 64 DVOSecfiltFlags secfiltBits = 65 ID_SECF_STAR_FEW | 66 ID_SECF_STAR_POOR | 67 ID_PHOTOM_PASS_0 | 68 ID_PHOTOM_PASS_1 | 69 ID_PHOTOM_PASS_2 | 70 ID_PHOTOM_PASS_3 | 71 ID_PHOTOM_PASS_4 | 72 ID_SECF_USE_SYNTH | 73 ID_SECF_USE_UBERCAL | 74 ID_SECF_HAS_STACK | 75 ID_SECF_HAS_PS1 | 76 ID_SECF_OBJ_EXT ; 77 64 78 65 DVOAverageFlags astromBits = 79 66 ID_STAR_FIT_AVE | … … 91 78 catalog.average[j].stargal = NAN; // reset (will be re-calculated here) 92 79 for (k = 0; k < Nsecfilt; k++) { 93 dvo_secfilt_init (&catalog.secfilt[j*Nsecfilt + k]); 94 catalog.secfilt[j*Nsecfilt + k].flags &= ~secfiltBits; // XXX: only reset photom bits: 80 dvo_secfilt_init (&catalog.secfilt[j*Nsecfilt + k], SECFILT_RESET_ALL); 95 81 } 96 82 } … … 101 87 initMrel (&catalog, 1); 102 88 setMrelFinal (&catalog, NULL, TRUE); 89 // XXX if we want to have options for setting warp, chip, stack independently, we need to init only the desired ones 103 90 104 91 if (!UPDATE) { -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/setMrelCatalog.c
r38316 r38317 12 12 continue; } 13 13 14 # define CHECK_VALID_MAG(MAG) (!isnan(MAG) && (MAG > 0.0) && (MAG < 30.0)) 15 # define CHECK_VALID_FLUX(MAG) (!isnan(FLUX)) 16 17 # if (0) 14 # define CHECK_VALID_MAG(MAG) (!isnan(MAG) && (MAG > -5.0) && (MAG < 30.0)) 15 # define CHECK_VALID_FLUX(FLUX) (!isnan(FLUX)) 16 18 17 static float MagToFlux (float Mag) { 19 18 float Flux = pow(10.0, -0.4*(Mag)); 20 19 return (Flux); 21 20 } 22 # endif23 21 24 22 int print_measure_set_alt (Average *average, SecFilt *secfilt, Measure *measure) { … … 123 121 int Galaxy2MASS = FALSE; 124 122 int haveTYCHO = FALSE; 123 124 float stargalmax = 0.0; 125 125 126 126 // assign measurements to the photcode lists … … 154 154 results->Nmeas[Nsec] ++; 155 155 156 // force the use of SYN even if we have PS1 mags? 157 if (isSetMrelFinal && isGPC1synth(measureT[k].photcode)) { 158 results->haveSYN[Nsec] = TRUE; 159 results->measSYN[Nsec] = k; 160 if (measureT[k].M < results->minSYN[Nsec]) results->needSYN[Nsec] = TRUE; 161 continue; 162 } 163 164 // assign the max psfQF values for each Nsec value 156 // various steps only relevant to the final pass 165 157 if (isSetMrelFinal) { 166 if (measure[k].psfQF > results->psfQfMax[Nsec]) results->psfQfMax[Nsec] = measure[k].psfQF; 167 if (measure[k].psfQFperf > results->psfQfPerfMax[Nsec]) results->psfQfPerfMax[Nsec] = measure[k].psfQFperf; 168 } 169 170 // are we a PS1 exposure photcode? (hard-wired photcodes) 171 if (isGPC1chip(measureT[k].photcode)) { results->NexpPS1[Nsec] ++; results->havePS1[Nsec] = TRUE; } 158 if (isfinite(measure[k].psfQF) && (measure[k].psfQF > results->psfQfMax[Nsec])) results->psfQfMax[Nsec] = measure[k].psfQF; 159 if (isfinite(measure[k].psfQFperf) && (measure[k].psfQFperf > results->psfQfPerfMax[Nsec])) results->psfQfPerfMax[Nsec] = measure[k].psfQFperf; 160 161 // are we a PS1 exposure photcode? (hard-wired photcodes) 162 if (isGPC1chip(measure[k].photcode)) { 163 results->NexpPS1[Nsec] ++; 164 results->havePS1[Nsec] = TRUE; 165 166 // only count psfQF > 0.85 here 167 if (isfinite(measure[k].extNsigma) && isfinite(measure[k].psfQF) && (measure[k].psfQF > 0.85)) { 168 stargalmax = MAX (stargalmax, measure[k].extNsigma); 169 } 170 } 171 172 // force the use of SYN even if we have PS1 mags? 173 if (isGPC1synth(measure[k].photcode)) { 174 results->haveSYN[Nsec] = TRUE; 175 results->measSYN[Nsec] = k; 176 measureT[k].dbFlags |= ID_MEAS_SYNTH_MAG; // redundant with photcode 177 // note that synthetic mags have the real mags in measure.M (no zero point offset) 178 if (measure[k].M < results->minSYN[Nsec]) results->needSYN[Nsec] = TRUE; 179 continue; 180 } 181 } 172 182 173 183 // ** Choose the calibration (depends on the mode : do I have an image reference or not?) … … 190 200 } 191 201 192 // XXX ubercal dist should be by Nsec193 202 int myUbercalDist = getUbercalDist(meas, cat); 194 203 results->minUbercalDist[Nsec] = MIN(results->minUbercalDist[Nsec], myUbercalDist); … … 200 209 int useUbercalWeight = isUbercal || (refPhotcode && (code->code == refPhotcode->code)); 201 210 202 float Map, dMap; 211 float Map = NAN; 212 float dMap = NAN; 203 213 if (isSetMrelFinal) { 204 214 Map = PhotCat (&measure[k], MAG_CLASS_APER); … … 243 253 244 254 // count the extended detections (all PS1 bands) 245 if (is GPC1chip(measureT[k].photcode) && !isnan(Map) && !isnan(Mpsf)) {255 if (isSetMrelFinal && isGPC1chip(measureT[k].photcode) && !isnan(Map) && !isnan(Mpsf)) { 246 256 float dMagAp = Mpsf - Map; 247 257 float SigmaAp = hypot(0.1, 2.5*dMpsf); … … 260 270 SynthZeroPoints *synthzpts = SynthZeroPointsGet(); 261 271 272 // find max values across filters 273 float psfQfMax = 0.0; 274 float psfQfPerfMax = 0.0; 275 262 276 // now calculate the mean stats for the Nsec bands. 263 277 for (Nsec = 0; Nsec < Nsecfilt; Nsec++) { 264 dvo_secfilt_init (&secfilt[Nsec] ); // XXX does this reset astrometry bits? no, right?278 dvo_secfilt_init (&secfilt[Nsec], SECFILT_RESET_CHIP); // this does not reset astrometry or STACK bits 265 279 266 280 // XXX hardwired … … 272 286 273 287 if (haveTYCHO) { 274 // secfilt[Nsec].flags |= ID_SECF_HAVE_TYCHO;275 } 276 277 // XXX need to also supply ZP from map, apply tycho logic288 secfilt[Nsec].flags |= ID_SECF_HAS_TYCHO; 289 } 290 291 // force the synthetic magnitude (apply zpt calibration if no tycho photometry exists) 278 292 if (results->needSYN[Nsec]) { 279 293 if (!isSetMrelFinal) continue; … … 300 314 float *value = (float *) synthzpts->matrix[Nsec].buffer; 301 315 ZP = !isnan(value[Npix]) ? value[Npix] : 0.0; 316 if (isfinite(value[Npix])) { 317 secfilt[Nsec].flags |= ID_SECF_FIX_SYNTH; 318 } 302 319 } 303 320 secfilt[Nsec].M = Mpsf + ZP; … … 343 360 secfilt[Nsec].psfQfPerfMax = results->psfQfPerfMax[Nsec]; 344 361 362 if (isfinite(secfilt[Nsec].psfQfMax) && (secfilt[Nsec].psfQfMax > psfQfMax)) psfQfMax = secfilt[Nsec].psfQfMax; 363 if (isfinite(secfilt[Nsec].psfQfPerfMax) && (secfilt[Nsec].psfQfPerfMax > psfQfPerfMax)) psfQfPerfMax = secfilt[Nsec].psfQfPerfMax; 364 345 365 StatType *apstats = &results->apstats; 346 366 Nranking = magStatsByRanking (&results->aperData[Nsec], apstats); … … 370 390 switch (minRank) { 371 391 case 0: 372 secfilt[Nsec].flags |= ID_ PHOTOM_PASS_0;392 secfilt[Nsec].flags |= ID_SECF_RANK_0; 373 393 if (results->havePS1[Nsec]) GoodPS1 = TRUE; 374 394 break; 375 395 case 1: 376 secfilt[Nsec].flags |= ID_ PHOTOM_PASS_1;396 secfilt[Nsec].flags |= ID_SECF_RANK_1; 377 397 if (results->havePS1[Nsec]) GoodPS1 = TRUE; 378 398 break; 379 399 case 2: 380 secfilt[Nsec].flags |= ID_ PHOTOM_PASS_2;400 secfilt[Nsec].flags |= ID_SECF_RANK_2; 381 401 if (results->havePS1[Nsec]) GoodPS1 = TRUE; 382 402 break; 383 403 case 3: 384 secfilt[Nsec].flags |= ID_ PHOTOM_PASS_3;404 secfilt[Nsec].flags |= ID_SECF_RANK_3; 385 405 break; 386 406 case 4: 387 secfilt[Nsec].flags |= ID_ PHOTOM_PASS_4;407 secfilt[Nsec].flags |= ID_SECF_RANK_4; 388 408 break; 389 409 default: … … 412 432 average[0].flags |= ID_OBJ_GOOD_ALT; 413 433 } 434 average[0].psfQF = psfQfMax; 435 average[0].psfQFperf = psfQfPerfMax; 414 436 } 415 437 return (TRUE); … … 636 658 } 637 659 638 setGlobalObjStats (average, measure);639 640 660 return (TRUE); 641 661 } … … 647 667 int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr, SetMrelInfo *results) { 648 668 669 // we are guaranteed to have average, measure, secfilt 670 Average *average = &catalog[0].average[ave]; 649 671 off_t measureOffset = average->measureOffset; 650 672 651 // we are guaranteed to have average, measure, secfilt 652 Average *average = &catalog[0].average[ave]; 653 Measure *measure = &catalog[0].measure[measureOffset]; 654 SecFilt *secfilt = &catalog[0].secfilt[ave*Nsecfilt]; 655 char *measureRank = &catalog[0].measureRank[measureOffset]; 656 657 off_t measureOffset = average->measureOffset; 658 659 off_t k; 673 Measure *measure = &catalog[0].measure[measureOffset]; 674 SecFilt *secfilt = &catalog[0].secfilt[ave*Nsecfilt]; 675 char *measureRank = &catalog[0].measureRank[measureOffset]; 676 677 off_t k, Nsec; 660 678 float Mcal = 0; 661 679 … … 674 692 for (Nsec = 0; Nsec < Nsecfilt; Nsec++) { 675 693 if (!IS_DIFF_DB) { 676 myAssert (secfilt[Nsec].stackBestOff <= Nmeasure, "stackBestOff out of range");677 if (!FindImageSkycellID (secfilt[Nsec].stackBestOff, cat, & stkTessID[Nsec], &stkProjID[Nsec], &stkSkycellID[Nsec])) continue;694 myAssert (secfilt[Nsec].stackBestOff <= average->Nmeasure, "stackBestOff out of range"); 695 if (!FindImageSkycellID (secfilt[Nsec].stackBestOff, cat, &tessID, &projID, &skycellID)) continue; 678 696 } 679 697 results->tessID[Nsec] = tessID; … … 684 702 // assign measurements to the photcode lists 685 703 for (k = 0; k < average[0].Nmeasure; k++) { 704 off_t meas = measureOffset + k; 686 705 687 706 // skip measurements that do not have a valid photcode (raise exception?) … … 702 721 703 722 // use primary skycell for DIFF, stack skycell for WARP 704 if (IS_DIFF_DB) { 705 if (MatchImageSkycellID (meas, cat, priTessID, priProjID, priSkycellID)) { 706 measure[k].dbFlags |= ID_MEAS_STACK_PRIMARY; 707 } else { 708 continue; 709 } 710 } else { 711 if (!MatchImageSkycellID (meas, cat, stkTessID, stkProjID, stkSkycellID)) continue; 723 if (MatchImageSkycellID (meas, cat, results->tessID[Nsec], results->projID[Nsec], results->skycellID[Nsec])) { 724 continue; 712 725 } 713 726 714 727 // assign the max psfQF values for each Nsec value 715 728 if (IS_DIFF_DB) { 729 measure[k].dbFlags |= ID_MEAS_STACK_PRIMARY; 716 730 if (measure[k].psfQF > results->psfQfMax[Nsec]) results->psfQfMax[Nsec] = measure[k].psfQF; 717 731 if (measure[k].psfQFperf > results->psfQfPerfMax[Nsec]) results->psfQfPerfMax[Nsec] = measure[k].psfQFperf; 718 732 } 719 733 720 off_t meas = measureOffset + k;721 734 if (getImageEntry (meas, cat) < 0) { 722 735 // measurements without an image are either external reference photometry or … … 731 744 } 732 745 float Fcal = MagToFlux(-Mcal); 733 734 // XX measure[k].dbFlags &= ~ID_MEAS_WARP_USED;735 // XXX measure[k].dbFlags |= ID_MEAS_WARP_USED;736 746 737 747 // NOTE : I am using PhotCat not PhotSys for now since GPC1 chip-to-chip color terms … … 765 775 if (CHECK_VALID_FLUX(Fkron)) { 766 776 int Nkron = results->kronData[Nsec].Nlist; 767 results->kronData[Nsec].flxlist[Nkron] = F ap* Fcal;768 results->kronData[Nsec].errlist[Nkron] = dF ap* Fcal;777 results->kronData[Nsec].flxlist[Nkron] = Fkron * Fcal; 778 results->kronData[Nsec].errlist[Nkron] = dFkron * Fcal; 769 779 results->kronData[Nsec].wgtlist[Nkron] = 1.0; 770 780 results->kronData[Nsec].ranking[Nkron] = measureRank ? measureRank[k] : 0; … … 774 784 } 775 785 786 // find max values across filters 787 float psfQfMax = 0.0; 788 float psfQfPerfMax = 0.0; 789 776 790 // now calculate the mean stats for the Nsec bands. 777 791 for (Nsec = 0; Nsec < Nsecfilt; Nsec++) { 778 // XXX cannot do this -- resets psf mags 779 // dvo_secfilt_init (&secfilt[Nsec]); // XXX does this reset astrometry bits? no, right? 792 dvo_secfilt_init (&secfilt[Nsec], SECFILT_RESET_WARP); 780 793 781 794 if (IS_DIFF_DB) { … … 783 796 secfilt[Nsec].psfQfMax = results->psfQfMax[Nsec]; 784 797 secfilt[Nsec].psfQfPerfMax = results->psfQfPerfMax[Nsec]; 798 799 if (isfinite(secfilt[Nsec].psfQfMax) && (secfilt[Nsec].psfQfMax > psfQfMax)) psfQfMax = secfilt[Nsec].psfQfMax; 800 if (isfinite(secfilt[Nsec].psfQfPerfMax) && (secfilt[Nsec].psfQfPerfMax > psfQfPerfMax)) psfQfPerfMax = secfilt[Nsec].psfQfPerfMax; 785 801 } 786 802 … … 799 815 800 816 // if too few valid measurements meet the minimum criteria, go to the next entry 801 StatType *ap erstats = &results->aperstats;802 Nranking = magStatsByRanking (&results->aperData[Nsec], ap erstats);817 StatType *apstats = &results->apstats; 818 Nranking = magStatsByRanking (&results->aperData[Nsec], apstats); 803 819 if (Nranking) { 804 secfilt[Nsec].FapWrp = ap erstats->mean;805 secfilt[Nsec].dFapWrp = ap erstats->error;806 secfilt[Nsec].sFapWrp = (ap erstats->Nmeas > 1) ? aperstats->chisq : NAN;807 secfilt[Nsec].NusedApWrp = ap erstats->Nmeas;820 secfilt[Nsec].FapWrp = apstats->mean; 821 secfilt[Nsec].dFapWrp = apstats->error; 822 secfilt[Nsec].sFapWrp = (apstats->Nmeas > 1) ? apstats->chisq : NAN; 823 secfilt[Nsec].NusedApWrp = apstats->Nmeas; 808 824 secfilt[Nsec].MapWrp = isnan(secfilt[Nsec].FapWrp) ? NAN : 8.9 - 2.5*log10(secfilt[Nsec].FapWrp); // 8.9 since flux is in Jy 809 825 } … … 823 839 secfilt[Nsec].NwarpGood = results->NmeasGood[Nsec]; 824 840 } 825 826 setGlobalObjStats (average, measure);827 828 return (TRUE);829 }830 831 int setGlobalObjStats (Average *average, Measure *measure) {832 833 off_t k;834 835 myAbort ("this function makes no sense");836 837 float psfQFmax = 0.0;838 float psfQFperfmax = 0.0;839 float stargalmax = 0.0;840 841 for (k = 0; k < average[0].Nmeasure; k++) {842 843 if (isfinite(measure[k].psfQF)) {844 psfQFmax = MAX (psfQFmax, measure[k].psfQF);845 }846 if (isfinite(measure[k].psfQFperf)) {847 psfQFperfmax = MAX (psfQFperfmax, measure[k].psfQFperf);848 }849 850 // only count psfQF > 0.85 here851 if (isfinite(measure[k].extNsigma) && (measure[k].psfQF > 0.85)) {852 stargalmax = MAX (stargalmax, measure[k].extNsigma);853 }854 }855 average[0].psfQF = psfQFmax;856 average[0].psfQFperf = psfQFperfmax;857 average[0].stargal = stargalmax;858 859 841 return (TRUE); 860 842 } -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/setMrelFinal.c
r38297 r38317 46 46 for (i = 0; i < catalog[0].Naverage; i++) { 47 47 off_t N = Nsecfilt*i+Nsec; 48 dvo_secfilt_init (&catalog[0].secfilt[N] );48 dvo_secfilt_init (&catalog[0].secfilt[N], SECFILT_RESET_ALL); 49 49 50 50 off_t m = catalog[0].average[i].measureOffset;
Note:
See TracChangeset
for help on using the changeset viewer.
