Changeset 37113
- Timestamp:
- Jul 24, 2014, 11:14:51 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140717/Ohana/src/relphot
- Files:
-
- 5 edited
-
include/relphot.h (modified) (1 diff)
-
src/ImageOps.c (modified) (1 diff)
-
src/StarOps.c (modified) (2 diffs)
-
src/bcatalog.c (modified) (1 diff)
-
src/setMrelCatalog.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140717/Ohana/src/relphot/include/relphot.h
r37099 r37113 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); -
branches/eam_branches/ipp-20140717/Ohana/src/relphot/src/ImageOps.c
r37037 r37113 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; -
branches/eam_branches/ipp-20140717/Ohana/src/relphot/src/StarOps.c
r37037 r37113 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); -
branches/eam_branches/ipp-20140717/Ohana/src/relphot/src/bcatalog.c
r37037 r37113 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 -
branches/eam_branches/ipp-20140717/Ohana/src/relphot/src/setMrelCatalog.c
r37099 r37113 441 441 442 442 // only apply Stack operation on setMrelFinal in first pass 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 443 447 int setMrelAverageStack (off_t measureOffset, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure) { 444 448 445 449 off_t k, ID; 446 450 447 float M sys = 0, Mcal= 0, Mmos = 0, Mgrid= 0;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 498 if (measure[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS_STACK(Nbad); 499 499 // match measurement to its image (this is just a check, right?) 500 500 if (getImageEntry (meas, cat) < 0) { 501 501 fprintf (stderr, "*** warning : this should be impossible\n"); … … 503 503 continue; 504 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 518 if (measure[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS_STACK(Nbad); 519 505 520 // measurements without an image are either external reference photometry or 506 521 // data for which the associated image has not been loaded (probably because of … … 514 529 if (isnan(Mgrid)) SKIP_THIS_MEAS_STACK(Ngrid); 515 530 516 Msys = PhotSys (&measure[k], &average[0], &secfilt[0], MAG_CLASS_PSF); 517 if (isnan(Msys)) SKIP_THIS_MEAS_STACK(Nsys); 518 519 unsigned int stackImageID; 520 521 // which stack image should we use for the mean value? 522 // if we request the primary (USE_TREE_FOR_PRIMARY), then find the min distances for data from the primary cell 523 if (MatchImageSkycellID (meas, cat, tessID, projectID, skycellID)) { 524 float stackPrimaryOffset = getCenterOffset (meas, cat, &measure[k], &stackImageID); 525 if (stackPrimaryOffset < stackPrimaryOffsetMin) { 526 stackPrimaryOffsetMin = stackPrimaryOffset; 527 // stackPrimaryIDmin = stackImageID; 528 stackPrimaryMeasureMin = k; 529 } 530 } 531 532 // get the center distance for the generic case: 533 float stackCenterOffset = getCenterOffset (meas, cat, &measure[k], &stackImageID); 534 if (stackCenterOffset < stackCenterOffsetMin) { 535 stackCenterOffsetMin = stackCenterOffset; 536 // stackCenterIDmin = stackImageID; 537 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; 538 538 } 539 539 … … 558 558 559 559 // measurements which are bad will not have a valid stack entry and are skipped 560 k = (stack PrimaryMeasureMin >= 0) ? stackPrimaryMeasureMin : stackCenterMeasureMin;560 k = (stackBestMeasure >= 0) ? stackBestMeasure : stackPrimaryMeasure; 561 561 if (k < 0) continue; 562 563 562 564 563 // we are now populating stackDetectID not stack Image ID in secfilt … … 609 608 secfilt[Nsec].dFapStk = zpFactor * measure[k].dFluxAp; 610 609 610 // Jy to AB mags 611 611 secfilt[Nsec].MpsfStk = (measure[k].FluxPSF > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FpsfStk) : NAN; 612 612 secfilt[Nsec].MkronStk = (measure[k].FluxKron > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FkronStk) : NAN; 613 613 secfilt[Nsec].MapStk = (measure[k].FluxAp > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FapStk) : NAN; 614 614 615 secfilt[Nsec].stackDetectID = ID; 616 615 secfilt[Nsec].stackBestOff = k + measureOffset; 616 617 // this is the measurement used by secfilt[] 617 618 measure[k].dbFlags |= ID_MEAS_STACK_PHOT_SRC; 618 if (stackPrimaryMeasureMin >= 0) { 619 measure[k].dbFlags |= ID_MEAS_STACK_PRIMARY; 619 if (k == stackPrimaryMeasure) { 620 620 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMARY; 621 621 } … … 646 646 647 647 off_t k; 648 float Fsys = 0,Mcal= 0;648 float Mcal= 0; 649 649 650 650 // we are measuring means for 3 types of FLUXes: psf, ap, kron. I am using the psf mag … … 668 668 669 669 // option for a test print 670 if ( FALSE && (average[0].objID == 0x7146) && (average[0].catID == 0x49d8)) {670 if ((average[0].objID == 0xd6e) && (average[0].catID == 0x4984)) { 671 671 fprintf (stderr, "test obj\n"); 672 672 print_measure_set_alt (average, secfilt, measure); … … 684 684 if (found[Nsec]) continue; 685 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 686 691 off_t meas = measureOffset; 687 692 … … 698 703 if (!code) continue; 699 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; 700 709 701 710 if (measure[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS(Nbad); … … 724 733 // are small (and not measured) 725 734 float Fpsf = PhotFluxCat (&measure[k], MAG_CLASS_PSF); 726 if (isnan(F sys)) SKIP_THIS_MEAS(Nsys);735 if (isnan(Fpsf)) SKIP_THIS_MEAS(Nsys); 727 736 // if (Msys < 0.0) SKIP_THIS_MEAS(Nsys); 728 737 // if (Msys > 30.0) SKIP_THIS_MEAS(Nsys); 729 738 730 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 731 749 dFpsf = MAX (dFpsf, MIN_ERROR*Fpsf); // MIN_ERROR is a fractional error 732 750 Fpsflist[Npsf] = Fpsf * Fcal; … … 734 752 wpsflist[Npsf] = 1.0; 735 753 Npsf ++; 754 755 measure[k].dbFlags |= ID_MEAS_WARP_USED; 736 756 737 757 float Fap = PhotFluxCat (&measure[k], MAG_CLASS_APER);
Note:
See TracChangeset
for help on using the changeset viewer.
