Changeset 41473
- Timestamp:
- Jan 24, 2021, 3:31:48 PM (5 years ago)
- Location:
- trunk/Ohana/src/relphot
- Files:
-
- 10 edited
-
include/relphot.h (modified) (4 diffs)
-
src/ImageOps.c (modified) (3 diffs)
-
src/MosaicOps.c (modified) (18 diffs)
-
src/StarOps.c (modified) (1 diff)
-
src/TGroupOps.c (modified) (18 diffs)
-
src/ZeroPointModes.c (modified) (9 diffs)
-
src/args.c (modified) (1 diff)
-
src/relphot_images.c (modified) (4 diffs)
-
src/relphot_parallel_images.c (modified) (4 diffs)
-
src/setMrelCatalog.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relphot/include/relphot.h
r41467 r41473 30 30 31 31 typedef enum { 32 ZPT_STARS, 32 33 ZPT_TGROUP, 33 34 ZPT_MOSAIC, … … 458 459 // int PhotNsec; 459 460 460 PhotCode *refPhotcode; 461 PhotCode *refPhotcode; 462 int USE_REFERENCE_WEIGHT; 461 463 462 464 int MaxDensityUse; … … 633 635 int setMcalOutput PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr)); 634 636 635 void setMcal PROTO((Catalog *catalog, int Nloop, intPoor, FlatCorrectionTable *flatcorr));636 int setMmos PROTO((Catalog *catalog, int Nloop, intPoor, FlatCorrectionTable *flatcorr));637 int setMgrp PROTO((Catalog *catalog, int Nloop, intPoor, FlatCorrectionTable *flatcorr));637 void setMcal PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr)); 638 int setMmos PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr)); 639 int setMgrp PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr)); 638 640 639 641 int setMrel PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr)); … … 834 836 void dump_catalog (Catalog *catalog, off_t c, int Npass); 835 837 836 void SetZeroPointModes (int nloop); 837 int UseStandardOLS (int nloop, ZptFitModeType mode); 838 void SetZptIteration (int current); 839 int GetZptIteration (void); 840 841 void SetZeroPointModes (void); 842 int UseStandardOLS (ZptFitModeType mode); -
trunk/Ohana/src/relphot/src/ImageOps.c
r41467 r41473 581 581 582 582 /* determine Mcal values for all images */ 583 void setMcal (Catalog *catalog, int Nloop, intPoorImages, FlatCorrectionTable *flatcorr) {583 void setMcal (Catalog *catalog, int PoorImages, FlatCorrectionTable *flatcorr) { 584 584 585 585 off_t i, j, m, c, n; … … 611 611 // until the analysis has converged a bit, do not use the IRLS analysis 612 612 // default is MaxIterations = 10 613 if (UseStandardOLS( Nloop,ZPT_IMAGES)) {613 if (UseStandardOLS(ZPT_IMAGES)) { 614 614 brightStars.MaxIterations = 0; 615 615 kronStars.MaxIterations = 0; … … 799 799 800 800 // bright end scatter 801 //fit1d_irls (&brightStars, Nbright);802 //image[i].dMagSys = brightStars.sigma;801 fit1d_irls (&brightStars, Nbright); 802 image[i].dMagSys = brightStars.sigma; 803 803 804 804 if (image[i].McalPSF < -CLOUD_TOLERANCE) { -
trunk/Ohana/src/relphot/src/MosaicOps.c
r41467 r41473 306 306 mosaic[j].nValPhotom = 0; 307 307 308 mosaic[j].dMsys = subset[i]. flags;308 mosaic[j].dMsys = subset[i].dMagSys; 309 309 mosaic[j].flags = subset[i].flags; 310 310 mosaic[j].secz = subset[i].secz; … … 446 446 mosaic[j].dMcal = 0.0; 447 447 mosaic[j].McalChiSq = 0.0; 448 mosaic[j].dMsys = image[i]. flags;448 mosaic[j].dMsys = image[i].dMagSys; 449 449 mosaic[j].flags = image[i].flags; 450 450 mosaic[j].secz = image[i].secz; … … 743 743 image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_FEW); 744 744 image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_POOR); 745 image[im].flags |= (mosaic[i].flags & ID_IMAGE_MOSAIC_POOR); 745 746 } 746 747 mosaic[i].McalPSF = 0.0; … … 973 974 int Nsys; 974 975 int Nskip; 975 int Nloop;976 976 off_t Nmax; 977 977 int PoorImages; … … 994 994 int setMmos_mosaic (Mosaic *mosaic, off_t Nmos, Image *image, Catalog *catalog, SetMmosInfo *info, FlatCorrectionTable *flatcorr); 995 995 void *setMmos_worker (void *data); 996 int setMmos_threaded (Catalog *catalog, int Nloop, intPoorImages, FlatCorrectionTable *flatcorr);997 998 void SetMmosInfoInit (SetMmosInfo *info, off_t Nmax, int allocLists, int PoorImages , int Nloop) {996 int setMmos_threaded (Catalog *catalog, int PoorImages, FlatCorrectionTable *flatcorr); 997 998 void SetMmosInfoInit (SetMmosInfo *info, off_t Nmax, int allocLists, int PoorImages) { 999 999 info->Nfew = 0; 1000 1000 info->Nbad = 0; … … 1006 1006 1007 1007 info->Nmax = Nmax; 1008 info->Nloop = Nloop;1009 1008 info->PoorImages = PoorImages; 1010 1009 … … 1016 1015 1017 1016 // until the analysis has converged a bit, do not use the IRLS analysis 1018 if (UseStandardOLS( Nloop,ZPT_MOSAIC)) {1017 if (UseStandardOLS(ZPT_MOSAIC)) { 1019 1018 info->brightStars.MaxIterations = 0; 1020 1019 info->kronStars.MaxIterations = 0; … … 1062 1061 } 1063 1062 1064 int setMmos (Catalog *catalog, int Nloop, intPoorImages, FlatCorrectionTable *flatcorr) {1063 int setMmos (Catalog *catalog, int PoorImages, FlatCorrectionTable *flatcorr) { 1065 1064 1066 1065 off_t i, N, Nmax; … … 1075 1074 // so do not run setMmos in threaded mode if PLOTSTUFF is set 1076 1075 if (NTHREADS && !PLOTSTUFF) { 1077 int status = setMmos_threaded (catalog, Nloop,PoorImages, flatcorr);1076 int status = setMmos_threaded (catalog, PoorImages, flatcorr); 1078 1077 return status; 1079 1078 } … … 1095 1094 1096 1095 SetMmosInfo info; 1097 SetMmosInfoInit (&info, Nmax, TRUE, PoorImages , Nloop);1096 SetMmosInfoInit (&info, Nmax, TRUE, PoorImages); 1098 1097 1099 1098 // int savePlotDelay = PLOTDELAY; … … 1338 1337 1339 1338 fit1d_irls (psfStars, N); 1340 // if (VERBOSE2 && info->PoorImages) fprintf (stderr, "Mmos: %f %f %d %d\n", stats.mean, stats.sigma, stats.Nmeas, N);1339 fit1d_irls (brightStars, Nbright); 1341 1340 1342 1341 // for now, I have no reason to measure these separately for camera-level images … … 1347 1346 myMosaic[0].nValPhotom = N; 1348 1347 1349 // fit1d_irls (kronStars, N); // does it make sense to calculate a zero point based kron mags?1350 // myMosaic->McalAPER = ???1348 fit1d_irls (kronStars, N); 1349 myMosaic->McalAPER = kronStars->bSaveArray[0][0]; 1351 1350 1352 1351 if (testImage) { … … 1360 1359 1361 1360 // bright end scatter 1362 // fit1d_irls (brightStars, N); // does it make sense to calculate a separate bright star zero point?1363 // myMosaic->dMsys = ???1361 fit1d_irls (brightStars, Nbright); 1362 myMosaic->dMsys = brightStars->sigma; // stdev of bright star mags 1364 1363 1365 1364 if (myMosaic[0].McalPSF < -CLOUD_TOLERANCE) { … … 1381 1380 off_t im = MosaicToImage[Nmos][j]; 1382 1381 image[im].ubercalDist = myMosaic[0].ubercalDist; 1383 // fprintf (stderr, "%d %d %d\n", (int) i, (int) im, image[im].ubercalDist);1384 1382 } 1385 1383 … … 1390 1388 } 1391 1389 1392 int setMmos_threaded (Catalog *catalog, int Nloop, intPoorImages, FlatCorrectionTable *flatcorr) {1390 int setMmos_threaded (Catalog *catalog, int PoorImages, FlatCorrectionTable *flatcorr) { 1393 1391 1394 1392 int i; … … 1411 1409 1412 1410 SetMmosInfo summary; 1413 SetMmosInfoInit (&summary, Nmax, FALSE, PoorImages , Nloop);1411 SetMmosInfoInit (&summary, Nmax, FALSE, PoorImages); 1414 1412 1415 1413 pthread_attr_t attr; … … 1437 1435 // we do NOT allocate the arrays here, we only supply basic info (Nmax, Nloop, 1438 1436 // PoorImages) used in the threads to allocate the arrays and set the MaxIterations 1439 SetMmosInfoInit (&threadinfo[i].info, Nmax, FALSE, PoorImages , Nloop);1437 SetMmosInfoInit (&threadinfo[i].info, Nmax, FALSE, PoorImages); 1440 1438 pthread_create (&threads[i], NULL, setMmos_worker, &threadinfo[i]); 1441 1439 } … … 1495 1493 1496 1494 SetMmosInfo results; 1497 SetMmosInfoInit (&results, threadinfo->info.Nmax, TRUE, threadinfo->info.PoorImages , threadinfo->info.Nloop);1495 SetMmosInfoInit (&results, threadinfo->info.Nmax, TRUE, threadinfo->info.PoorImages); 1498 1496 1499 1497 while (1) { -
trunk/Ohana/src/relphot/src/StarOps.c
r41462 r41473 1084 1084 void dump_catalog (Catalog *catalog, off_t c, int Npass) { 1085 1085 1086 return; 1087 1086 1088 int Nsecfilt = GetPhotcodeNsecfilt (); 1087 1089 -
trunk/Ohana/src/relphot/src/TGroupOps.c
r41467 r41473 427 427 image[im].dMagSys = tgroup[i].dMsys; 428 428 image[im].nFitPhotom = tgroup[i].nFitPhotom; 429 image[im].flags |= (tgroup[i].flags & ID_IMAGE_NIGHT_POOR); // XXX copy this down?430 image[im].flags |= (tgroup[i].flags & ID_IMAGE_MOSAIC_POOR); // XXX copy this down?429 image[im].flags |= (tgroup[i].flags & ID_IMAGE_NIGHT_POOR); // probably not necessary : it is set in markBadTGroup 430 image[im].flags |= (tgroup[i].flags & ID_IMAGE_MOSAIC_POOR); // probably not necessary : it is set in markBadTGroup 431 431 image[im].flags |= (tgroup[i].flags & ID_IMAGE_PHOTOM_FEW); 432 432 image[im].flags |= (tgroup[i].flags & ID_IMAGE_PHOTOM_POOR); 433 433 image[im].flags |= (tgroup[i].flags & ID_IMAGE_PHOTOM_UBERCAL); 434 434 435 fprintf (stderr, "TG to IMAGE: %f +/- %f -> %f (%d)\n", tgroup[i].McalPSF, tgroup[i].dMcal, image[im].McalPSF, tgroup[i].nFitPhotom);435 // fprintf (stderr, "TG to IMAGE: %f +/- %f -> %f (%d)\n", tgroup[i].McalPSF, tgroup[i].dMcal, image[im].McalPSF, tgroup[i].nFitPhotom); 436 436 } 437 437 tgroup[i].McalPSF = 0.0; … … 547 547 } 548 548 fprintf (stderr, "Matched %d detections to tgroups\n", Nmatch); 549 for (i = 0; i < NtgroupTimes; i++) { 549 550 // XXX print results for testing 551 for (i = 0; FALSE && (i < NtgroupTimes); i++) { 550 552 TGroup *tgroup = tgroupTimes[i][0].byCode; 551 553 for (off_t j = 0; j < tgroupTimes[i][0].nCode; j++) { 552 fprintf (stderr, " TGROUP time %.0f photcode %d, Nmeasure: %d, Nimage: %d\n", ohana_sec_to_mjd(tgroupTimes[i][0].start), tgroup[j].photcode, (int) tgroup[j].Nmeasure, (int) tgroup[j].Nimage);554 if (0) fprintf (stderr, " TGROUP time %.0f photcode %d, Nmeasure: %d, Nimage: %d\n", ohana_sec_to_mjd(tgroupTimes[i][0].start), tgroup[j].photcode, (int) tgroup[j].Nmeasure, (int) tgroup[j].Nimage); 553 555 } 554 556 } … … 643 645 int Nsys; 644 646 int Nskip; 645 int Nloop;646 647 off_t Nmax; 647 648 int PoorImages; … … 664 665 int setMgrp_tgroup (TGroup *tgroup, off_t Nmos, Image *image, Catalog *catalog, SetMgrpInfo *info, FlatCorrectionTable *flatcorr); 665 666 void *setMgrp_worker (void *data); 666 int setMgrp_threaded (Catalog *catalog, int Nloop, intPoorImages, FlatCorrectionTable *flatcorr);667 668 void SetMgrpInfoInit (SetMgrpInfo *info, off_t Nmax, int allocLists, int PoorImages , int Nloop) {667 int setMgrp_threaded (Catalog *catalog, int PoorImages, FlatCorrectionTable *flatcorr); 668 669 void SetMgrpInfoInit (SetMgrpInfo *info, off_t Nmax, int allocLists, int PoorImages) { 669 670 info->Nfew = 0; 670 671 info->Nbad = 0; … … 677 678 678 679 info->Nmax = Nmax; 679 info->Nloop = Nloop;680 680 info->PoorImages = PoorImages; 681 681 … … 688 688 689 689 // until the analysis has converged a bit, do not use the IRLS analysis 690 if (UseStandardOLS( Nloop,ZPT_TGROUP)) {690 if (UseStandardOLS(ZPT_TGROUP)) { 691 691 info->brightStars.MaxIterations = 0; 692 692 info->kronStars.MaxIterations = 0; … … 740 740 } 741 741 742 int setMgrp (Catalog *catalog, int Nloop, intPoorImages, FlatCorrectionTable *flatcorr) {742 int setMgrp (Catalog *catalog, int PoorImages, FlatCorrectionTable *flatcorr) { 743 743 744 744 off_t N; … … 751 751 // so do not run setMgrp in threaded mode if PLOTSTUFF is set 752 752 if (NTHREADS && !PLOTSTUFF) { 753 int status = setMgrp_threaded (catalog, Nloop,PoorImages, flatcorr);753 int status = setMgrp_threaded (catalog, PoorImages, flatcorr); 754 754 return status; 755 755 } … … 766 766 767 767 SetMgrpInfo info; 768 SetMgrpInfoInit (&info, Nmax, TRUE, PoorImages , Nloop);768 SetMgrpInfoInit (&info, Nmax, TRUE, PoorImages); 769 769 770 770 for (off_t i = 0; i < NtgroupTimes; i++) { … … 772 772 for (off_t j = 0; j < tgroupTimes[i][0].nCode; j++) { 773 773 setMgrp_tgroup (&tgroup[j], i, image, catalog, &info, flatcorr); 774 fprintf (stderr, "TGROUP time %.0f photcode %d Mcal: %f, dK: %f, dMcal: %f, sigma: %f, chisq: %f, %d of %d, limiting negative clouds to %f\n", ohana_sec_to_mjd(tgroupTimes[i][0].start), tgroup[j].photcode, tgroup[j].McalPSF, tgroup[j].dKlam, tgroup[j].dMcal, tgroup[j].stdev, tgroup[j].McalChiSq, tgroup[j].nFitPhotom, tgroup[j].nValPhotom, CLOUD_TOLERANCE);774 // fprintf (stderr, "TGROUP time %.0f photcode %d Mcal: %f, dK: %f, dMcal: %f, sigma: %f, chisq: %f, %d of %d, limiting negative clouds to %f\n", ohana_sec_to_mjd(tgroupTimes[i][0].start), tgroup[j].photcode, tgroup[j].McalPSF, tgroup[j].dKlam, tgroup[j].dMcal, tgroup[j].stdev, tgroup[j].McalChiSq, tgroup[j].nFitPhotom, tgroup[j].nValPhotom, CLOUD_TOLERANCE); 775 775 } 776 776 } … … 971 971 myTGroup->dKlam = psfStars->bSaveArray[1][0]; 972 972 973 // XXX drop this for tgroups?974 // fit1d_irls (kronStars, N); // does it make sense to calculate a zero point based kron mags?975 // myTGroup->McalAPER = stats.mean;973 // XXX this does not make sense: I need to apply the airmass slope calculated above first 974 fit1d_irls (kronStars, N); 975 myTGroup->McalAPER = kronStars->bSaveArray[0][0]; 976 976 977 977 if (testImage) { … … 979 979 fprintf (stderr, "test night %.0f aper: %f %f %d ... ", ohana_sec_to_mjd(parent->start), myTGroup->McalPSF, myTGroup->dMcal, myTGroup->nFitPhotom); 980 980 } 981 982 // fprintf (stderr, "Mgrp: %6.3f +/- %6.3f %5d of %5d | %.2f %.0f\n", myTGroup->McalPSF, myTGroup->dMcal, myTGroup->nFitPhotom, myTGroup->nValPhotom, myTGroup->McalChiSq, ohana_sec_to_mjd(tgroup->start));983 984 981 if (PLOTSTUFF) { 985 982 fprintf (stderr, "Mgrp: %6.3f +/- %6.3f %5d of %5d | %.0f\n", myTGroup->McalPSF, myTGroup->dMcal, myTGroup->nFitPhotom, N, ohana_sec_to_mjd(tgroup->start)); … … 990 987 // XXX this does not make sense: I need to apply the airmass slope calculated above first 991 988 // redo this by calculating the corrected bright stars mags 992 // fit1d_irls (brightStars, N); // does it make sense to calculate a separate bright star zero point?993 // myTGroup->dMsys = stats.sigma;989 fit1d_irls (brightStars, Nbright); 990 myTGroup->dMsys = brightStars->sigma; 994 991 995 992 // keep this?? … … 1005 1002 } 1006 1003 1007 int setMgrp_threaded (Catalog *catalog, int Nloop, intPoorImages, FlatCorrectionTable *flatcorr) {1004 int setMgrp_threaded (Catalog *catalog, int PoorImages, FlatCorrectionTable *flatcorr) { 1008 1005 1009 1006 int i; … … 1023 1020 1024 1021 SetMgrpInfo summary; 1025 SetMgrpInfoInit (&summary, Nmax, FALSE, PoorImages , Nloop);1022 SetMgrpInfoInit (&summary, Nmax, FALSE, PoorImages); 1026 1023 1027 1024 pthread_attr_t attr; … … 1047 1044 threadinfo[i].flatcorr = flatcorr; 1048 1045 1049 // we do NOT allocate the arrays here, we only supply basic info (Nmax, Nloop,1046 // we do NOT allocate the arrays here, we only supply basic info (Nmax, 1050 1047 // PoorImages) used in the threads to allocate the arrays and set the MaxIterations 1051 SetMgrpInfoInit (&threadinfo[i].info, Nmax, FALSE, PoorImages , Nloop);1048 SetMgrpInfoInit (&threadinfo[i].info, Nmax, FALSE, PoorImages); 1052 1049 pthread_create (&threads[i], NULL, setMgrp_worker, &threadinfo[i]); 1053 1050 } … … 1104 1101 1105 1102 SetMgrpInfo results; 1106 SetMgrpInfoInit (&results, threadinfo->info.Nmax, TRUE, threadinfo->info.PoorImages , threadinfo->info.Nloop); // allocate list, dlist arrays here1103 SetMgrpInfoInit (&results, threadinfo->info.Nmax, TRUE, threadinfo->info.PoorImages); // allocate list, dlist arrays here 1107 1104 1108 1105 while (1) { … … 1427 1424 void dump_tgroups (Catalog *catalog, int Npass) { 1428 1425 1426 return; 1427 1429 1428 int Nsecfilt = GetPhotcodeNsecfilt (); 1430 1429 -
trunk/Ohana/src/relphot/src/ZeroPointModes.c
r41467 r41473 1 1 # include "relphot.h" 2 2 3 void SetZeroPointModes (int nloop) { 3 static int CurrentLoop = -1; // track the number of iterations 4 5 void SetZptIteration (int current) { 6 CurrentLoop = current; 7 } 8 9 int GetZptIteration (void) { 10 return CurrentLoop; 11 } 12 13 void SetZeroPointModes (void) { 4 14 5 15 if (TGROUP_ZEROPT && MOSAIC_ZEROPT) { 6 if (( nloop > 4) && (nloop <= 8)) {16 if ((CurrentLoop > 4) && (CurrentLoop <= 8)) { 7 17 // after iterating a few times on the TGroup zero points: 8 18 // * identify the photometric nights … … 13 23 clean_tgroups(); // do this on every pass to update the status of nights 14 24 } 15 if (( nloop > 8) && (nloop <= 999)) {25 if ((CurrentLoop > 8) && (CurrentLoop <= 999)) { 16 26 // after iterating a few times on the TGroup & Mosaic zero points: 17 27 // * identify the good / bad Mosaics … … 26 36 27 37 if (TGROUP_ZEROPT && !MOSAIC_ZEROPT) { 28 if (( nloop > 4) && (nloop <= 999)) {38 if ((CurrentLoop > 4) && (CurrentLoop <= 999)) { 29 39 // after iterating a few times on the TGroup zero points: 30 40 // * identify the photometric nights … … 38 48 39 49 if (!TGROUP_ZEROPT && MOSAIC_ZEROPT) { 40 if (( nloop > 4) && (nloop <= 999)) {50 if ((CurrentLoop > 4) && (CurrentLoop <= 999)) { 41 51 // after iterating a few times on the Mosaic zero points: 42 52 // * identify the good / bad mosaics … … 50 60 51 61 if (!TGROUP_ZEROPT && !MOSAIC_ZEROPT) { 52 if (( nloop > 4) && (nloop <= 999)) {62 if ((CurrentLoop > 4) && (CurrentLoop <= 999)) { 53 63 // after iterating a few times on the Image zero points: 54 64 // * ??? … … 61 71 62 72 // mode = TGROUP, MOSAIC, IMAGE 63 // should we use IRLS or OLS? depends on nloop and which stage we are in.64 int UseStandardOLS ( int nloop,ZptFitModeType mode) {73 // should we use IRLS or OLS? depends on CurrentLoop and which stage we are in. 74 int UseStandardOLS (ZptFitModeType mode) { 65 75 66 76 if (TGROUP_ZEROPT && MOSAIC_ZEROPT) { 67 77 switch (mode) { 78 case ZPT_STARS: 79 if (CurrentLoop < 3) return TRUE; 80 return FALSE; 68 81 case ZPT_TGROUP: 69 if ( nloop < 3) return TRUE;82 if (CurrentLoop < 3) return TRUE; 70 83 return FALSE; 71 84 case ZPT_MOSAIC: 72 if ( nloop < 7) return TRUE;85 if (CurrentLoop < 7) return TRUE; 73 86 return FALSE; 74 87 case ZPT_IMAGES: 75 88 default: 76 if ( nloop < 11) return TRUE;89 if (CurrentLoop < 11) return TRUE; 77 90 return FALSE; 78 91 } … … 81 94 if (TGROUP_ZEROPT && !MOSAIC_ZEROPT) { 82 95 switch (mode) { 96 case ZPT_STARS: 97 if (CurrentLoop < 3) return TRUE; 98 return FALSE; 83 99 case ZPT_TGROUP: 84 100 case ZPT_MOSAIC: 85 if ( nloop < 3) return TRUE;101 if (CurrentLoop < 3) return TRUE; 86 102 return FALSE; 87 103 case ZPT_IMAGES: 88 104 default: 89 if ( nloop < 7) return TRUE;105 if (CurrentLoop < 7) return TRUE; 90 106 return FALSE; 91 107 } … … 94 110 if (!TGROUP_ZEROPT && MOSAIC_ZEROPT) { 95 111 switch (mode) { 112 case ZPT_STARS: 113 if (CurrentLoop < 3) return TRUE; 114 return FALSE; 96 115 case ZPT_TGROUP: 97 116 case ZPT_MOSAIC: 98 if ( nloop < 3) return TRUE;117 if (CurrentLoop < 3) return TRUE; 99 118 return FALSE; 100 119 case ZPT_IMAGES: 101 120 default: 102 if ( nloop < 7) return TRUE;121 if (CurrentLoop < 7) return TRUE; 103 122 return FALSE; 104 123 } … … 107 126 if (!TGROUP_ZEROPT && !MOSAIC_ZEROPT) { 108 127 switch (mode) { 128 case ZPT_STARS: 129 if (CurrentLoop < 3) return TRUE; 130 return FALSE; 109 131 case ZPT_TGROUP: 110 132 case ZPT_MOSAIC: 111 133 case ZPT_IMAGES: 112 134 default: 113 if ( nloop < 3) return TRUE;135 if (CurrentLoop < 3) return TRUE; 114 136 return FALSE; 115 137 } -
trunk/Ohana/src/relphot/src/args.c
r41462 r41473 446 446 } 447 447 remove_argument (N, &argc, argv); 448 } 449 USE_REFERENCE_WEIGHT = FALSE; 450 if ((N = get_argument (argc, argv, "-ref-weight"))) { 451 remove_argument (N, &argc, argv); 452 USE_REFERENCE_WEIGHT = TRUE; 448 453 } 449 454 -
trunk/Ohana/src/relphot/src/relphot_images.c
r41467 r41473 116 116 /* determine fit values */ 117 117 for (i = 0; i < NLOOP; i++) { 118 SetZptIteration (i); 118 119 dump_tgroups (catalog, i); 119 120 dump_catalog (catalog, 0, i); // for a test, just dump a specific catalog … … 123 124 dump_catalog (catalog, 0, i + 20); // for a test, just dump a specific catalog 124 125 125 setMcal (catalog, i,FALSE, flatcorr);126 setMmos (catalog, i,FALSE, flatcorr);127 setMgrp (catalog, i,FALSE, flatcorr);126 setMcal (catalog, FALSE, flatcorr); 127 setMmos (catalog, FALSE, flatcorr); 128 setMgrp (catalog, FALSE, flatcorr); 128 129 dump_tgroups (catalog, i + 40); 129 130 dump_catalog (catalog, 0, i + 40); // for a test, just dump a specific catalog … … 143 144 global_stats (catalog, Ncatalog, flatcorr, i); 144 145 145 SetZeroPointModes ( i);146 SetZeroPointModes (); 146 147 MARKTIME("-- finished loop %d: %f sec\n", i, dtime); 147 148 fprintf (stderr, "----- continue loop %d -----\n", i); … … 162 163 int onlyPoorImages = !CALIBRATE_STACKS_AND_WARPS; 163 164 onlyPoorImages = FALSE; // XXX deactivate for now 164 setMcal (catalog, 999,onlyPoorImages, flatcorr); // max loop since this is a final pass165 setMmos (catalog, 999,onlyPoorImages, flatcorr); // max loop since this is a final pass166 setMgrp (catalog, 999,onlyPoorImages, flatcorr); // max loop since this is a final pass165 setMcal (catalog, onlyPoorImages, flatcorr); // max loop since this is a final pass 166 setMmos (catalog, onlyPoorImages, flatcorr); // max loop since this is a final pass 167 setMgrp (catalog, onlyPoorImages, flatcorr); // max loop since this is a final pass 167 168 MARKTIME("-- finalize Mcal values: %f sec\n", dtime); 168 169 -
trunk/Ohana/src/relphot/src/relphot_parallel_images.c
r41462 r41473 95 95 } 96 96 97 // XXX : add this in the loop at various points98 // if (PLOTSTUFF) plot_scatter (catalog, Ncatalog, flatcorr);99 100 97 /* determine fit values */ 101 98 client_logger_message ("starting the loops : %d \n", NLOOP); 102 99 for (i = 0; i < NLOOP; i++) { 100 SetZptIteration (i); 103 101 104 102 // set the mean stellar mags given the measurements and the image calibrations … … 114 112 115 113 // set the image (Mcal) and mosaic (Mmos) zero point offsets given the mean mags and measurements 116 setMcal (catalog, i,FALSE, flatcorr);117 setMmos (catalog, i,FALSE, flatcorr);114 setMcal (catalog, FALSE, flatcorr); 115 setMmos (catalog, FALSE, flatcorr); 118 116 // setMgrp (catalog, FALSE, flatcorr); XXX think this through: this may not make sense for tgroups 119 117 MARKTIME("-- set Mrel, Mcal, Mmos, Mgrid : %f sec\n", dtime); … … 126 124 client_logger_message ("slurped image data : loop %d \n", i); 127 125 128 if ((i > 8) && (i % 8 == 2)) clean_measures (catalog, Ncatalog, FALSE, flatcorr); 129 if ((i > 8) && (i % 8 == 3)) clean_stars (catalog, Ncatalog); 130 if ((i > 8) && (i % 8 == 5)) clean_mosaics (); 131 if ((i > 8) && (i % 8 == 5)) clean_images (); 126 global_stats (catalog, Ncatalog, flatcorr, i); 132 127 133 global_stats (catalog, Ncatalog, flatcorr, i);128 SetZeroPointModes (); 134 129 MARKTIME("-- finished loop %d: %f sec\n", i, dtime); 135 130 } … … 151 146 /* set Mcal & Mmos for bad images (for stack_and_warps, force images to be measured) */ 152 147 int onlyPoorImages = !CALIBRATE_STACKS_AND_WARPS; 153 setMcal (catalog, 999,onlyPoorImages, flatcorr);154 setMmos (catalog, 999,onlyPoorImages, flatcorr);148 setMcal (catalog, onlyPoorImages, flatcorr); 149 setMmos (catalog, onlyPoorImages, flatcorr); 155 150 // setMgrp (catalog, onlyPoorImages, flatcorr); XXX see above 156 151 MARKTIME("-- finalize Mcal values: %f sec\n", dtime); -
trunk/Ohana/src/relphot/src/setMrelCatalog.c
r41462 r41473 19 19 20 20 // # define MAG_STATS_BY_RANKING magStatsByRankingIRLS 21 # define MAG_STATS_BY_RANKING magStatsByRanking21 // # define MAG_STATS_BY_RANKING magStatsByRanking 22 22 23 23 # define UBERCAL_WEIGHT 100.0 … … 60 60 FILE *TESTFILE = NULL; 61 61 62 int useOLS = TRUE; // chosen based on iteration below 63 62 64 int setMrel_catalog_alt (Catalog *catalog, int Nc, int isSetMrelFinal, FlatCorrectionTable *flatcorr, SetMrelInfo *results, int Nsecfilt) { 63 65 … … 73 75 TESTFILE = fopen ("mytest.dat", "w"); 74 76 77 useOLS = UseStandardOLS (ZPT_STARS); 75 78 for (j = 0; j < catalog[Nc].Naverage; j++) { 76 79 … … 258 261 if (isUbercal) results->haveUbercal[Nsec] = TRUE; // haveUbercal is set per secfilt, isUbercal is per measure XXX define this array 259 262 260 int useUbercalWeight = isUbercal || (refPhotcode && (code->code == refPhotcode->code)); 263 // logic for choosing a modified weight: 264 float modifiedWeight = 1.0; 265 if (isUbercal) modifiedWeight = UBERCAL_WEIGHT; 266 if (refPhotcode && (code->code == refPhotcode->code)) modifiedWeight = UBERCAL_WEIGHT; 267 if (USE_REFERENCE_WEIGHT && (code->type == PHOT_REF)) modifiedWeight = code->photomErrSys; // we are overloading this field for now 261 268 262 269 // combine the various errors in quadrature here: … … 277 284 results->aperData[Nsec].flxlist[Nap] = Map - Mflat - Mcal - Mmos - Mgrp - Mgrid; // this is consistent with PhotRel 278 285 results->aperData[Nsec].errlist[Nap] = dMap; 279 results->aperData[Nsec].wgtlist[Nap] = useUbercalWeight ? UBERCAL_WEIGHT : 1.0;286 results->aperData[Nsec].wgtlist[Nap] = modifiedWeight; 280 287 results->aperData[Nsec].ranking[Nap] = measureRank[k]; 281 288 results->aperData[Nsec].measSeq[Nap] = k; … … 297 304 results->kronData[Nsec].flxlist[Nkron] = Mkron - Mflat - Mcal - Mmos - Mgrp - Mgrid; // this is consistent with PhotRel 298 305 results->kronData[Nsec].errlist[Nkron] = dMkron; 299 results->kronData[Nsec].wgtlist[Nkron] = isUbercal ? UBERCAL_WEIGHT : 1.0;306 results->kronData[Nsec].wgtlist[Nkron] = modifiedWeight; 300 307 results->kronData[Nsec].ranking[Nkron] = measureRank ? measureRank[k] : 0; 301 308 results->kronData[Nsec].measSeq[Nkron] = k; … … 310 317 results->psfData[Nsec].flxlist[Npsf] = Mpsf - Mflat - Mcal - Mmos - Mgrp - Mgrid; // this is consistent with PhotRel 311 318 results->psfData[Nsec].errlist[Npsf] = dMpsf; 312 results->psfData[Nsec].wgtlist[Npsf] = isUbercal ? UBERCAL_WEIGHT : 1.0;319 results->psfData[Nsec].wgtlist[Npsf] = modifiedWeight; 313 320 results->psfData[Nsec].ranking[Npsf] = measureRank ? measureRank[k] : 0; 314 321 results->psfData[Nsec].measSeq[Npsf] = k; … … 406 413 // if too few valid measurements meet the minimum criteria, go to the next entry 407 414 StatType *psfstats = &results->psfstats; 408 int NrankingPSF = MAG_STATS_BY_RANKING (&results->psfData[Nsec], psfstats); 415 416 int NrankingPSF = useOLS ? magStatsByRanking (&results->psfData[Nsec], psfstats) : magStatsByRankingIRLS (&results->psfData[Nsec], psfstats); 409 417 if (NrankingPSF < Nminmeas) { 410 418 secfilt[Nsec].flags |= ID_OBJ_FEW; … … 422 430 423 431 StatType *kronstats = &results->kronstats; 424 int NrankingKRON = MAG_STATS_BY_RANKING(&results->kronData[Nsec], kronstats);432 int NrankingKRON = useOLS ? magStatsByRanking (&results->kronData[Nsec], kronstats) : magStatsByRankingIRLS (&results->kronData[Nsec], kronstats); 425 433 if (NrankingKRON) { 426 434 secfilt[Nsec].MkronChp = kronstats->mean; … … 455 463 456 464 StatType *apstats = &results->apstats; 457 int NrankingAPER = MAG_STATS_BY_RANKING(&results->aperData[Nsec], apstats);465 int NrankingAPER = useOLS ? magStatsByRanking (&results->aperData[Nsec], apstats) : magStatsByRankingIRLS (&results->aperData[Nsec], apstats); 458 466 if (NrankingAPER) { 459 467 secfilt[Nsec].MapChp = apstats->mean; … … 1032 1040 // if too few valid measurements meet the minimum criteria, go to the next entry 1033 1041 StatType *psfstats = &results->psfstats; 1034 Nranking = MAG_STATS_BY_RANKING (&results->psfData[Nsec], psfstats); 1042 // Nranking = MAG_STATS_BY_RANKING (&results->psfData[Nsec], psfstats); 1043 Nranking = useOLS ? magStatsByRanking (&results->psfData[Nsec], psfstats) : magStatsByRankingIRLS (&results->psfData[Nsec], psfstats); 1035 1044 if (Nranking) { 1036 1045 secfilt[Nsec].FpsfWrp = psfstats->mean; … … 1045 1054 // if too few valid measurements meet the minimum criteria, go to the next entry 1046 1055 StatType *apstats = &results->apstats; 1047 Nranking = MAG_STATS_BY_RANKING (&results->aperData[Nsec], apstats); 1056 // Nranking = MAG_STATS_BY_RANKING (&results->aperData[Nsec], apstats); 1057 Nranking = useOLS ? magStatsByRanking (&results->aperData[Nsec], apstats) : magStatsByRankingIRLS (&results->aperData[Nsec], apstats); 1048 1058 if (Nranking) { 1049 1059 secfilt[Nsec].FapWrp = apstats->mean; … … 1058 1068 // if too few valid measurements meet the minimum criteria, go to the next entry 1059 1069 StatType *kronstats = &results->kronstats; 1060 Nranking = MAG_STATS_BY_RANKING (&results->kronData[Nsec], kronstats); 1070 // Nranking = MAG_STATS_BY_RANKING (&results->kronData[Nsec], kronstats); 1071 Nranking = useOLS ? magStatsByRanking (&results->kronData[Nsec], kronstats) : magStatsByRankingIRLS (&results->kronData[Nsec], kronstats); 1061 1072 if (Nranking) { 1062 1073 secfilt[Nsec].FkronWrp = kronstats->mean;
Note:
See TracChangeset
for help on using the changeset viewer.
