Changeset 37116 for trunk/Ohana/src/relphot
- Timestamp:
- Jul 24, 2014, 5:10:56 PM (12 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 6 edited
-
. (modified) (1 prop)
-
src/relphot/include/relphot.h (modified) (2 diffs)
-
src/relphot/src/ImageOps.c (modified) (1 diff)
-
src/relphot/src/StarOps.c (modified) (2 diffs)
-
src/relphot/src/bcatalog.c (modified) (1 diff)
-
src/relphot/src/setMrelCatalog.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo set to
-
trunk/Ohana/src/relphot/include/relphot.h
r37037 r37116 440 440 int MatchImageName (off_t meas, int cat, char *name); 441 441 int MatchImageSkycellID (off_t meas, int cat, int myTessID, int myProjectionID, int mySkycellID); 442 int FindImageSkycellID (off_t meas, int cat, int *myTessID, int *myProjectionID, int *mySkycellID); 442 443 443 444 int load_tess (char *treefile); … … 451 452 int setMrel_catalog_alt (Catalog *catalog, int Nc, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, int Nsecfilt); 452 453 int setMrelAverageExposure (off_t meas, int cat, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, AverageTiny *averageT, SecFilt *secfilt, Measure *measure, MeasureTiny *measureT, off_t *found); 453 int setMrelAverageStack (off_t meas, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure , char *primaryCell);454 int setMrelAverageStack (off_t meas, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure); 454 455 int setGlobalObjStats (Average *average, Measure *measure); 455 456 -
trunk/Ohana/src/relphot/src/ImageOps.c
r37037 r37116 491 491 if (projectID[i] != myProjectionID) return FALSE; 492 492 if (skycellID[i] != mySkycellID) return FALSE; 493 494 return TRUE; 495 } 496 497 // returns image.Mcal - ff(x,y) 498 int FindImageSkycellID (off_t meas, int cat, int *myTessID, int *myProjectionID, int *mySkycellID) { 499 500 off_t i; 501 502 if (!MeasureToImage) return FALSE; 503 504 if (meas < 0) return FALSE; 505 506 i = MeasureToImage[cat][meas]; 507 if (i == -1) return FALSE; 508 509 if (tessID[i] == -1) return FALSE; 510 if (projectID[i] == -1) return FALSE; 511 if (skycellID[i] == -1) return FALSE; 512 513 *myTessID = tessID[i]; 514 *myProjectionID = projectID[i]; 515 *mySkycellID = skycellID[i]; 493 516 494 517 return TRUE; -
trunk/Ohana/src/relphot/src/StarOps.c
r37037 r37116 1086 1086 if (ecode != thisCode) { continue; } 1087 1087 1088 // SKIP gpc1 stack data 1089 if (isGPC1stack(catalog[i].measureT[m].photcode)) continue; 1090 1091 // SKIP gpc1 forced-warp data 1092 if (isGPC1warp(catalog[i].measureT[m].photcode)) continue; 1093 1088 1094 // NOTE: we do not skip MEAS_BAD because this measurement is just an internal assessment of the outliers 1089 1095 Mcal = getMcal (m, i, flatcorr, catalog); … … 1131 1137 if (ecode != thisCode) { continue; } 1132 1138 1139 // SKIP gpc1 stack data 1140 if (isGPC1stack(catalog[i].measureT[m].photcode)) continue; 1141 1142 // SKIP gpc1 forced-warp data 1143 if (isGPC1warp(catalog[i].measureT[m].photcode)) continue; 1144 1133 1145 // NOTE: we do not skip MEAS_BAD because this measurement is just an internal assessment of the outliers 1134 1146 Mcal = getMcal (m, i, flatcorr, catalog); -
trunk/Ohana/src/relphot/src/bcatalog.c
r37037 r37116 78 78 int Nsec = GetPhotcodeNsec(thisCode); 79 79 80 fprintf (stderr, "really use dvo_secfilt_init?");80 // fprintf (stderr, "really use dvo_secfilt_init?"); 81 81 dvo_secfilt_init (&subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec]); 82 82 -
trunk/Ohana/src/relphot/src/setMrelCatalog.c
r37037 r37116 50 50 int isSetMrelFinal = (pass >= 0); 51 51 52 char *primaryCell = NULL;53 if (isSetMrelFinal) {54 ALLOCATE (primaryCell, char, DVO_MAX_PATH);55 }52 // XX char *primaryCell = NULL; 53 // XX if (isSetMrelFinal) { 54 // XX ALLOCATE (primaryCell, char, DVO_MAX_PATH); 55 // XX } 56 56 57 57 for (j = 0; j < catalog[Nc].Naverage; j++) { … … 64 64 // only apply Stack operation on setMrelFinal in first pass 65 65 if (isSetMrelFinal && (pass == 0)) { 66 setMrelAverageStack (m, Nc, flatcorr, results, &catalog[Nc].average[j], &catalog[Nc].secfilt[j*Nsecfilt], &catalog[Nc].measure[m] , primaryCell);66 setMrelAverageStack (m, Nc, flatcorr, results, &catalog[Nc].average[j], &catalog[Nc].secfilt[j*Nsecfilt], &catalog[Nc].measure[m]); 67 67 setGlobalObjStats (&catalog[Nc].average[j], &catalog[Nc].measure[m]); 68 68 } … … 74 74 } 75 75 } 76 if (primaryCell) free (primaryCell);76 // if (primaryCell) free (primaryCell); 77 77 return (TRUE); 78 78 } … … 441 441 442 442 // only apply Stack operation on setMrelFinal in first pass 443 int setMrelAverageStack (off_t measureOffset, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, char *primaryCell) { 444 445 off_t k, ID; 446 447 float Msys = 0, Mcal= 0, Mmos = 0, Mgrid = 0; 443 // this function has 3 goals, not to be confused: 444 // 1) find and mark the PRIMARY detections (regardless of the quality of the detection) 445 // 2) select the BEST detections per filter (regardless of PRIMARY) 446 // 3) apply the zero point and AB->Jy transformations 447 int setMrelAverageStack (off_t measureOffset, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure) { 448 449 off_t k; 450 451 float Mcal= 0, Mmos = 0, Mgrid = 0, Finst = 0; 448 452 449 453 // set the primary projection cell and skycell for this coordinate … … 467 471 int haveStack = FALSE; 468 472 469 // need to find the measurement closest to the center of its skycell, as well as the 470 // closest for the subset of primary projection cells 471 472 float stackCenterOffsetMin = 1e9; 473 off_t stackCenterMeasureMin = -1; 474 475 float stackPrimaryOffsetMin = 1e9; 476 off_t stackPrimaryMeasureMin = -1; 473 float psfQFbest = 0.0; 474 475 off_t stackBestMeasure = -1; 476 off_t stackPrimaryMeasure = -1; 477 477 478 478 int isBad = FALSE; … … 481 481 off_t meas = measureOffset; 482 482 for (k = 0; k < average[0].Nmeasure; k++, meas++) { 483 484 // only examine gpc1 stack data 485 if (!isGPC1stack(measure[k].photcode)) continue; 483 486 484 487 // skip measurements that do not match the current photcode … … 489 492 // clear this bit for all measurements 490 493 measure[k].dbFlags &= ~ID_MEAS_STACK_PRIMARY; 491 492 // only examine gpc1 stack data 493 if (!isGPC1stack(measure[k].photcode)) continue; 494 measure[k].dbFlags &= ~ID_MEAS_STACK_PHOT_SRC; 494 495 495 496 haveStack = TRUE; 496 497 haveStackObject = TRUE; 497 498 499 // match measurement to its image (this is just a check, right?) 500 if (getImageEntry (meas, cat) < 0) { 501 fprintf (stderr, "*** warning : this should be impossible\n"); 502 abort(); 503 continue; 504 } 505 506 // find the PRIMARY measurement 507 508 // if we request the primary (USE_TREE_FOR_PRIMARY), this is true if the measurement is from the 509 // primary skycell for this position 510 if (MatchImageSkycellID (meas, cat, tessID, projectID, skycellID)) { 511 stackPrimaryMeasure = k; 512 measure[k].dbFlags |= ID_MEAS_STACK_PRIMARY; 513 secfilt[Nsec].stackPrmryOff = meas; 514 } 515 516 // now choose the BEST measurements (may also be PRIMARY) 517 498 518 if (measure[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS_STACK(Nbad); 499 519 500 if (getImageEntry (meas, cat) < 0) continue;501 520 // measurements without an image are either external reference photometry or 502 521 // data for which the associated image has not been loaded (probably because of … … 510 529 if (isnan(Mgrid)) SKIP_THIS_MEAS_STACK(Ngrid); 511 530 512 Msys = PhotSys (&measure[k], &average[0], &secfilt[0], MAG_CLASS_PSF); 513 if (isnan(Msys)) SKIP_THIS_MEAS_STACK(Nsys); 514 515 unsigned int stackImageID; 516 517 // which stack image should we use for the mean value? 518 // if we request the primary (USE_TREE_FOR_PRIMARY), then find the min distances for data from the primary cell 519 if (MatchImageSkycellID (meas, cat, tessID, projectID, skycellID)) { 520 float stackPrimaryOffset = getCenterOffset (meas, cat, &measure[k], &stackImageID); 521 if (stackPrimaryOffset < stackPrimaryOffsetMin) { 522 stackPrimaryOffsetMin = stackPrimaryOffset; 523 // stackPrimaryIDmin = stackImageID; 524 stackPrimaryMeasureMin = k; 525 } 526 } 527 528 // get the center distance for the generic case: 529 float stackCenterOffset = getCenterOffset (meas, cat, &measure[k], &stackImageID); 530 if (stackCenterOffset < stackCenterOffsetMin) { 531 stackCenterOffsetMin = stackCenterOffset; 532 // stackCenterIDmin = stackImageID; 533 stackCenterMeasureMin = k; 531 // NOTE: negative and insignificant vlues values are allowed, but not NAN flux values 532 Finst = PhotFluxInst (&measure[k], MAG_CLASS_PSF); 533 if (isnan(Finst)) SKIP_THIS_MEAS_STACK(Ninst); 534 535 if (measure[k].psfQFperf > psfQFbest) { 536 psfQFbest = measure[k].psfQFperf; 537 stackBestMeasure = k; 534 538 } 535 539 … … 554 558 555 559 // measurements which are bad will not have a valid stack entry and are skipped 556 k = (stack PrimaryMeasureMin >= 0) ? stackPrimaryMeasureMin : stackCenterMeasureMin;560 k = (stackBestMeasure >= 0) ? stackBestMeasure : stackPrimaryMeasure; 557 561 if (k < 0) continue; 558 559 562 560 563 // we are now populating stackDetectID not stack Image ID in secfilt 561 564 // ID = (stackPrimaryMeasureMin >= 0) ? stackPrimaryIDmin : stackCenterIDmin; 562 ID = measure[k].extID; // for the stack, this is the stackDetectID565 // ID = measure[k].extID; // for the stack, this is the stackDetectID 563 566 564 567 // get the zero point for the selected image … … 605 608 secfilt[Nsec].dFapStk = zpFactor * measure[k].dFluxAp; 606 609 610 // Jy to AB mags 607 611 secfilt[Nsec].MpsfStk = (measure[k].FluxPSF > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FpsfStk) : NAN; 608 612 secfilt[Nsec].MkronStk = (measure[k].FluxKron > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FkronStk) : NAN; 609 613 secfilt[Nsec].MapStk = (measure[k].FluxAp > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FapStk) : NAN; 610 614 611 secfilt[Nsec].stackDetectID = ID; 612 615 secfilt[Nsec].stackBestOff = k + measureOffset; 616 617 // this is the measurement used by secfilt[] 613 618 measure[k].dbFlags |= ID_MEAS_STACK_PHOT_SRC; 614 if (stackPrimaryMeasureMin >= 0) { 615 measure[k].dbFlags |= ID_MEAS_STACK_PRIMARY; 619 if (k == stackPrimaryMeasure) { 616 620 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMARY; 617 621 } … … 642 646 643 647 off_t k; 644 float Fsys = 0,Mcal= 0;648 float Mcal= 0; 645 649 646 650 // we are measuring means for 3 types of FLUXes: psf, ap, kron. I am using the psf mag … … 664 668 665 669 // option for a test print 666 if ( FALSE && (average[0].objID == 0x7146) && (average[0].catID == 0x49d8)) {670 if ((average[0].objID == 0xd6e) && (average[0].catID == 0x4984)) { 667 671 fprintf (stderr, "test obj\n"); 668 672 print_measure_set_alt (average, secfilt, measure); … … 680 684 if (found[Nsec]) continue; 681 685 686 // I need to restrict the measurements coming only from the same skycell as the secfilt values 687 // if we cannot make that association, skip this set of warps 688 int stkTessID, stkProjID, stkSkycellID; 689 if (!FindImageSkycellID (secfilt[Nsec].stackBestOff, cat, &stkTessID, &stkProjID, &stkSkycellID)) continue; 690 682 691 off_t meas = measureOffset; 683 692 … … 694 703 if (!code) continue; 695 704 if (code->equiv != thisCode) { continue; } 705 706 measure[k].dbFlags &= ~ID_MEAS_WARP_USED; 707 708 if (!MatchImageSkycellID (meas, cat, stkTessID, stkProjID, stkSkycellID)) continue; 696 709 697 710 if (measure[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS(Nbad); … … 720 733 // are small (and not measured) 721 734 float Fpsf = PhotFluxCat (&measure[k], MAG_CLASS_PSF); 722 if (isnan(F sys)) SKIP_THIS_MEAS(Nsys);735 if (isnan(Fpsf)) SKIP_THIS_MEAS(Nsys); 723 736 // if (Msys < 0.0) SKIP_THIS_MEAS(Nsys); 724 737 // if (Msys > 30.0) SKIP_THIS_MEAS(Nsys); 725 738 726 739 float dFpsf = PhotFluxCatErr (&measure[k], MAG_CLASS_PSF); 740 if (isnan(dFpsf)) SKIP_THIS_MEAS (Nsys); 741 742 int isBad = (measure[k].psfQF < 0.85); 743 isBad |= isnan(measure[k].psfQF); 744 if (isBad) SKIP_THIS_MEAS (Nsys); 745 746 int isPoor = (measure[k].psfQFperf < 0.85); 747 if ((pass == 0) && isPoor) SKIP_THIS_MEAS (Nsys); 748 727 749 dFpsf = MAX (dFpsf, MIN_ERROR*Fpsf); // MIN_ERROR is a fractional error 728 750 Fpsflist[Npsf] = Fpsf * Fcal; … … 730 752 wpsflist[Npsf] = 1.0; 731 753 Npsf ++; 754 755 measure[k].dbFlags |= ID_MEAS_WARP_USED; 732 756 733 757 float Fap = PhotFluxCat (&measure[k], MAG_CLASS_APER);
Note:
See TracChangeset
for help on using the changeset viewer.
