- Timestamp:
- Apr 28, 2021, 6:02:02 PM (5 years ago)
- Location:
- trunk/Ohana/src/relphot/src
- Files:
-
- 2 edited
-
MosaicOps.c (modified) (7 diffs)
-
TGroupOps.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relphot/src/MosaicOps.c
r41557 r41559 772 772 // this mosaic has been identified as poor. 773 773 mosaic[myMosaic].flags |= ID_IMAGE_MOSAIC_POOR; 774 mosaic[myMosaic].McalPSF = 0.0;775 mosaic[myMosaic].McalAPER = 0.0;776 774 777 775 image = getimages (&Nimage, NULL); 778 776 779 777 // all images should be marked as coming from a bad mosaic 780 // these will be fitted independently 778 // these will be fitted independently. Make the starting solution consistent by 779 // setting the image McalPSF for the current best fit from the mosaic 780 781 781 for (off_t i = 0; i < MosaicN_Image[myMosaic]; i++) { 782 782 off_t im = MosaicToImage[myMosaic][i]; 783 783 image[im].flags |= ID_IMAGE_MOSAIC_POOR; 784 } 784 image[im].McalPSF = mosaic[myMosaic].McalPSF; 785 image[im].McalAPER = mosaic[myMosaic].McalAPER; 786 } 787 788 mosaic[myMosaic].McalPSF = 0.0; 789 mosaic[myMosaic].McalAPER = 0.0; 785 790 } 786 791 … … 1359 1364 } 1360 1365 1361 fprintf (stderr, "MOSAIC time %.6f photcode %d Mcal: %f, dMcal: %f, chisq: %f, %d of %d \n",1362 ohana_sec_to_mjd(myMosaic[0].start), myMosaic[0].photcode, myMosaic[0].McalPSF, myMosaic[0].dMcal, myMosaic[0].McalChiSq, myMosaic[0].nFitPhotom, myMosaic[0].nValPhotom);1366 fprintf (stderr, "MOSAIC time %.6f photcode %d Mcal: %f, dMcal: %f, chisq: %f, %d of %d, useMmos: %d\n", 1367 ohana_sec_to_mjd(myMosaic[0].start), myMosaic[0].photcode, psfStars->bSaveArray[0][0], myMosaic[0].dMcal, myMosaic[0].McalChiSq, myMosaic[0].nFitPhotom, myMosaic[0].nValPhotom, useMmos); 1363 1368 1364 1369 return TRUE; … … 1860 1865 1861 1866 /* mark mosaic if: abs(Mcal - <Mcal>) too large, dMcal too large */ 1867 1868 static float MinMaxChiSq = NAN; 1869 static float MinMaxScatter = NAN; 1870 1862 1871 void clean_mosaics () { 1863 1872 … … 1871 1880 ALLOCATE (mlist, double, Nmosaic); 1872 1881 ALLOCATE (slist, double, Nmosaic); 1882 1883 // Measure the good/bad statistics using mosaics which are actually calibrated. 1884 // But they could be applied to all mosaics below (allowing bad mosaics to become good) 1885 // However, for now, we will NOT allow mosaics to be redeemed (bad -> good) 1873 1886 1874 1887 int N = 0; … … 1885 1898 1886 1899 liststats (mlist, NULL, NULL, N, &stats); 1887 float MaxChiSq = stats.Upper90; 1900 float ChiSqUpper90 = stats.Upper90; 1901 if (isnan (MinMaxChiSq)) MinMaxChiSq = 2.0*stats.median; 1902 float MaxChiSq = MAX (MinMaxChiSq, ChiSqUpper90); 1888 1903 1889 1904 liststats (slist, NULL, NULL, N, &stats); 1890 float MaxScatter = stats.Upper90; 1891 1892 fprintf (stderr, "MOSAIC: Max ChiSq: %f, Max Scatter: %f\n", MaxChiSq, MaxScatter); 1905 float ScatterUpper90 = stats.Upper90; 1906 if (isnan (MinMaxScatter)) MinMaxScatter = 2.0*stats.median; 1907 float MaxScatter = MAX (MinMaxScatter, ScatterUpper90); 1908 1909 fprintf (stderr, "MOSAIC: Max ChiSq: %f, Max Scatter: %f | ChiSquare Upper 90: %f, Scatter Upper 90: %f\n", MaxChiSq, MaxScatter, ChiSqUpper90, ScatterUpper90); 1893 1910 1894 int Ntotal = 0, N mark = 0, Nscatter = 0, Nfew = 0, Nchisq = 0;1911 int Ntotal = 0, Npoor = 0, Nmark = 0, Nscatter = 0, Nfew = 0, Nchisq = 0; 1895 1912 for (int i = 0; i < Nmosaic; i++) { 1896 1913 // if we are keeping ubercal sacrosanct, then we should not be allowed to break them... … … 1902 1919 1903 1920 int mark = FALSE; 1921 1922 // we do not allow bad nights to be redeemed 1923 if (mosaic[i].flags & ID_IMAGE_MOSAIC_POOR) { 1924 Npoor ++; 1925 continue; 1926 } 1904 1927 1905 1928 if (mosaic[i].flags & ID_IMAGE_PHOTOM_FEW) { … … 1923 1946 } 1924 1947 1925 fprintf (stderr, "%d of %d mosaics marked poor (%d scatter, %d chisq, %d few)\n", Nmark, Ntotal, Nscatter, Nchisq, Nfew);1948 fprintf (stderr, "%d + %d of %d mosaics marked poor (%d scatter, %d chisq, %d few)\n", Nmark, Npoor, Ntotal, Nscatter, Nchisq, Nfew); 1926 1949 1927 1950 free (mlist); -
trunk/Ohana/src/relphot/src/TGroupOps.c
r41557 r41559 453 453 // this tgroup has been identified as poor. 454 454 tgroup->flags |= ID_IMAGE_NIGHT_POOR; 455 tgroup->McalPSF = 0.0;456 tgroup->McalAPER = 0.0;457 tgroup->dKlam = 0.0;458 455 459 456 // all associated mosaics should be marked as coming from a bad night 460 // these will be fitted independently 457 // these will be fitted independently. Make the starting solution consistent by 458 // setting the mosaic McalPSF for the current best fit from the tgroup 459 461 460 for (off_t j = 0; j < tgroup->Nmosaic; j++) { 462 tgroup->mosaic[j]->flags |= ID_IMAGE_NIGHT_POOR; 461 Mosaic *mos = tgroup->mosaic[j]; 462 mos->flags |= ID_IMAGE_NIGHT_POOR; 463 mos->McalPSF = (TGROUP_FIT_AIRMASS) ? tgroup->McalPSF + tgroup->dKlam*(mos->secz - 1.0) : tgroup->McalPSF; 464 mos->McalAPER = (TGROUP_FIT_AIRMASS) ? tgroup->McalAPER + tgroup->dKlam*(mos->secz - 1.0) : tgroup->McalAPER; 463 465 } 464 466 … … 470 472 image[im].flags |= ID_IMAGE_NIGHT_POOR; 471 473 } 472 } 473 474 475 // reset the tgroup to have no impact on the solution 476 tgroup->McalPSF = 0.0; 477 tgroup->McalAPER = 0.0; 478 tgroup->dKlam = 0.0; 479 } 480 481 // for now, we do not allow a night to be redeemed, so this 482 // operation should have no impact. 474 483 void markGoodTGroup (TGroup *tgroup) { 475 484 … … 793 802 // for testing, supply the MJD of a night or nights here to dump the full list of measurements 794 803 int testImage = FALSE; 795 // testImage |= (abs(mjdStart - 57353) < 0.1); 804 testImage |= (abs(mjdStart - 58064) < 0.1); 805 testImage |= (abs(mjdStart - 58082) < 0.1); 806 testImage |= (abs(mjdStart - 58770) < 0.1); 807 testImage |= (abs(mjdStart - 55843) < 0.1); 808 testImage |= (abs(mjdStart - 56967) < 0.1); 809 testImage |= (abs(mjdStart - 57329) < 0.1); 810 testImage |= (abs(mjdStart - 56614) < 0.1); 796 811 797 812 FILE *fout = NULL; … … 930 945 double altSigma = (stats.Upper80 - stats.Lower20) / 1.6; 931 946 932 TGTimes *mygroup = (TGTimes *) myTGroup->parent;933 fprintf (stderr, "TGroup Stats %f,%d : %d %d %6.3f %6.3f\n", ohana_sec_to_mjd(mygroup->start), myTGroup->photcode, (int) N, (int) myTGroup->Nmeasure, stats.median, altSigma);934 935 947 // do anything special with identified good nights? 936 948 // (myTGroup->flags & ID_IMAGE_PHOTOM_UBERCAL) … … 961 973 // bright end scatter (systematic error) 962 974 myTGroup->dMsys = brightStars->sigma; 975 976 TGTimes *mygroup = (TGTimes *) myTGroup->parent; 977 fprintf (stderr, "TGroup Stats %f,%d : %d %d %6.3f %6.3f %6.3f %d\n", ohana_sec_to_mjd(mygroup->start), myTGroup->photcode, (int) N, (int) myTGroup->Nmeasure, psfStars->bSaveArray[0][0], stats.median, altSigma, useMgrp); 963 978 964 979 if (testImage) { … … 1242 1257 */ 1243 1258 1259 static float MinMaxChiSq = NAN; 1260 static float MinMaxScatter = NAN; 1261 1244 1262 void clean_tgroups () { 1245 1263 … … 1254 1272 1255 1273 // measure the good/bad statistics using nights which are actually calibrated 1256 // but they will be applied to all nights below (allowing bad nights to become good) 1274 // But they could be applied to all nights below (allowing bad nights to become good) 1275 // However, for now, we will NOT allow nights to be redeemed (bad -> good) 1257 1276 int N = 0; 1258 1277 for (int i = 0; i < NtgroupTimes; i++) { … … 1270 1289 1271 1290 liststats (mlist, NULL, NULL, N, &stats); 1272 float MaxChiSq = stats.Upper90; 1291 float ChiSqUpper90 = stats.Upper90; 1292 if (isnan (MinMaxChiSq)) MinMaxChiSq = 2.0*stats.median; 1293 float MaxChiSq = MAX (MinMaxChiSq, ChiSqUpper90); 1273 1294 1274 1295 liststats (slist, NULL, NULL, N, &stats); 1275 float MaxScatter = stats.Upper90; 1276 1277 fprintf (stderr, "TGROUPS: Max ChiSq: %f, Max Scatter: %f\n", MaxChiSq, MaxScatter); 1296 float ScatterUpper90 = stats.Upper90; 1297 if (isnan (MinMaxScatter)) MinMaxScatter = 2.0*stats.median; 1298 float MaxScatter = MAX (MinMaxScatter, ScatterUpper90); 1299 1300 fprintf (stderr, "TGROUPS: Max ChiSq: %f, Max Scatter: %f | ChiSquare Upper 90: %f, Scatter Upper 90: %f\n", MaxChiSq, MaxScatter, ChiSqUpper90, ScatterUpper90); 1278 1301 1279 int Ntotal = 0, N mark = 0, Nscatter = 0, Nchisq = 0, NfewNights = 0, NfewExp = 0;1302 int Ntotal = 0, Npoor = 0, Nmark = 0, Nscatter = 0, Nchisq = 0, NfewNights = 0, NfewExp = 0; 1280 1303 for (int i = 0; i < NtgroupTimes; i++) { 1281 1304 TGroup *tgroup = tgroupTimes[i][0].byCode; … … 1285 1308 1286 1309 int mark = FALSE; 1310 1311 // we do not allow bad nights to be redeemed 1312 if (tgroup[j].flags & ID_IMAGE_NIGHT_POOR) { 1313 fprintf (stderr, "TGroup Already Poor, not redeemed %f,%d : %6.3f %6.3f %6.3f\n", ohana_sec_to_mjd(tgroupTimes[i][0].start), tgroup[j].photcode, tgroup[j].McalPSF, tgroup[j].stdev, tgroup[j].McalChiSq); 1314 Npoor ++; 1315 continue; 1316 } 1287 1317 1288 1318 // too few measurements (set in setMgrp_tgroup) … … 1309 1339 Nmark ++; 1310 1340 markBadTGroup(&tgroup[j]); // mark the tgroup & associated images & mosaics with a bad night 1341 fprintf (stderr, "TGroup Poor %f,%d : %6.3f %6.3f %6.3f\n", ohana_sec_to_mjd(tgroupTimes[i][0].start), tgroup[j].photcode, tgroup[j].McalPSF, tgroup[j].stdev, tgroup[j].McalChiSq); 1311 1342 } else { 1312 1343 markGoodTGroup(&tgroup[j]); // mark the tgroup & associated images & mosaics with a good night … … 1315 1346 } 1316 1347 1317 fprintf (stderr, "%d of %d tgroups marked poor (%d scatter, %d few nights, %d few exposures, %d chisq)\n", Nmark, Ntotal, Nscatter, NfewNights, NfewExp, Nchisq);1348 fprintf (stderr, "%d + %d of %d tgroups marked poor (%d scatter, %d few nights, %d few exposures, %d chisq)\n", Nmark, Npoor, Ntotal, Nscatter, NfewNights, NfewExp, Nchisq); 1318 1349 1319 1350 free (mlist);
Note:
See TracChangeset
for help on using the changeset viewer.
