Changeset 41606
- Timestamp:
- May 21, 2021, 2:04:53 PM (5 years ago)
- Location:
- branches/eam_branches/relphot.20210521
- Files:
-
- 18 edited
-
include/relphot.h (modified) (9 diffs)
-
src/BrightCatalog.c (modified) (4 diffs)
-
src/ImageOps.c (modified) (6 diffs)
-
src/MagResidSave.c (modified) (2 diffs)
-
src/MosaicOps.c (modified) (14 diffs)
-
src/StarOps.c (modified) (14 diffs)
-
src/TGroupOps.c (modified) (14 diffs)
-
src/global_stats.c (modified) (4 diffs)
-
src/plot_scatter.c (modified) (1 diff)
-
src/reload_catalogs.c (modified) (2 diffs)
-
src/relphot.c (modified) (1 diff)
-
src/relphot_client.c (modified) (1 diff)
-
src/relphot_images.c (modified) (7 diffs)
-
src/relphot_objects.c (modified) (1 diff)
-
src/relphot_parallel_images.c (modified) (5 diffs)
-
src/relphot_parallel_regions.c (modified) (2 diffs)
-
src/setMrelCatalog.c (modified) (6 diffs)
-
src/setMrelFinal.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/relphot.20210521/include/relphot.h
r41604 r41606 518 518 int bcatalog PROTO((Catalog *subcatalog, Catalog *catalog, int Ncat)); 519 519 void clean_images PROTO((void)); 520 void clean_measures PROTO((Catalog *catalog, int Ncatalog, int final , FlatCorrectionTable *flatcorr));520 void clean_measures PROTO((Catalog *catalog, int Ncatalog, int final)); 521 521 void clean_mosaics PROTO((void)); 522 522 void clean_tgroups PROTO((void)); … … 555 555 556 556 float getMcal PROTO((off_t meas, int cat, dvoMagClassType class)); 557 float getMflat PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr,Catalog *catalog));557 float getMflat PROTO((off_t meas, int cat, Catalog *catalog)); 558 558 float getMgridTiny PROTO((MeasureTiny *measure)); 559 559 float getMgrid PROTO((Measure *measure)); … … 566 566 Image *getimages PROTO((off_t *N, off_t **LineNumber)); 567 567 ImageSubset *getimages_subset PROTO((off_t *N)); 568 void global_stats PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr,int nloop));568 void global_stats PROTO((Catalog *catalog, int Ncatalog, int nloop)); 569 569 void initGrid PROTO(()); 570 570 void initGridBins PROTO(()); … … 621 621 void plot_mosaic_fields PROTO((Catalog *catalog)); 622 622 void plot_mosaics PROTO((void)); 623 void plot_scatter PROTO((Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr));623 void plot_scatter PROTO((Catalog *catalog, int Ncatalog)); 624 624 void plot_star_coords PROTO((Catalog *catalog, int Ncatalog)); 625 625 void plot_stars PROTO((Catalog *catalog, int Ncatalog)); … … 630 630 int open_graph PROTO((int N)); 631 631 632 void reload_catalogs PROTO((SkyList *skylist, FlatCorrectionTable *flatcorr,int hostID, char *hostpath));632 void reload_catalogs PROTO((SkyList *skylist, int hostID, char *hostpath)); 633 633 int reload_catalogs_parallel PROTO((SkyList *sky)); 634 634 int reload_images PROTO((FITS_DB *db)); … … 639 639 void setMcalFromMosaics PROTO((void)); 640 640 void setMcalFromTGroups PROTO((void)); 641 int setMcalOutput PROTO((Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr));642 643 void setMcal PROTO((Catalog *catalog , FlatCorrectionTable *flatcorr));644 int setMmos PROTO((Catalog *catalog , FlatCorrectionTable *flatcorr));645 int setMgrp PROTO((Catalog *catalog , FlatCorrectionTable *flatcorr));646 647 int setMrel PROTO((Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr));648 void setMrelFinal PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr,int simpleAverage));649 int setMrelOutput PROTO((Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr));650 651 void setMcalTest PROTO((Catalog *catalog , FlatCorrectionTable *flatcorr));641 int setMcalOutput PROTO((Catalog *catalog, int Ncatalog)); 642 643 void setMcal PROTO((Catalog *catalog)); 644 int setMmos PROTO((Catalog *catalog)); 645 int setMgrp PROTO((Catalog *catalog)); 646 647 int setMrel PROTO((Catalog *catalog, int Ncatalog)); 648 void setMrelFinal PROTO((Catalog *catalog, int simpleAverage)); 649 int setMrelOutput PROTO((Catalog *catalog, int Ncatalog)); 650 651 void setMcalTest PROTO((Catalog *catalog)); 652 652 653 653 int setMave PROTO((Catalog *catalog, int Ncatalog)); 654 654 void set_ZP PROTO((double ZERO)); 655 655 int setrefcode PROTO((Image *image, off_t Nimage)); 656 void skip_measurements PROTO((Catalog *catalog, int pass , FlatCorrectionTable *flatcorr));656 void skip_measurements PROTO((Catalog *catalog, int pass)); 657 657 void sortA PROTO((double *X, int N)); 658 658 void sortB PROTO((double *X, double *Y, int N)); … … 660 660 void sortD PROTO((double *X, double *Y, double *Z, int N)); 661 661 StatType statsImageM PROTO((Catalog *catalog)); 662 StatType statsImageN PROTO((Catalog *catalog , FlatCorrectionTable *flatcorr));662 StatType statsImageN PROTO((Catalog *catalog)); 663 663 StatType statsImageX PROTO((Catalog *catalog)); 664 664 StatType statsImagedM PROTO((Catalog *catalog)); 665 665 StatType statsMosaicM PROTO((Catalog *catalog)); 666 StatType statsMosaicN PROTO((Catalog *catalog , FlatCorrectionTable *flatcorr));666 StatType statsMosaicN PROTO((Catalog *catalog)); 667 667 StatType statsMosaicX PROTO((Catalog *catalog)); 668 668 StatType statsMosaicdM PROTO((Catalog *catalog)); … … 671 671 StatType statsTGroupdM PROTO((Catalog *catalog)); 672 672 673 StatType statsStarN PROTO((Catalog *catalog, int Ncatalog, int Nsec, int seccode , FlatCorrectionTable *flatcorr));673 StatType statsStarN PROTO((Catalog *catalog, int Ncatalog, int Nsec, int seccode)); 674 674 StatType statsStarS PROTO((Catalog *catalog, int Ncatalog, int Nsec)); 675 675 StatType statsStarX PROTO((Catalog *catalog, int Ncatalog, int Nsec)); … … 717 717 718 718 int print_measure_set_alt (Average *average, SecFilt *secfilt, Measure *measure); 719 int setMrel_catalog_alt (Catalog *catalog, int Nc, int isSetMrelFinal, FlatCorrectionTable *flatcorr,SetMrelInfo *results, int Nsecfilt);720 int setMrelAverageExposure (Catalog *catalog, int cat, off_t ave, int Nsecfilt, int isSetMrelFinal, FlatCorrectionTable *flatcorr,SetMrelInfo *results);721 int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt , FlatCorrectionTable *flatcorr);722 int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr,SetMrelInfo *results);719 int setMrel_catalog_alt (Catalog *catalog, int Nc, int isSetMrelFinal, SetMrelInfo *results, int Nsecfilt); 720 int setMrelAverageExposure (Catalog *catalog, int cat, off_t ave, int Nsecfilt, int isSetMrelFinal, SetMrelInfo *results); 721 int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt); 722 int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, SetMrelInfo *results); 723 723 724 724 int setGlobalObjStats (Average *average, Measure *measure); -
branches/eam_branches/relphot.20210521/src/BrightCatalog.c
r40291 r41606 12 12 myAssert (!strcmp(type, #TYPE), "wrong column type"); 13 13 14 // XXX double check the header extname values for each table15 // XXX make sure we free things as we can16 // XXX make sure we close files as we can17 // XXX handle free and close on error return as well18 14 BrightCatalog *BrightCatalogLoad(char *filename) { 19 15 … … 622 618 int BrightCatalogSplitFree (CatalogSplitter *catalogs) { 623 619 624 // XXX don't free the catalogs : 625 // for (i = 0; i < NCATALOG; i++) { 626 // free (catalogs->catalog[i].averageT); 627 // free (catalogs->catalog[i].measureT); 628 // free (catalogs->catalog[i].secfilt); 629 // } 630 // free (catalogs->catalog); 631 620 // don't free the catalogs : free elsewhere 632 621 free (catalogs->catIDs); 633 622 free (catalogs->NAVERAGE); … … 652 641 catIDmax = MAX(catIDmax, bcatalog->average[i].catID); 653 642 } 654 // XXX validate the measure ID range here655 643 656 644 int maxIDold = catalogs->maxID; … … 746 734 747 735 // assign the measures to the corresponding catalog 748 // XXX what about averef and related links? Do I need them?749 736 for (i = 0; i < bcatalog->Nmeasure; i++) { 750 737 int ID = bcatalog->measure[i].catID; -
branches/eam_branches/relphot.20210521/src/ImageOps.c
r41604 r41606 497 497 } 498 498 499 float getMflat (off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog) {500 OHANA_UNUSED_PARAM(flatcorr);501 502 off_t i = MeasureToImage[cat][meas];503 if (i == -1) return (NAN);504 505 float offset = catalog[cat].measureT[meas].Mflat;506 if (!isfinite(offset)) {507 offset = 0.0;508 }509 return (offset);510 }511 512 499 Coords *getCoords (off_t meas, int cat) { 513 500 … … 520 507 521 508 /* determine Mcal values for all images */ 522 void setMcal (Catalog *catalog , FlatCorrectionTable *flatcorr) {509 void setMcal (Catalog *catalog) { 523 510 524 511 off_t i, j, m, c, n; … … 651 638 // the flat-correction. NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat) 652 639 653 float Mflat = getMflat (m, c, flatcorr,catalog);640 float Mflat = getMflat (m, c, catalog); 654 641 655 642 n = catalog[c].measureT[m].averef; … … 773 760 774 761 /* determine McalTEST values for all images -- this is not used to set measure.Mcal, but only to test */ 775 void setMcalTest (Catalog *catalog , FlatCorrectionTable *flatcorr) {762 void setMcalTest (Catalog *catalog) { 776 763 777 764 off_t i, j, m, c, n; … … 845 832 // the flat-correction. NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat) 846 833 847 float Mflat = getMflat (m, c, flatcorr,catalog);834 float Mflat = getMflat (m, c, catalog); 848 835 849 836 // get the PSF magnitude for thie measurement, with airmass slope applied … … 1084 1071 } 1085 1072 1086 StatType statsImageN (Catalog *catalog , FlatCorrectionTable *flatcorr) {1073 StatType statsImageN (Catalog *catalog) { 1087 1074 1088 1075 off_t i, j, m, c, n, N; -
branches/eam_branches/relphot.20210521/src/MagResidSave.c
r41603 r41606 235 235 // the flat-correction. NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat) 236 236 237 // float Mflat = getMflat (m, c, flatcorr, catalog);237 float Mflat = getMflat (m, c, catalog); 238 238 239 239 // MrelPSF is the average magnitude for this star. … … 248 248 if (isnan(MsysPSF)) continue; 249 249 250 // XXX skip Mflat for now 251 // float Moff = Mcal + Mmos + Mgrp + Mgrid - Mflat; 252 253 float Moff = Mcal + Mmos + Mgrp + Mgrid; 250 float Moff = Mcal + Mmos + Mgrp + Mgrid - Mflat; 254 251 255 252 // Mrel is the true average apparent magnitude of this star -
branches/eam_branches/relphot.20210521/src/MosaicOps.c
r41603 r41606 1 1 # include "relphot.h" 2 2 off_t findMosaic (unsigned int *startTimes, off_t Nmosaic, unsigned int start); 3 int save_test_mosaic_measures (FILE *fout, int Nmos, Catalog *catalog , FlatCorrectionTable *flatcorr);3 int save_test_mosaic_measures (FILE *fout, int Nmos, Catalog *catalog); 4 4 5 5 // see discussion in ImagesOps.c re: IDX_T … … 818 818 Catalog *catalog; 819 819 Image *image; 820 FlatCorrectionTable *flatcorr;821 820 SetMmosInfo info; 822 821 } ThreadInfo; 823 822 824 int setMmos_mosaic (Mosaic *mosaic, off_t Nmos, Image *image, Catalog *catalog, SetMmosInfo *info , FlatCorrectionTable *flatcorr);823 int setMmos_mosaic (Mosaic *mosaic, off_t Nmos, Image *image, Catalog *catalog, SetMmosInfo *info); 825 824 void *setMmos_worker (void *data); 826 int setMmos_threaded (Catalog *catalog , FlatCorrectionTable *flatcorr);825 int setMmos_threaded (Catalog *catalog); 827 826 828 827 void SetMmosInfoInit (SetMmosInfo *info, off_t Nmax, int allocLists) { … … 890 889 } 891 890 892 int setMmos (Catalog *catalog , FlatCorrectionTable *flatcorr) {891 int setMmos (Catalog *catalog) { 893 892 894 893 off_t i, N, Nmax; … … 903 902 // so do not run setMmos in threaded mode if PLOTSTUFF is set 904 903 if (NTHREADS && !PLOTSTUFF) { 905 int status = setMmos_threaded (catalog , flatcorr);904 int status = setMmos_threaded (catalog); 906 905 return status; 907 906 } … … 923 922 924 923 for (i = 0; i < Nmosaic; i++) { 925 setMmos_mosaic (&mosaic[i], i, image, catalog, &info , flatcorr);924 setMmos_mosaic (&mosaic[i], i, image, catalog, &info); 926 925 } 927 926 SetMmosInfoFree (&info); … … 940 939 941 940 // 'mosaic' is a pointer to the current mosaic of interest (Nmos) 942 int setMmos_mosaic (Mosaic *myMosaic, off_t Nmos, Image *image, Catalog *catalog, SetMmosInfo *info , FlatCorrectionTable *flatcorr) {941 int setMmos_mosaic (Mosaic *myMosaic, off_t Nmos, Image *image, Catalog *catalog, SetMmosInfo *info) { 943 942 944 943 off_t j, NimageReal; … … 1021 1020 snprintf (filename, 64, "test.%05d.%02d.dat", (int) Nmos, npass_output); 1022 1021 fout = fopen (filename, "w"); 1023 save_test_mosaic_measures (fout, Nmos, catalog , flatcorr);1022 save_test_mosaic_measures (fout, Nmos, catalog); 1024 1023 fclose (fout); 1025 1024 } … … 1072 1071 // the flat-correction. NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat) 1073 1072 1074 float Mflat = getMflat (m, c, flatcorr,catalog);1073 float Mflat = getMflat (m, c, catalog); 1075 1074 1076 1075 off_t n = catalog[c].measureT[m].averef; … … 1187 1186 } 1188 1187 1189 int save_test_mosaic_measures (FILE *fout, int Nmos, Catalog *catalog , FlatCorrectionTable *flatcorr) {1188 int save_test_mosaic_measures (FILE *fout, int Nmos, Catalog *catalog) { 1190 1189 1191 1190 int Nsecfilt = GetPhotcodeNsecfilt (); … … 1201 1200 float Mgrid = getMgridTiny (&catalog[c].measureT[m]); 1202 1201 float MrelPSF = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); 1203 float Mflat = getMflat (m, c, flatcorr,catalog);1202 float Mflat = getMflat (m, c, catalog); 1204 1203 1205 1204 off_t n = catalog[c].measureT[m].averef; … … 1215 1214 } 1216 1215 1217 int setMmos_threaded (Catalog *catalog , FlatCorrectionTable *flatcorr) {1216 int setMmos_threaded (Catalog *catalog) { 1218 1217 1219 1218 int i; … … 1252 1251 threadinfo[i].catalog = catalog; 1253 1252 threadinfo[i].image = image; 1254 threadinfo[i].flatcorr = flatcorr;1255 1253 1256 1254 // we do NOT allocate the arrays here, we only supply basic info (Nmax, Nloop) used in … … 1321 1319 1322 1320 Catalog *catalog = threadinfo->catalog; 1323 FlatCorrectionTable *flatcorr = threadinfo->flatcorr;1324 1321 Image *image = threadinfo->image; 1325 1322 1326 setMmos_mosaic (&mosaic[i], i, image, catalog, &results , flatcorr);1323 setMmos_mosaic (&mosaic[i], i, image, catalog, &results); 1327 1324 SetMmosInfoAccum (&threadinfo->info, &results); 1328 1325 } … … 1599 1596 } 1600 1597 1601 StatType statsMosaicN (Catalog *catalog , FlatCorrectionTable *flatcorr) {1598 StatType statsMosaicN (Catalog *catalog) { 1602 1599 1603 1600 off_t i, j, m, c, n, N; -
branches/eam_branches/relphot.20210521/src/StarOps.c
r41603 r41606 8 8 Catalog *catalog; 9 9 int Ncatalog; 10 FlatCorrectionTable *flatcorr;11 10 SetMrelInfo summary; 12 11 } ThreadInfo; … … 14 13 // ** internal functions: 15 14 void *setMrel_worker (void *data); 16 int setMrel_threaded (Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr);17 int setMrel_catalog (Catalog *catalog, int Nc, int pass, FlatCorrectionTable *flatcorr,SetMrelInfo *results, int Nsecfilt);15 int setMrel_threaded (Catalog *catalog, int Ncatalog); 16 int setMrel_catalog (Catalog *catalog, int Nc, int pass, SetMrelInfo *results, int Nsecfilt); 18 17 int print_measure_set (Average *average, SecFilt *secfilt, Measure *measure); 19 18 … … 298 297 // * setMrelOutput updates average EXT flags (PS1 and 2MASS) 299 298 300 int setMrel (Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr) {299 int setMrel (Catalog *catalog, int Ncatalog) { 301 300 302 301 int i; 303 302 304 303 if (NTHREADS) { 305 int status = setMrel_threaded (catalog, Ncatalog , flatcorr);304 int status = setMrel_threaded (catalog, Ncatalog); 306 305 return status; 307 306 } … … 314 313 315 314 for (i = 0; i < Ncatalog; i++) { 316 setMrel_catalog_alt (catalog, i, FALSE, flatcorr,&results, Nsecfilt);315 setMrel_catalog_alt (catalog, i, FALSE, &results, Nsecfilt); 317 316 SetMrelInfoAccum (&summary, &results); 318 317 } … … 326 325 327 326 // setMrelOutput is NOT threaded because we read/write catalogs one at a time (for now) 328 int setMrelOutput (Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr) {327 int setMrelOutput (Catalog *catalog, int Ncatalog) { 329 328 330 329 int i; … … 337 336 338 337 for (i = 0; i < Ncatalog; i++) { 339 setMrel_catalog_alt (catalog, i, TRUE, flatcorr,&results, Nsecfilt);338 setMrel_catalog_alt (catalog, i, TRUE, &results, Nsecfilt); 340 339 SetMrelInfoAccum (&summary, &results); 341 340 } … … 347 346 } 348 347 349 int setMrel_threaded (Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr) {348 int setMrel_threaded (Catalog *catalog, int Ncatalog) { 350 349 351 350 int i; … … 374 373 threadinfo[i].catalog = catalog; 375 374 threadinfo[i].Ncatalog = Ncatalog; 376 threadinfo[i].flatcorr = flatcorr;377 375 SetMrelInfoInit (&threadinfo[i].summary, FALSE); 378 376 pthread_create (&threads[i], NULL, setMrel_worker, &threadinfo[i]); … … 435 433 436 434 Catalog *catalog = threadinfo->catalog; 437 FlatCorrectionTable *flatcorr = threadinfo->flatcorr; 438 439 setMrel_catalog_alt (catalog, i, FALSE, flatcorr, &results, Nsecfilt); 435 436 setMrel_catalog_alt (catalog, i, FALSE, &results, Nsecfilt); 440 437 SetMrelInfoAccum (&threadinfo->summary, &results); 441 438 } … … 474 471 475 472 /* set measure.Mcal for all measures except ID_MEAS_NOCAL and ID_IMAGE_PHOTOM_NOCAL */ 476 int setMcalOutput (Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr) {473 int setMcalOutput (Catalog *catalog, int Ncatalog) { 477 474 478 475 int i; … … 667 664 # define NSIGMA_CLIP 3.0 668 665 # define NSIGMA_REJECT 5.0 669 void clean_measures (Catalog *catalog, int Ncatalog, int final , FlatCorrectionTable *flatcorr) {666 void clean_measures (Catalog *catalog, int Ncatalog, int final) { 670 667 671 668 off_t j, k, m, Nmax, Ndel, Nave; … … 833 830 } 834 831 835 StatType statsStarN (Catalog *catalog, int Ncatalog, int Nsec, int seccode , FlatCorrectionTable *flatcorr) {832 StatType statsStarN (Catalog *catalog, int Ncatalog, int Nsec, int seccode) { 836 833 837 834 off_t j, k, m, Ntot; … … 1106 1103 float MrelPSF = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); // average magnitude 1107 1104 // float Mgrid = getMgridTiny (&catalog[c].measureT[m]); // camera offset (deprecated?) 1108 // float Mflat = getMflat (m, c, flatcorr,catalog); // flat-field correction1105 // float Mflat = getMflat (m, c, catalog); // flat-field correction 1109 1106 1110 1107 off_t n = catalog[c].measureT[m].averef; … … 1121 1118 fclose (fout); 1122 1119 } 1120 1121 // maybe make this a macro 1122 float getMflat (off_t meas, int cat, Catalog *catalog) { 1123 float offset = catalog[cat].measureT[meas].Mflat; 1124 if (!isfinite(offset)) { 1125 offset = 0.0; 1126 } 1127 return (offset); 1128 } -
branches/eam_branches/relphot.20210521/src/TGroupOps.c
r41603 r41606 2 2 3 3 void assignMosaicsToTGroups (void); 4 int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog , FlatCorrectionTable *flatcorr);4 int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog); 5 5 6 6 // tgroupTimes carries the times of the tgroups (initially, just the photometric nights) … … 647 647 Catalog *catalog; 648 648 Image *image; 649 FlatCorrectionTable *flatcorr;650 649 SetMgrpInfo info; 651 650 } ThreadInfo; 652 651 653 int setMgrp_tgroup (TGroup *tgroup, off_t Nmos, Image *image, Catalog *catalog, SetMgrpInfo *info , FlatCorrectionTable *flatcorr);652 int setMgrp_tgroup (TGroup *tgroup, off_t Nmos, Image *image, Catalog *catalog, SetMgrpInfo *info); 654 653 void *setMgrp_worker (void *data); 655 int setMgrp_threaded (Catalog *catalog , FlatCorrectionTable *flatcorr);654 int setMgrp_threaded (Catalog *catalog); 656 655 657 656 void SetMgrpInfoInit (SetMgrpInfo *info, off_t Nmax, int allocLists) { … … 727 726 } 728 727 729 int setMgrp (Catalog *catalog , FlatCorrectionTable *flatcorr) {728 int setMgrp (Catalog *catalog) { 730 729 731 730 off_t N; … … 738 737 // so do not run setMgrp in threaded mode if PLOTSTUFF is set 739 738 if (NTHREADS && !PLOTSTUFF) { 740 int status = setMgrp_threaded (catalog , flatcorr);739 int status = setMgrp_threaded (catalog); 741 740 return status; 742 741 } … … 758 757 TGroup *tgroup = tgroupTimes[i][0].byCode; 759 758 for (off_t j = 0; j < tgroupTimes[i][0].nCode; j++) { 760 setMgrp_tgroup (&tgroup[j], i, image, catalog, &info , flatcorr);759 setMgrp_tgroup (&tgroup[j], i, image, catalog, &info); 761 760 // 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", 762 761 // 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); … … 781 780 782 781 // 'tgroup' is a pointer to the current tgroup of interest (entry Ngrp) 783 int setMgrp_tgroup (TGroup *myTGroup, off_t Ngrp, Image *image, Catalog *catalog, SetMgrpInfo *info , FlatCorrectionTable *flatcorr) {782 int setMgrp_tgroup (TGroup *myTGroup, off_t Ngrp, Image *image, Catalog *catalog, SetMgrpInfo *info) { 784 783 785 784 off_t j; … … 826 825 fout = fopen (filename, "w"); 827 826 fprintf (fout, "# tgroup %s (%.0f)\n", ohana_sec_to_date(tgroup->start), mjdStart); 828 save_test_night_measures (fout, myTGroup, catalog , flatcorr);827 save_test_night_measures (fout, myTGroup, catalog); 829 828 fclose (fout); 830 829 } … … 877 876 // the flat-correction. NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat) 878 877 879 float Mflat = getMflat (m, c, flatcorr,catalog);878 float Mflat = getMflat (m, c, catalog); 880 879 881 880 off_t n = catalog[c].measureT[m].averef; … … 1000 999 } 1001 1000 1002 int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog , FlatCorrectionTable *flatcorr) {1001 int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog) { 1003 1002 1004 1003 int Nsecfilt = GetPhotcodeNsecfilt (); … … 1015 1014 float Mgrid = getMgridTiny (&catalog[c].measureT[m]); // camera offset (deprecated?) 1016 1015 float MrelPSF = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); // average magnitude 1017 float Mflat = getMflat (m, c, flatcorr,catalog); // flat-field correction1016 float Mflat = getMflat (m, c, catalog); // flat-field correction 1018 1017 1019 1018 off_t n = catalog[c].measureT[m].averef; … … 1037 1036 } 1038 1037 1039 int setMgrp_threaded (Catalog *catalog , FlatCorrectionTable *flatcorr) {1038 int setMgrp_threaded (Catalog *catalog) { 1040 1039 1041 1040 int i; … … 1075 1074 threadinfo[i].catalog = catalog; 1076 1075 threadinfo[i].image = image; 1077 threadinfo[i].flatcorr = flatcorr;1078 1076 1079 1077 // we do NOT allocate the arrays here, we only supply basic info used in the threads … … 1147 1145 1148 1146 Catalog *catalog = threadinfo->catalog; 1149 FlatCorrectionTable *flatcorr = threadinfo->flatcorr;1150 1147 Image *image = threadinfo->image; 1151 1148 1152 1149 TGroup *tgroup = tgroupTimes[i][0].byCode; 1153 1150 for (int j = 0; j < tgroupTimes[i][0].nCode; j++) { 1154 setMgrp_tgroup (&tgroup[j], i, image, catalog, &results , flatcorr);1151 setMgrp_tgroup (&tgroup[j], i, image, catalog, &results); 1155 1152 SetMgrpInfoAccum (&threadinfo->info, &results); 1156 1153 } … … 1506 1503 float MrelPSF = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); // average magnitude 1507 1504 // float Mgrid = getMgridTiny (&catalog[c].measureT[m]); // camera offset (deprecated?) 1508 // float Mflat = getMflat (m, c, flatcorr,catalog); // flat-field correction1505 // float Mflat = getMflat (m, c, catalog); // flat-field correction 1509 1506 1510 1507 off_t n = catalog[c].measureT[m].averef; -
branches/eam_branches/relphot.20210521/src/global_stats.c
r41462 r41606 1 1 # include "relphot.h" 2 2 3 void global_stats (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr,int nloop) {3 void global_stats (Catalog *catalog, int Ncatalog, int nloop) { 4 4 5 5 StatType stN, stX, stS, imN, imX, imM, imD, msM, msX, msN, msD, tgM, tgX, tgD; … … 33 33 int seccode = photcodes[Ns][0].code; 34 34 35 stN = statsStarN (catalog, Ncatalog, Nsec, seccode , flatcorr);35 stN = statsStarN (catalog, Ncatalog, Nsec, seccode); 36 36 stX = statsStarX (catalog, Ncatalog, Nsec); 37 37 stS = statsStarS (catalog, Ncatalog, Nsec); … … 43 43 } 44 44 45 imN = statsImageN (catalog , flatcorr);45 imN = statsImageN (catalog); 46 46 imX = statsImageX (catalog); 47 47 imM = statsImageM (catalog); 48 48 imD = statsImagedM (catalog); 49 49 50 msN = statsMosaicN (catalog , flatcorr);50 msN = statsMosaicN (catalog); 51 51 msM = statsMosaicM (catalog); 52 52 msD = statsMosaicdM (catalog); … … 58 58 59 59 fprintf (stderr, "meas / image: %7.0f %7.0f %7.0f %7.0f %7.0f %6d\n", imN.median, imN.mean, imN.sigma, imN.min, imN.max, imN.Nmeas); 60 fprintf (stderr, "Mcal image:%7.4f %7.4f %7.4f %7.4f %7.4f %6d\n", imM.median, imM.mean, imM.sigma, imM.min, imM.max, imM.Nmeas);60 fprintf (stderr, "Mcal image: %7.4f %7.4f %7.4f %7.4f %7.4f %6d\n", imM.median, imM.mean, imM.sigma, imM.min, imM.max, imM.Nmeas); 61 61 fprintf (stderr, "dMcal image: %7.4f %7.4f %7.4f %7.4f %7.4f %6d\n", imD.median, imD.mean, imD.sigma, imD.min, imD.max, imD.Nmeas); 62 62 fprintf (stderr, "chisq image: %7.1f %7.1f %7.1f %7.1f %7.1f %6d\n", imX.median, imX.mean, imX.sigma, imX.min, imX.max, imX.Nmeas); 63 63 64 64 fprintf (stderr, "meas / mosaic: %7.0f %7.0f %7.0f %7.0f %7.0f %6d\n", msN.median, msN.mean, msN.sigma, msN.min, msN.max, msN.Nmeas); 65 fprintf (stderr, "Mcal mosaic:%7.4f %7.4f %7.4f %7.4f %7.4f %6d\n", msM.median, msM.mean, msM.sigma, msM.min, msM.max, msM.Nmeas);65 fprintf (stderr, "Mcal mosaic: %7.4f %7.4f %7.4f %7.4f %7.4f %6d\n", msM.median, msM.mean, msM.sigma, msM.min, msM.max, msM.Nmeas); 66 66 fprintf (stderr, "dMcal mosaic: %7.4f %7.4f %7.4f %7.4f %7.4f %6d\n", msD.median, msD.mean, msD.sigma, msD.min, msD.max, msD.Nmeas); 67 67 fprintf (stderr, "chisq mosaic: %7.1f %7.1f %7.1f %7.1f %7.1f %6d\n", msX.median, msX.mean, msX.sigma, msX.min, msX.max, msX.Nmeas); -
branches/eam_branches/relphot.20210521/src/plot_scatter.c
r41603 r41606 1 1 # include "relphot.h" 2 2 3 void plot_scatter (Catalog *catalog, int Ncatalog , FlatCorrectionTable *flatcorr) {3 void plot_scatter (Catalog *catalog, int Ncatalog) { 4 4 5 5 off_t i, j, k, m, N, Ntot; -
branches/eam_branches/relphot.20210521/src/reload_catalogs.c
r41605 r41606 9 9 gettimeofday (&start, (void *) NULL); 10 10 11 void reload_catalogs (SkyList *skylist, FlatCorrectionTable *flatcorr,int hostID, char *hostpath) {11 void reload_catalogs (SkyList *skylist, int hostID, char *hostpath) { 12 12 13 13 int i; … … 100 100 101 101 initMrel (&catalog, 1); 102 setMrelFinal (&catalog, flatcorr,FALSE);102 setMrelFinal (&catalog, FALSE); 103 103 TIMESTAMP(time5); 104 104 -
branches/eam_branches/relphot.20210521/src/relphot.c
r41605 r41606 72 72 exit (2); 73 73 } 74 reload_catalogs (skylist, NULL,0, NULL);74 reload_catalogs (skylist, 0, NULL); 75 75 relphot_free (sky, skylist); 76 76 exit (0); -
branches/eam_branches/relphot.20210521/src/relphot_client.c
r39643 r41606 80 80 initImagesSubset (image, NULL, Nimage); 81 81 82 // load the flat-field correction table from CATDIR 83 FlatCorrectionTable *flatcorr = NULL; 84 reload_catalogs (skylist, flatcorr, HOST_ID, HOSTDIR); 82 reload_catalogs (skylist, HOST_ID, HOSTDIR); 85 83 freeImages ((char *)image); 86 84 free (image); -
branches/eam_branches/relphot.20210521/src/relphot_images.c
r41604 r41606 45 45 if (!UPDATE) dvo_image_unlock (&db); 46 46 47 FlatCorrectionTable *flatcorr = NULL; // no longer used here48 49 47 initGridBins (); // allocates the empty array of corrections (elements are build below) 50 48 … … 80 78 setExclusions (catalog, Ncatalog, TRUE); 81 79 82 global_stats (catalog, Ncatalog, flatcorr,0);80 global_stats (catalog, Ncatalog, 0); 83 81 84 82 if (PLOTSTUFF) { … … 91 89 SetZptIteration (i); 92 90 93 setMrel (catalog, Ncatalog , flatcorr); // threaded91 setMrel (catalog, Ncatalog); // threaded 94 92 95 setMcal (catalog , flatcorr);96 setMmos (catalog , flatcorr);97 setMgrp (catalog , flatcorr);93 setMcal (catalog); 94 setMmos (catalog); 95 setMgrp (catalog); 98 96 99 97 setMgrid (catalog, Ncatalog); … … 101 99 102 100 if (PLOTSTUFF) { 103 plot_scatter (catalog, Ncatalog , flatcorr);101 plot_scatter (catalog, Ncatalog); 104 102 plot_mosaics (); 105 103 plot_images (); … … 108 106 } 109 107 110 global_stats (catalog, Ncatalog, flatcorr,i);108 global_stats (catalog, Ncatalog, i); 111 109 SetZeroPointModes (); 112 110 … … 116 114 117 115 if (PLOTSTUFF) { 118 plot_scatter (catalog, Ncatalog , flatcorr);116 plot_scatter (catalog, Ncatalog); 119 117 plot_mosaics (); 120 118 plot_images (); … … 162 160 clients */ 163 161 if (!CALIBRATE_STACKS_AND_WARPS) { 164 reload_catalogs (skylist, flatcorr,0, NULL);162 reload_catalogs (skylist, 0, NULL); 165 163 MARKTIME("-- updated all catalogs: %f sec\n", dtime); 166 164 } -
branches/eam_branches/relphot.20210521/src/relphot_objects.c
r41605 r41606 126 126 127 127 initMrel (&catalog, 1); 128 setMrelFinal (&catalog, NULL,TRUE);128 setMrelFinal (&catalog, TRUE); 129 129 130 130 // uncomment for extra verbosity -
branches/eam_branches/relphot.20210521/src/relphot_parallel_images.c
r41603 r41606 40 40 initImages (image, NULL, Nimage); 41 41 42 // load the flat correction table (if defined)43 // we no longer need to do this: the flatcorrection is now saved in measure.Mflat44 # if (0)45 char flatcorrfile[256];46 sprintf (flatcorrfile, "%s/flatcorr.fits", CATDIR);47 FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrfile, VERBOSE);48 # endif49 FlatCorrectionTable *flatcorr = NULL;50 51 42 // UserPatch.Rmin,Rmax may have range from a few degrees < 0.0 to few degrees > 360.0. 52 43 // the following function correctly chooses the sky regions on the 0,360 boundary … … 88 79 setExclusions (catalog, Ncatalog, TRUE); 89 80 90 global_stats (catalog, Ncatalog, flatcorr,0);81 global_stats (catalog, Ncatalog, 0); 91 82 92 83 if (PLOTSTUFF) { … … 101 92 102 93 // set the mean stellar mags given the measurements and the image calibrations 103 setMrel (catalog, Ncatalog , flatcorr);94 setMrel (catalog, Ncatalog); 104 95 105 96 // share mean mags for objects at the boundary (number of unowned meas > 0) … … 112 103 113 104 // set the image (Mcal) and mosaic (Mmos) zero point offsets given the mean mags and measurements 114 setMcal (catalog , flatcorr);115 setMmos (catalog , flatcorr);116 // setMgrp (catalog, FALSE , flatcorr); XXX think this through: this may not make sense for tgroups105 setMcal (catalog); 106 setMmos (catalog); 107 // setMgrp (catalog, FALSE); XXX think this through: this may not make sense for tgroups 117 108 MARKTIME("-- set Mrel, Mcal, Mmos, Mgrid : %f sec\n", dtime); 118 109 … … 124 115 client_logger_message ("slurped image data : loop %d \n", i); 125 116 126 global_stats (catalog, Ncatalog, flatcorr,i);117 global_stats (catalog, Ncatalog, i); 127 118 128 119 SetZeroPointModes (); -
branches/eam_branches/relphot.20210521/src/relphot_parallel_regions.c
r41556 r41606 14 14 exit (2); 15 15 } 16 17 // load the flat correction table (if defined)18 # if (0)19 char flatcorrfile[256];20 sprintf (flatcorrfile, "%s/flatcorr.fits", CATDIR);21 FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrfile, VERBOSE);22 # endif23 FlatCorrectionTable *flatcorr = NULL;24 16 25 17 // register database handle with shutdown procedure … … 81 73 82 74 /* update catalogs (in parallel) */ 83 reload_catalogs (skylist, flatcorr,0, NULL);75 reload_catalogs (skylist, 0, NULL); 84 76 85 77 // save the changes to the image parameters -
branches/eam_branches/relphot.20210521/src/setMrelCatalog.c
r41603 r41606 60 60 int useOLS = TRUE; // chosen based on iteration below 61 61 62 int setMrel_catalog_alt (Catalog *catalog, int Nc, int isSetMrelFinal, FlatCorrectionTable *flatcorr,SetMrelInfo *results, int Nsecfilt) {62 int setMrel_catalog_alt (Catalog *catalog, int Nc, int isSetMrelFinal, SetMrelInfo *results, int Nsecfilt) { 63 63 64 64 off_t j; … … 75 75 76 76 if (STAGES & STAGE_CHIP) { 77 setMrelAverageExposure (&catalog[Nc], Nc, j, Nsecfilt, isSetMrelFinal, flatcorr,results);77 setMrelAverageExposure (&catalog[Nc], Nc, j, Nsecfilt, isSetMrelFinal, results); 78 78 } 79 79 80 80 // only apply Stack operation on setMrelFinal in first pass 81 81 if (isSetMrelFinal && (STAGES & STAGE_STACK) && !IS_DIFF_DB) { 82 setMrelAverageStack (&catalog[Nc], Nc, j, Nsecfilt , flatcorr);82 setMrelAverageStack (&catalog[Nc], Nc, j, Nsecfilt); 83 83 } 84 84 85 85 // only measure force-warp mean values if issetMrelFinal (make it optional?) 86 86 if (isSetMrelFinal && (STAGES & STAGE_WARP)) { 87 setMrelAverageForcedWarp (&catalog[Nc], Nc, j, Nsecfilt, flatcorr,results);87 setMrelAverageForcedWarp (&catalog[Nc], Nc, j, Nsecfilt, results); 88 88 } 89 89 } … … 113 113 114 114 // set mean of chip measurements (selected by photcode range for now): 115 int setMrelAverageExposure (Catalog *catalog, int cat, off_t ave, int Nsecfilt, int isSetMrelFinal, FlatCorrectionTable *flatcorr,SetMrelInfo *results) {115 int setMrelAverageExposure (Catalog *catalog, int cat, off_t ave, int Nsecfilt, int isSetMrelFinal, SetMrelInfo *results) { 116 116 117 117 int Nsec; … … 270 270 271 271 // XXX I am not convinced the sign on Mflat here is correct 272 float Moff = M flat + Mcal + Mmos + Mgrp + Mgrid;272 float Moff = Mcal + Mmos + Mgrp + Mgrid - Mflat; 273 273 274 274 if (isSetMrelFinal) { … … 552 552 // measure->McalAPER to image->McalPSF for chips and warps, but not stacks 553 553 554 int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt , FlatCorrectionTable *flatcorr) {554 int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt) { 555 555 556 556 // we are guaranteed to have average, measure, secfilt … … 884 884 // chips and warps, but not stacks 885 885 886 int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr, SetMrelInfo *results) { 887 OHANA_UNUSED_PARAM(flatcorr); 886 int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, SetMrelInfo *results) { 888 887 889 888 // we are guaranteed to have average, measure, secfilt -
branches/eam_branches/relphot.20210521/src/setMrelFinal.c
r40291 r41606 5 5 // output dbFlags values 6 6 7 void setMrelFinal (Catalog *catalog, FlatCorrectionTable *flatcorr,int simpleAverage) {7 void setMrelFinal (Catalog *catalog, int simpleAverage) { 8 8 9 9 off_t i; … … 103 103 // XXX make this optional? (do not clean for -averages?) 104 104 // XXX : for the moment, disable clean_measures 105 if (!simpleAverage && FALSE) clean_measures (catalog, 1, TRUE , flatcorr); /* mark outliers ID_MEAS_POOR_PHOTOM */105 if (!simpleAverage && FALSE) clean_measures (catalog, 1, TRUE); /* mark outliers ID_MEAS_POOR_PHOTOM */ 106 106 107 107 ALLOCATE (catalog[0].measureRank, char, catalog[0].Nmeasure); 108 108 setMeasureRank (catalog); 109 setMrelOutput (catalog, 1 , flatcorr); // sets the values secfilt.MpsfChp = <measure.M + measure.Mflat - image.Mcal>110 setMcalOutput (catalog, 1 , flatcorr); // sets measure.Mcal = image.Mcal109 setMrelOutput (catalog, 1); // sets the values secfilt.MpsfChp = <measure.M + measure.Mflat - image.Mcal> 110 setMcalOutput (catalog, 1); // sets measure.Mcal = image.Mcal 111 111 112 112 /* clear ID_OBJ_POOR, ID_OBJ_FEW values before writing ??? */ … … 163 163 int print_measure_set (Average *average, SecFilt *secfilt, Measure *measure); 164 164 165 void skip_measurements (Catalog *catalog, int pass , FlatCorrectionTable *flatcorr) {165 void skip_measurements (Catalog *catalog, int pass) { 166 166 167 167 off_t i, k, m;
Note:
See TracChangeset
for help on using the changeset viewer.
