- Timestamp:
- Jan 12, 2021, 4:13:42 PM (6 years ago)
- Location:
- trunk/Ohana/src/relphot
- Files:
-
- 8 edited
-
include/relphot.h (modified) (3 diffs)
-
src/ImageOps.c (modified) (3 diffs)
-
src/MosaicOps.c (modified) (7 diffs)
-
src/TGroupOps.c (modified) (2 diffs)
-
src/ZeroPointModes.c (modified) (5 diffs)
-
src/extra.c (modified) (2 diffs)
-
src/relphot_images.c (modified) (1 diff)
-
test/relphot.tgroups.dvo (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relphot/include/relphot.h
r41462 r41467 28 28 int NINDEX; 29 29 } myIndexType; 30 31 typedef enum { 32 ZPT_TGROUP, 33 ZPT_MOSAIC, 34 ZPT_IMAGES, 35 } ZptFitModeType; 30 36 31 37 typedef enum { … … 791 797 void relphot_free (SkyTable *sky, SkyList *skylist); 792 798 void freeImages (char *dbImagePtr); 799 void freeMosaics (void); 793 800 void relphot_client_free (SkyTable *sky, SkyList *skylist); 794 801 void BrightCatalogFree (BrightCatalog *bcatalog); … … 828 835 829 836 void SetZeroPointModes (int nloop); 837 int UseStandardOLS (int nloop, ZptFitModeType mode); -
trunk/Ohana/src/relphot/src/ImageOps.c
r41462 r41467 610 610 611 611 // until the analysis has converged a bit, do not use the IRLS analysis 612 if (Nloop < 3) { 612 // default is MaxIterations = 10 613 if (UseStandardOLS(Nloop, ZPT_IMAGES)) { 613 614 brightStars.MaxIterations = 0; 614 615 kronStars.MaxIterations = 0; 615 616 psfStars.MaxIterations = 0; 616 617 } 617 618 618 619 619 Nfew = Nbad = Nmos = Ngrp = Ngrid = Nrel = Nsys = 0; … … 635 635 } 636 636 637 // if requested, freeze mosaic chips:638 if (FREEZE_IMAGES && isMosaicChip (image[i].photcode)) continue;639 637 if (image[i].photcode == 0) continue; // skip the PHU images 640 638 641 639 int badNight = (image[i].flags & ID_IMAGE_NIGHT_POOR); 642 640 int badMosaic = (image[i].flags & ID_IMAGE_MOSAIC_POOR); 641 int isMosaic = isMosaicChip(image[i].photcode); 642 643 // if requested, freeze mosaic chips: 644 if (FREEZE_IMAGES && isMosaic) continue; 643 645 644 646 // in BAD_NIGHT mode, we fit ONLY images in bad nights … … 650 652 if ((IMAGE_ZPT_MODE == IMAGE_ZPT_MODE_BAD_NIGHT_BAD_MOSAIC)) { 651 653 if (!badNight) continue; 652 if (!badMosaic ) continue;654 if (!badMosaic && isMosaic) continue; // skip good mosaics (but not good images) 653 655 } 654 656 655 657 // in BAD_MOSAIC mode, we fit bad mosaics ignoring night state 656 658 if ((IMAGE_ZPT_MODE == IMAGE_ZPT_MODE_BAD_MOSAIC)) { 657 if (badMosaic ) continue;659 if (badMosaic && isMosaic) continue; // skip bad mosaics (but not bad images) 658 660 } 659 661 -
trunk/Ohana/src/relphot/src/MosaicOps.c
r41462 r41467 321 321 fprintf (stderr, "matched %d images to %d mosaics, %d simple chips not matched to mosaics\n", (int) (Nsubset - Nsimple), (int) Nmosaic, (int) Nsimple); 322 322 return; 323 }324 325 void freeMosaics () {326 327 328 323 } 329 324 … … 845 840 } 846 841 842 void freeMosaics () { 843 844 if (!MOSAIC_ZEROPT) return; 845 846 for (int i = 0; i < Nmosaic; i++) { 847 FREE (MosaicToImage[i]); 848 } 849 850 FREE (mosaic); 851 FREE (MosaicToImage); 852 FREE (MosaicN_Image); 853 FREE (ImageToMosaic); // mosaic to which image belongs 854 } 855 847 856 int findMosaics (Catalog *catalog, int Ncatalog, int doMosaicList) { 848 857 … … 1007 1016 1008 1017 // until the analysis has converged a bit, do not use the IRLS analysis 1009 if ( Nloop < 3) {1018 if (UseStandardOLS(Nloop, ZPT_MOSAIC)) { 1010 1019 info->brightStars.MaxIterations = 0; 1011 1020 info->kronStars.MaxIterations = 0; … … 1133 1142 int badNight = (myMosaic[0].flags & ID_IMAGE_NIGHT_POOR); 1134 1143 int badMosaic = (myMosaic[0].flags & ID_IMAGE_MOSAIC_POOR); 1144 1145 myMosaic->flags &= ~ID_IMAGE_MOSAIC_PHOTCAL; // unset this flag 1135 1146 1136 1147 // if we are fitting TGroup zero points, when we identify the bad TGroups, we proceed … … 1356 1367 } 1357 1368 1369 myMosaic->flags |= ID_IMAGE_MOSAIC_PHOTCAL; // set this flag 1370 1358 1371 if (testImage) { 1359 1372 fprintf (stderr, "%f %f : %f\n", myMosaic[0].McalPSF, myMosaic[0].dMsys, myMosaic[0].McalChiSq); … … 1371 1384 } 1372 1385 1386 fprintf (stderr, "MOSAIC time %.6f photcode %d Mcal: %f, dMcal: %f, chisq: %f, %d of %d\n", 1387 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); 1388 1373 1389 return TRUE; 1374 1390 } … … 1862 1878 1863 1879 for (i = N = 0; i < Nmosaic; i++) { 1864 if (mosaic[i].flags & IMAGE_BAD) continue; 1880 // if (mosaic[i].flags & IMAGE_BAD) continue; 1881 if (!(mosaic[i].flags & ID_IMAGE_MOSAIC_PHOTCAL)) continue; 1865 1882 if (mosaic[i].skipCal) continue; 1866 1883 mlist[N] = mosaic[i].McalPSF; -
trunk/Ohana/src/relphot/src/TGroupOps.c
r41462 r41467 324 324 Mosaic *mosaic = getMosaicForImage (imageIdx); 325 325 326 if (!mosaic) continue; // this is a simple chip, not part of a mosaic 326 327 if (mosaic->inTGroup) continue; 327 328 … … 687 688 688 689 // until the analysis has converged a bit, do not use the IRLS analysis 689 if ( Nloop < 100) {690 if (UseStandardOLS(Nloop, ZPT_TGROUP)) { 690 691 info->brightStars.MaxIterations = 0; 691 692 info->kronStars.MaxIterations = 0; -
trunk/Ohana/src/relphot/src/ZeroPointModes.c
r41462 r41467 13 13 clean_tgroups(); // do this on every pass to update the status of nights 14 14 } 15 if ((nloop > 8) && (nloop <= 12)) {15 if ((nloop > 8) && (nloop <= 999)) { 16 16 // after iterating a few times on the TGroup & Mosaic zero points: 17 17 // * identify the good / bad Mosaics … … 26 26 27 27 if (TGROUP_ZEROPT && !MOSAIC_ZEROPT) { 28 if ((nloop > 4) && (nloop <= 8)) {28 if ((nloop > 4) && (nloop <= 999)) { 29 29 // after iterating a few times on the TGroup zero points: 30 30 // * identify the photometric nights … … 38 38 39 39 if (!TGROUP_ZEROPT && MOSAIC_ZEROPT) { 40 if ((nloop > 4) && (nloop <= 8)) {40 if ((nloop > 4) && (nloop <= 999)) { 41 41 // after iterating a few times on the Mosaic zero points: 42 42 // * identify the good / bad mosaics … … 50 50 51 51 if (!TGROUP_ZEROPT && !MOSAIC_ZEROPT) { 52 if ((nloop > 4) && (nloop <= 8)) {52 if ((nloop > 4) && (nloop <= 999)) { 53 53 // after iterating a few times on the Image zero points: 54 54 // * ??? … … 60 60 } 61 61 62 // if (i < NLOOP - 1) rationalize_mosaics (catalog, Ncatalog); 63 // if (i % 6 == 1) rationalize_images (); 62 // 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) { 64 65 65 // NOTE : in the past, I was not iterating enough before cleaning. make sure we do 66 // at least 8 loops first -- that should get the systematic errors down to the ~1% 67 // level, even in cases where we have an even split between photometric data and 68 // data with 1 mag of extinction. 66 if (TGROUP_ZEROPT && MOSAIC_ZEROPT) { 67 switch (mode) { 68 case ZPT_TGROUP: 69 if (nloop < 3) return TRUE; 70 return FALSE; 71 case ZPT_MOSAIC: 72 if (nloop < 7) return TRUE; 73 return FALSE; 74 case ZPT_IMAGES: 75 default: 76 if (nloop < 11) return TRUE; 77 return FALSE; 78 } 79 } 69 80 70 // if ((i > 8) && (i % 8 == 2)) clean_measures (catalog, Ncatalog, FALSE, flatcorr); 71 // if ((i > 8) && (i % 8 == 3)) clean_stars (catalog, Ncatalog); 72 // if ((i > 8) && (i % 8 == 5)) clean_mosaics (); 73 // if ((i > 8) && (i % 8 == 5)) clean_tgroups (); 74 // if ((i > 8) && (i % 8 == 5)) clean_images (); 81 if (TGROUP_ZEROPT && !MOSAIC_ZEROPT) { 82 switch (mode) { 83 case ZPT_TGROUP: 84 case ZPT_MOSAIC: 85 if (nloop < 3) return TRUE; 86 return FALSE; 87 case ZPT_IMAGES: 88 default: 89 if (nloop < 7) return TRUE; 90 return FALSE; 91 } 92 } 75 93 94 if (!TGROUP_ZEROPT && MOSAIC_ZEROPT) { 95 switch (mode) { 96 case ZPT_TGROUP: 97 case ZPT_MOSAIC: 98 if (nloop < 3) return TRUE; 99 return FALSE; 100 case ZPT_IMAGES: 101 default: 102 if (nloop < 7) return TRUE; 103 return FALSE; 104 } 105 } 106 107 if (!TGROUP_ZEROPT && !MOSAIC_ZEROPT) { 108 switch (mode) { 109 case ZPT_TGROUP: 110 case ZPT_MOSAIC: 111 case ZPT_IMAGES: 112 default: 113 if (nloop < 3) return TRUE; 114 return FALSE; 115 } 116 } 117 return FALSE; 118 } -
trunk/Ohana/src/relphot/src/extra.c
r41462 r41467 14 14 int whichGPC1filter (int photcode) { 15 15 16 if (((photcode > 10000) && (photcode < 10077)) || (photcode == 4100)) return PS1_g; // g-band 17 if (((photcode > 10100) && (photcode < 10177)) || (photcode == 4200)) return PS1_r; // r-band 18 if (((photcode > 10200) && (photcode < 10277)) || (photcode == 4300)) return PS1_i; // i-band 19 if (((photcode > 10300) && (photcode < 10377)) || (photcode == 4400)) return PS1_z; // z-band 20 if (((photcode > 10400) && (photcode < 10477)) || (photcode == 4500)) return PS1_y; // y-band 21 if (((photcode > 10500) && (photcode < 10577)) || (photcode == 4600)) return PS1_w; // w-band 22 16 # if (1) 17 // disable the corner chips: 18 if (((photcode > 10000) && (photcode < 10077)) || (photcode == 4100)) return PS1_g; // g-band 19 if (((photcode > 10100) && (photcode < 10177)) || (photcode == 4200)) return PS1_r; // r-band 20 if (((photcode > 10200) && (photcode < 10277)) || (photcode == 4300)) return PS1_i; // i-band 21 if (((photcode > 10300) && (photcode < 10377)) || (photcode == 4400)) return PS1_z; // z-band 22 if (((photcode > 10400) && (photcode < 10477)) || (photcode == 4500)) return PS1_y; // y-band 23 if (((photcode > 10500) && (photcode < 10577)) || (photcode == 4600)) return PS1_w; // w-band 24 # else 25 // for testing, enable the corner chips: 26 if (((photcode >= 10000) && (photcode <= 10077)) || (photcode == 4100)) return PS1_g; // g-band 27 if (((photcode >= 10100) && (photcode <= 10177)) || (photcode == 4200)) return PS1_r; // r-band 28 if (((photcode >= 10200) && (photcode <= 10277)) || (photcode == 4300)) return PS1_i; // i-band 29 if (((photcode >= 10300) && (photcode <= 10377)) || (photcode == 4400)) return PS1_z; // z-band 30 if (((photcode >= 10400) && (photcode <= 10477)) || (photcode == 4500)) return PS1_y; // y-band 31 if (((photcode >= 10500) && (photcode <= 10577)) || (photcode == 4600)) return PS1_w; // w-band 32 # endif 23 33 return PS1_none; 24 34 } … … 27 37 int isGPC1chip (int photcode) { 28 38 29 if (((photcode > 10000) && (photcode < 10077)) || (photcode == 4100)) return TRUE; // g-band 30 if (((photcode > 10100) && (photcode < 10177)) || (photcode == 4200)) return TRUE; // r-band 31 if (((photcode > 10200) && (photcode < 10277)) || (photcode == 4300)) return TRUE; // i-band 32 if (((photcode > 10300) && (photcode < 10377)) || (photcode == 4400)) return TRUE; // z-band 33 if (((photcode > 10400) && (photcode < 10477)) || (photcode == 4500)) return TRUE; // y-band 34 if (((photcode > 10500) && (photcode < 10577)) || (photcode == 4600)) return TRUE; // w-band 39 # if (1) 40 if (((photcode > 10000) && (photcode < 10077)) || (photcode == 4100)) return TRUE; // g-band 41 if (((photcode > 10100) && (photcode < 10177)) || (photcode == 4200)) return TRUE; // r-band 42 if (((photcode > 10200) && (photcode < 10277)) || (photcode == 4300)) return TRUE; // i-band 43 if (((photcode > 10300) && (photcode < 10377)) || (photcode == 4400)) return TRUE; // z-band 44 if (((photcode > 10400) && (photcode < 10477)) || (photcode == 4500)) return TRUE; // y-band 45 if (((photcode > 10500) && (photcode < 10577)) || (photcode == 4600)) return TRUE; // w-band 46 # else 47 if (((photcode >= 10000) && (photcode <= 10077)) || (photcode == 4100)) return TRUE; // g-band 48 if (((photcode >= 10100) && (photcode <= 10177)) || (photcode == 4200)) return TRUE; // r-band 49 if (((photcode >= 10200) && (photcode <= 10277)) || (photcode == 4300)) return TRUE; // i-band 50 if (((photcode >= 10300) && (photcode <= 10377)) || (photcode == 4400)) return TRUE; // z-band 51 if (((photcode >= 10400) && (photcode <= 10477)) || (photcode == 4500)) return TRUE; // y-band 52 if (((photcode >= 10500) && (photcode <= 10577)) || (photcode == 4600)) return TRUE; // w-band 53 # endif 35 54 36 55 return FALSE; -
trunk/Ohana/src/relphot/src/relphot_images.c
r41462 r41467 279 279 280 280 freeImages (db.ftable.buffer); 281 freeMosaics (); 281 282 gfits_db_free (&db); 282 283 -
trunk/Ohana/src/relphot/test/relphot.tgroups.dvo
r41462 r41467 484 484 end 485 485 end 486 487 macro plot.tcat.data 488 if ($0 != 2) 489 echo "USAGE: plot.tcat.data (Nlast)" 490 break 491 end 492 493 $BSTYLE = -tickpad 0.2 +xpad 0.2 +ypad 0.2 -ypad 5 494 495 for i 0 $1 496 sprintf name tcat.%02d.dat $i 497 data $name 498 dev -n $i 499 resize 900 500 500 clear; 501 box $BSTYLE 502 read Msys 4 Mrel 5 Mcal 7 Mmos 8 Mgrp 9 airmass 11 dMag 12; 503 lim Msys dMag; plot Msys dMag -pt cir -op 0.2 -c blue 504 echo $name 505 end 506 end
Note:
See TracChangeset
for help on using the changeset viewer.
