- Timestamp:
- Jul 27, 2020, 11:06:35 AM (6 years ago)
- Location:
- trunk/Ohana/src/relphot
- Files:
-
- 14 edited
- 8 copied
-
. (modified) (1 prop)
-
Makefile (modified) (2 diffs)
-
include/relphot.h (modified) (12 diffs)
-
src/GridOps.c (modified) (10 diffs)
-
src/ImageOps.c (modified) (8 diffs)
-
src/MosaicOps.c (modified) (6 diffs)
-
src/ReadTGroupFile.c (copied) (copied from branches/eam_branches/relphot.20200519/src/ReadTGroupFile.c )
-
src/StarOps.c (modified) (12 diffs)
-
src/TGroupOps.c (copied) (copied from branches/eam_branches/relphot.20200519/src/TGroupOps.c )
-
src/args.c (modified) (3 diffs)
-
src/liststats.c (modified) (2 diffs)
-
src/load_images.c (modified) (1 diff)
-
src/reload_catalogs.c (modified) (3 diffs)
-
src/relphot_images.c (modified) (7 diffs)
-
src/relphot_parallel_images.c (modified) (2 diffs)
-
src/setMrelCatalog.c (modified) (6 diffs)
-
test/GSCregions.tbl.gz (copied) (copied from branches/eam_branches/relphot.20200519/test/GSCregions.tbl.gz )
-
test/dvo.config (copied) (copied from branches/eam_branches/relphot.20200519/test/dvo.config )
-
test/ptolemy.dvo (copied) (copied from branches/eam_branches/relphot.20200519/test/ptolemy.dvo )
-
test/relphot.basic.dvo (copied) (copied from branches/eam_branches/relphot.20200519/test/relphot.basic.dvo )
-
test/relphot.tgroups.dvo (copied) (copied from branches/eam_branches/relphot.20200519/test/relphot.tgroups.dvo )
-
test/tap.dvo (copied) (copied from branches/eam_branches/relphot.20200519/test/tap.dvo )
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relphot
- Property svn:mergeinfo set to
-
trunk/Ohana/src/relphot/Makefile
r39636 r41390 32 32 $(SRC)/BrightCatalog.$(ARCH).o \ 33 33 $(SRC)/MosaicOps.$(ARCH).o \ 34 $(SRC)/TGroupOps.$(ARCH).o \ 35 $(SRC)/ReadTGroupFile.$(ARCH).o \ 34 36 $(SRC)/SetSignals.$(ARCH).o \ 35 37 $(SRC)/Shutdown.$(ARCH).o \ … … 89 91 $(SRC)/BrightCatalog.$(ARCH).o \ 90 92 $(SRC)/MosaicOps.$(ARCH).o \ 93 $(SRC)/TGroupOps.$(ARCH).o \ 94 $(SRC)/ReadTGroupFile.$(ARCH).o \ 91 95 $(SRC)/SetSignals.$(ARCH).o \ 92 96 $(SRC)/Shutdown.$(ARCH).o \ -
trunk/Ohana/src/relphot/include/relphot.h
r40386 r41390 90 90 } Mosaic; 91 91 92 typedef struct { 93 unsigned int start; 94 unsigned int stop; 95 short photcode; 96 float McalPSF; 97 float McalAPER; 98 float dKlam; 99 float dMcal; 100 float dMsys; 101 float McalChiSq; 102 unsigned short nFitPhotom; 103 unsigned int flags; 104 105 off_t Nimage; 106 off_t NIMAGE; 107 off_t *image; 108 109 off_t Nmeasure; 110 off_t NMEASURE; 111 off_t *measure; 112 113 off_t Ncatalog; // XX not needed 114 off_t NCATALOG; // XX not needed 115 off_t *catalog; 116 } TGroup; 117 92 118 typedef enum { 93 119 STATS_NONE, … … 145 171 int Ncal; 146 172 int Nmos; 173 int Ngrp; 147 174 int Ngrid; 148 175 … … 305 332 int VERBOSE_IMAGE; 306 333 int MOSAIC_ZEROPT; 334 int TGROUP_ZEROPT; 335 int TGROUP_FIT_AIRMASS; 307 336 308 337 int TEST_IMAGE1; … … 403 432 void clean_measures PROTO((Catalog *catalog, int Ncatalog, int final, FlatCorrectionTable *flatcorr)); 404 433 void clean_mosaics PROTO((void)); 434 void clean_tgroups PROTO((void)); 405 435 void clean_stars PROTO((Catalog *catalog, int Ncatalog)); 406 436 int corner_check PROTO((double *x1, double *y1, double *x2, double *y2)); … … 410 440 void findImages PROTO((Catalog *catalog, int Ncatalog, int doImageList)); 411 441 int findMosaics PROTO((Catalog *catalog, int Ncatalog, int doMosaicList)); 442 int findTGroups PROTO((Catalog *catalog, int Ncatalog)); 412 443 413 444 void clearImages (void); … … 428 459 void freeImageBins PROTO((int Ncatalog, int doImageList)); 429 460 void freeMosaicBins PROTO((int Ncatalog, int doMosaicList)); 461 void freeTGroupBins PROTO((int Ncatalog)); 462 430 463 void free_catalogs PROTO((Catalog *catalog, int Ncatalog)); 431 464 int gcatalog PROTO((Catalog *catalog, int FINAL)); … … 437 470 float getMgrid PROTO((off_t meas, int cat)); 438 471 float getMmos PROTO((off_t meas, int cat)); 472 float getMgrp PROTO((off_t meas, int cat, float airmass)); 439 473 float getMrel PROTO((Catalog *catalog, off_t meas, int cat, dvoMagClassType class, dvoMagSourceType source)); 440 474 short getUbercalDist PROTO((off_t meas, int cat)); … … 452 486 void initMosaicGrid PROTO((Image *image, off_t Nimage)); 453 487 void initMosaics PROTO((Image *subset, off_t Nsubset, Image *image, char *inSubset, off_t Nimage)); 488 void initTGroups PROTO((Image *subset, off_t *LineNumber, off_t Nsubset)); 489 void freeTGroups PROTO((void)); 490 void initTGroupBins PROTO((Catalog *catalog, int Ncatalog)); 454 491 void initMrel PROTO((Catalog *catalog, int Ncatalog)); 455 492 RelphotMode initialize PROTO((int argc, char **argv)); … … 459 496 int liststats_init PROTO((StatType *stats)); 460 497 int liststats_irls PROTO((StatDataSet *dataset, int Npoints, StatType *stats)); 498 int liststats_fit1d PROTO((double *value, double *err, double *x, int Npts, StatType *stats, double *dk)); 499 500 unsigned int *ReadTGroupFile PROTO((FILE *f, int *nelem)); 501 void loadTGroups PROTO((char *filename)); 502 void initTGroupsMcal PROTO((void)); 503 TGroup *getTGroupForImage PROTO((off_t im)); 504 off_t findTGroup PROTO((unsigned int start, int photcode)); 461 505 462 506 Catalog *load_catalogs PROTO((SkyList *skylist, int *Ncatalog, int hostID, char *hostpath, char *syncfile)); … … 470 514 void matchImage PROTO((Catalog *catalog, off_t meas, int cat, int doImageList)); 471 515 void matchMosaics PROTO((Catalog *catalog, off_t meas, int cat, int doMosaicList)); 516 void matchTGroups PROTO((Catalog *catalog, off_t meas, int cat)); 517 472 518 double opening_angle PROTO((double x1, double y1, double x2, double y2, double x3, double y3)); 473 519 void plot_chisq PROTO((Catalog *catalog, int Ncatalog)); … … 491 537 int setExclusions PROTO((Catalog *catalog, int Ncatalog, int verbose)); 492 538 void setMcal PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr)); 493 void setMcalFinal PROTO((void)); 539 void setMcalFromMosaics PROTO((void)); 540 void setMcalFromTGroups PROTO((void)); 494 541 int setMcalOutput PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr)); 495 542 void setMgrid PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr)); 496 543 int setMmos PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr)); 544 int setMgrp PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr)); 497 545 int setMrel PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr)); 498 546 void setMrelFinal PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr, int simpleAverage)); … … 677 725 void RepairWarpMeasuresOpenLogfile (); 678 726 void RepairWarpMeasuresCloseLogfile (); 727 728 int save_images_backup (FITS_DB *db); -
trunk/Ohana/src/relphot/src/GridOps.c
r40291 r41390 289 289 290 290 int **gotstar, **gridmeas; 291 int i, j, k, Ngood, Nbad, Nmos, Ncal, Nrel, Nsys ;291 int i, j, k, Ngood, Nbad, Nmos, Ncal, Nrel, Nsys, Ngrp; 292 292 double **A, **B, *Mjx, *Wjx; 293 float Msys, Mcal, Mmos, M err, Wsys;293 float Msys, Mcal, Mmos, Mgrp, Merr, Wsys; 294 294 double Mj, Wj; 295 295 … … 305 305 } 306 306 307 Ngood = Nbad = Ncal = Nmos = Nrel = Nsys = 0;307 Ngood = Nbad = Ncal = Nmos = Nrel = Nsys = Ngrp = 0; 308 308 309 309 ALLOCATE (gotstar, int *, Ncatalog); … … 411 411 if (isnan(Mmos)) { 412 412 Nmos ++; 413 continue; 414 } 415 416 // skip mosaics marked as BAD 417 Mgrp = getMgrp (m, c, catalog[c].measureT[m].airmass); 418 if (isnan(Mgrp)) { 419 Ngrp ++; 413 420 continue; 414 421 } … … 526 533 void setMgrid (Catalog *catalog, FlatCorrectionTable *flatcorr) { 527 534 528 int i, j, m, c, n, N, Nmax, Nbad, Nmos, N cal, Nrel, Nsys, Nfit;535 int i, j, m, c, n, N, Nmax, Nbad, Nmos, Ngrp, Ncal, Nrel, Nsys, Nfit; 529 536 double *list, *dlist; 530 float Msys, Mrel, Mcal, Mmos ;537 float Msys, Mrel, Mcal, Mmos, Mgrp; 531 538 532 539 StatType stats; … … 544 551 ALLOCATE (dlist, double, Nmax); 545 552 546 Nbad = Ncal = Nmos = N rel = Nsys = Nfit = 0;553 Nbad = Ncal = Nmos = Ngrp = Nrel = Nsys = Nfit = 0; 547 554 548 555 for (i = 0; i < Ngrid; i++) { … … 568 575 continue; 569 576 } 577 Mgrp = getMgrp (m, c, catalog[c].measureT[m].airmass); 578 if (isnan(Mgrp)) { 579 Ngrp ++; 580 continue; 581 } 570 582 Mrel = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); 571 583 if (isnan(Mrel)) { … … 580 592 continue; 581 593 } 582 list[N] = Msys - Mrel - Mcal - Mmos ;594 list[N] = Msys - Mrel - Mcal - Mmos - Mgrp; 583 595 dlist[N] = MAX (catalog[c].measureT[m].dM, MIN_ERROR); 584 596 N++; … … 616 628 617 629 int i, j, m, c, n, N, Narea; 618 float Msys, Mrel, Mcal, Mmos ;630 float Msys, Mrel, Mcal, Mmos, Mgrp; 619 631 double *xlist, *Mlist, *dlist, *ylist; 620 632 Graphdata graphdata; … … 649 661 Mmos = getMmos (m, c); 650 662 if (isnan(Mmos)) continue; 663 Mgrp = getMgrp (m, c, catalog[c].measureT[m].airmass); 664 if (isnan(Mgrp)) continue; 651 665 Mrel = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); 652 666 if (isnan(Mrel)) continue; … … 657 671 xlist[N] = Xmeas[c][m]; 658 672 ylist[N] = Ymeas[c][m]; 659 Mlist[N] = Msys - Mrel - Mcal - Mmos ;660 dlist[N] = Msys - Mrel - Mcal - Mmos - gridM[i];673 Mlist[N] = Msys - Mrel - Mcal - Mmos - Mgrp; 674 dlist[N] = Msys - Mrel - Mcal - Mmos - Mgrp - gridM[i]; 661 675 N++; 662 676 } -
trunk/Ohana/src/relphot/src/ImageOps.c
r40291 r41390 586 586 587 587 off_t i, j, m, c, n; 588 int mark, bad, Nfew, Nbad, Nmos, N rel, Ngrid, Nsys;588 int mark, bad, Nfew, Nbad, Nmos, Ngrp, Nrel, Ngrid, Nsys; 589 589 590 590 StatType stats; … … 612 612 StatDataSet *brightStars = StatDataSetAlloc (1, Nmax); 613 613 614 Nfew = Nbad = Nmos = Ngr id = Nrel = Nsys = 0;614 Nfew = Nbad = Nmos = Ngrp = Ngrid = Nrel = Nsys = 0; 615 615 616 616 int Ncalibrated = 0; … … 631 631 632 632 // only freeze the gpc1 chips 633 if (FREEZE_IMAGES && isGPC1chip(image[i].photcode)) continue; 633 // XXX : when do we FREEZE_IMAGES in a mix of GPC1, GPC2, etc? 634 // if (FREEZE_IMAGES && isGPC1chip(image[i].photcode)) continue; 635 if (FREEZE_IMAGES) continue; 634 636 if (image[i].photcode == 0) continue; // skip the PHU images 635 637 … … 666 668 continue; 667 669 } 670 float Mgrp = getMgrp (m, c, catalog[c].measureT[m].airmass); 671 if (isnan(Mgrp)) { 672 Ngrp ++; 673 continue; 674 } 668 675 float Mgrid = getMgrid (m, c); 669 676 if (isnan(Mgrid)) { … … 706 713 707 714 skip: 708 psfStars->flxlist[Nref] = MsysPSF - MrelPSF - Mmos - Mgr id + Mflat;715 psfStars->flxlist[Nref] = MsysPSF - MrelPSF - Mmos - Mgrp - Mgrid + Mflat; 709 716 psfStars->errlist[Nref] = MAX (catalog[c].measureT[m].dM, MIN_ERROR); 710 717 psfStars->wgtlist[Nref] = 1; … … 718 725 719 726 if (isfinite(MrelKron) && isfinite(MsysKron)) { 720 kronStars->flxlist[Nkron] = MsysKron - MrelKron - Mmos - Mgr id + Mflat;727 kronStars->flxlist[Nkron] = MsysKron - MrelKron - Mmos - Mgrp - Mgrid + Mflat; 721 728 kronStars->errlist[Nkron] = MAX (catalog[c].measureT[m].dM, MIN_ERROR); 722 729 kronStars->wgtlist[Nkron] = 1; … … 1023 1030 off_t i, j, m, c, n, N; 1024 1031 double *list, *dlist; 1025 float Mcal, Mmos, Mgr id;1032 float Mcal, Mmos, Mgrp, Mgrid; 1026 1033 1027 1034 StatType stats; … … 1050 1057 Mmos = getMmos (m, c); 1051 1058 if (isnan(Mmos)) continue; 1059 Mgrp = getMgrp (m, c, catalog[c].measureT[m].airmass); 1060 if (isnan(Mgrp)) continue; 1052 1061 Mgrid = getMgrid (m, c); 1053 1062 if (isnan(Mgrid)) continue; -
trunk/Ohana/src/relphot/src/MosaicOps.c
r40291 r41390 720 720 } 721 721 722 void setMcalF inal() {722 void setMcalFromMosaics () { 723 723 724 724 off_t i, j, im, Nimage; … … 919 919 int Nbad; 920 920 int Ncal; 921 int Ngrp; 921 922 int Ngrid; 922 923 int Nrel; … … 1154 1155 if (fout) { 1155 1156 float Mcal = getMcal (m, c, MAG_CLASS_PSF); 1157 // float Mgrp = getMgrp (m, c, catalog[c].measureT[m].airmass); 1156 1158 float Mgrid = getMgrid (m, c); 1157 1159 float MrelPSF = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); … … 1175 1177 if (isnan(Mcal)) { 1176 1178 info->Ncal++; 1179 continue; 1180 } 1181 float Mgrp = getMgrp (m, c, catalog[c].measureT[m].airmass); 1182 if (isnan(Mgrp)) { 1183 info->Ngrp++; 1177 1184 continue; 1178 1185 } … … 1692 1699 off_t i, j, m, c, n, N; 1693 1700 double *list, *dlist; 1694 float Mcal, Mgr id, Mrel;1701 float Mcal, Mgrp, Mgrid, Mrel; 1695 1702 StatType stats; 1696 1703 … … 1716 1723 Mcal = getMcal (m, c, MAG_CLASS_PSF); 1717 1724 if (isnan(Mcal)) continue; 1725 Mgrp = getMgrp (m, c, catalog[c].measureT[m].airmass); 1726 if (isnan(Mgrp)) continue; 1718 1727 Mgrid = getMgrid (m, c); 1719 1728 if (isnan(Mgrid)) continue; -
trunk/Ohana/src/relphot/src/StarOps.c
r40291 r41390 105 105 results->Ncal = 0; 106 106 results->Nmos = 0; 107 results->Ngrp = 0; 107 108 results->Ngrid = 0; 108 109 } … … 264 265 summary->Ncal += results->Ncal ; 265 266 summary->Nmos += results->Nmos ; 267 summary->Ngrp += results->Ngrp ; 266 268 summary->Ngrid += results->Ngrid; 267 269 } … … 313 315 SetMrelInfoAccum (&summary, &results); 314 316 } 315 if (VERBOSE2) fprintf (stderr, "%d stars with no data in photcode, %d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngr id: %d, Nsys: %d)\n", summary.Ncode, summary.Nfew, summary.Nbad, summary.Ncal, summary.Nmos, summary.Ngrid, summary.Nsys);317 if (VERBOSE2) fprintf (stderr, "%d stars with no data in photcode, %d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngrp: %d, Ngrid: %d, Nsys: %d)\n", summary.Ncode, summary.Nfew, summary.Nbad, summary.Ncal, summary.Nmos, summary.Ngrp, summary.Ngrid, summary.Nsys); 316 318 317 319 SetMrelInfoFree (&results); … … 336 338 SetMrelInfoAccum (&summary, &results); 337 339 } 338 if (VERBOSE2) fprintf (stderr, "%d stars with no data in photcode, %d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngr id: %d, Nsys: %d)\n", summary.Ncode, summary.Nfew, summary.Nbad, summary.Ncal, summary.Nmos, summary.Ngrid, summary.Nsys);340 if (VERBOSE2) fprintf (stderr, "%d stars with no data in photcode, %d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngrp: %d, Ngrid: %d, Nsys: %d)\n", summary.Ncode, summary.Nfew, summary.Nbad, summary.Ncal, summary.Nmos, summary.Ngrp, summary.Ngrid, summary.Nsys); 339 341 340 342 SetMrelInfoFree (&results); … … 393 395 // report stats & summary from the threads 394 396 for (i = 0; i < NTHREADS; i++) { 395 if (VERBOSE2) fprintf (stderr, "setMrel thread %d : %d stars with no data in photcode, %d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngr id: %d, Nsys: %d)\n",397 if (VERBOSE2) fprintf (stderr, "setMrel thread %d : %d stars with no data in photcode, %d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngrp: %d, Ngrid: %d, Nsys: %d)\n", 396 398 i, 397 399 threadinfo[i].summary.Ncode, … … 400 402 threadinfo[i].summary.Ncal, 401 403 threadinfo[i].summary.Nmos, 404 threadinfo[i].summary.Ngrp, 402 405 threadinfo[i].summary.Ngrid, 403 406 threadinfo[i].summary.Nsys); … … 405 408 SetMrelInfoFree (&threadinfo[i].summary); 406 409 } 407 if (VERBOSE2) fprintf (stderr, "total : %d stars with no data in photcode, %d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngr id: %d, Nsys: %d)\n", summary.Ncode, summary.Nfew, summary.Nbad, summary.Ncal, summary.Nmos, summary.Ngrid, summary.Nsys);410 if (VERBOSE2) fprintf (stderr, "total : %d stars with no data in photcode, %d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngrp: %d, Ngrid: %d, Nsys: %d)\n", summary.Ncode, summary.Nfew, summary.Nbad, summary.Ncal, summary.Nmos, summary.Ngrp, summary.Ngrid, summary.Nsys); 408 411 free (threadinfo); 409 412 … … 488 491 float Mmos = getMmos (m, i); 489 492 if (isnan(Mmos)) continue; 493 float Mgrp = getMgrp (m, i, catalog[i].measureT[m].airmass); 494 if (isnan(Mgrp)) continue; 490 495 float Mgrid = getMgrid (m, i); 491 496 if (isnan(Mgrid)) continue; … … 502 507 503 508 // set the output calibration 504 catalog[i].measure[m].McalPSF = McalPSF + Mmos + Mgrid; 505 catalog[i].measure[m].McalAPER = useStackAper ? McalAPER + Mmos + Mgrid : McalPSF + Mmos + Mgrid; 509 // float Moff = Mmos + Mgrp + Mgrid; 510 float Moff = Mmos + Mgrid; // Mgrp has already been applied to the image.Mcal 511 catalog[i].measure[m].McalPSF = McalPSF + Moff; 512 catalog[i].measure[m].McalAPER = useStackAper ? McalAPER + Moff : McalPSF + Moff; 506 513 507 514 if (catalog[i].measureT[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) { … … 662 669 off_t *ilist; 663 670 double *tlist, *list, *dlist; 664 float Msys, Mcal, Mmos, Mgr id;665 int Ncal, Nmos, Ngr id, Nfew;671 float Msys, Mcal, Mmos, Mgrp, Mgrid; 672 int Ncal, Nmos, Ngrp, Ngrid, Nfew; 666 673 667 674 int Nsecfilt = GetPhotcodeNsecfilt (); … … 689 696 690 697 Ndel = Nave = 0; 691 Ncal = Nmos = Ngr id = Nfew = 0;698 Ncal = Nmos = Ngrp = Ngrid = Nfew = 0; 692 699 for (i = 0; i < Ncatalog; i++) { 693 700 for (j = 0; j < catalog[i].Naverage; j++) { … … 724 731 Mmos = getMmos (m, i); 725 732 if (isnan(Mmos)) { Nmos ++; continue; } 733 Mgrp = getMgrp (m, i, catalog[i].measureT[m].airmass); 734 if (isnan(Mgrp)) { Ngrp ++; continue; } 726 735 Mgrid = getMgrid (m, i); 727 736 if (isnan(Mgrid)) { Ngrid ++; continue; } 728 737 729 738 Msys = PhotSysTiny (&catalog[i].measureT[m], &catalog[i].averageT[j], &catalog[i].secfilt[j*Nsecfilt], MAG_CLASS_PSF); 730 list[N] = Msys - Mcal - Mmos - Mgr id;739 list[N] = Msys - Mcal - Mmos - Mgrp - Mgrid; 731 740 dlist[N] = MAX (catalog[i].measureT[m].dM, MIN_ERROR); 732 741 N++; -
trunk/Ohana/src/relphot/src/args.c
r40386 r41390 336 336 remove_argument (N, &argc, argv); 337 337 USE_MCAL_PSF_FOR_STACK_APER = TRUE; 338 } 339 340 // calibrate the photometry by night / time period 341 TGROUP_ZEROPT = FALSE; 342 char *TGROUP_FILENAME = NULL; 343 if ((N = get_argument (argc, argv, "-tgroup"))) { 344 TGROUP_ZEROPT = TRUE; 345 remove_argument (N, &argc, argv); 346 TGROUP_FILENAME = strcreate(argv[N]); 347 remove_argument (N, &argc, argv); 348 FREEZE_IMAGES = TRUE; 349 } 350 if ((N = get_argument (argc, argv, "-tgroups"))) { 351 if (TGROUP_ZEROPT) { 352 fprintf (stderr, "use only one of -tgroups and -tgroup (same meaning)\n"); 353 exit (2); 354 } 355 TGROUP_ZEROPT = TRUE; 356 remove_argument (N, &argc, argv); 357 TGROUP_FILENAME = strcreate(argv[N]); 358 remove_argument (N, &argc, argv); 359 FREEZE_IMAGES = TRUE; 360 } 361 TGROUP_FIT_AIRMASS = FALSE; 362 if ((N = get_argument (argc, argv, "-tgroup-fit-airmass"))) { 363 if (!TGROUP_ZEROPT) { 364 fprintf (stderr, "-tgroup-fit-airmass requires -tgroup (filename) option\n"); 365 exit (2); 366 } 367 TGROUP_FIT_AIRMASS = TRUE; 368 remove_argument (N, &argc, argv); 338 369 } 339 370 … … 519 550 if (argc != 1) relphot_usage (); 520 551 552 if (TGROUP_ZEROPT) { 553 loadTGroups (TGROUP_FILENAME); 554 free (TGROUP_FILENAME); 555 } 556 521 557 return mode; 522 558 } … … 542 578 FreePhotcodeTable(); 543 579 580 freeTGroups(); 581 544 582 ohana_memcheck (VERBOSE); 545 583 ohana_memdump (VERBOSE); -
trunk/Ohana/src/relphot/src/liststats.c
r40291 r41390 172 172 for (i = ks; i < ke; i++) { 173 173 M = SQ (value[i] - Mo); 174 dM = SQ (dvalue[i]); 175 X2 += M / dM; 174 if (dvalue) { 175 dM = SQ (dvalue[i]); 176 X2 += M / dM; 177 } 176 178 dS += M; 177 179 } 178 X2 = X2 / (Nm - 1);180 X2 = dvalue ? X2 / (Nm - 1) : NAN; 179 181 dS = sqrt (dS / (Nm - 1)); 180 182 … … 187 189 return (TRUE); 188 190 } 191 192 int liststats_fit1d (double *value, double *err, double *x, int Npts, StatType *stats, double *dk) { 193 194 double M = 0.0, MZ = 0.0, Z1 = 0.0, Z2 = 0.0, R = 0.0; 195 196 for (int i = 0; i < Npts; i++) { 197 double wt = 1.0 / (err[i]*err[i]); 198 double V = value[i]; 199 double Z = x[i]; 200 M += V * wt; 201 MZ += V*Z * wt; 202 Z1 += Z * wt; 203 Z2 += Z*Z * wt; 204 R += 1.0 * wt; 205 } 206 207 double DetInv = (R*Z2 - Z1*Z1); 208 double Det = (fabs(DetInv) < -1e6) ? 0.0 : 1.0 / DetInv; // do not allow unstable solutions 209 210 double zp = (M*Z2 - Z1*MZ)*Det; 211 *dk = (MZ*R - M*Z1)*Det; 212 213 stats->mean = zp; 214 stats->chisq = NAN; 215 return TRUE; 216 } 217 189 218 190 219 // These should probably be tunable: -
trunk/Ohana/src/relphot/src/load_images.c
r40291 r41390 110 110 MARKTIME("init images: %f sec\n", dtime); 111 111 112 initTGroups (subset, LineNumber, Nsubset); 113 112 114 return TRUE; 113 115 } -
trunk/Ohana/src/relphot/src/reload_catalogs.c
r41341 r41390 86 86 initImageBins (&catalog, 1, FALSE); 87 87 initMosaicBins (&catalog, 1, FALSE); 88 initTGroupBins (&catalog, 1); 89 88 90 initGridBins (&catalog, 1); 89 91 TIMESTAMP(time3b); … … 91 93 findImages (&catalog, 1, FALSE); 92 94 findMosaics (&catalog, 1, FALSE); 95 findTGroups (&catalog, 1); 96 93 97 TIMESTAMP(time4); 94 98 … … 117 121 TIMESTAMP(time6); 118 122 123 // XXX freeTgroupBins here: 124 119 125 freeImageBins (1, FALSE); 120 126 freeMosaicBins (1, FALSE); 127 freeTGroupBins (1); 121 128 freeGridBins (1); 122 129 TIMESTAMP(time7); -
trunk/Ohana/src/relphot/src/relphot_images.c
r40291 r41390 70 70 71 71 initMosaicBins (catalog, Ncatalog, TRUE); 72 initTGroupBins (catalog, Ncatalog); 73 72 74 initGridBins (catalog, Ncatalog); 73 75 initMrel (catalog, Ncatalog); … … 77 79 78 80 findMosaics (catalog, Ncatalog, TRUE); /* also sets Grid values */ 81 MARKTIME("-- set up mosaic indexes: %f sec\n", dtime); 82 83 findTGroups (catalog, Ncatalog); 79 84 MARKTIME("-- set up mosaic indexes: %f sec\n", dtime); 80 85 … … 129 134 130 135 setMmos (catalog, FALSE, flatcorr); 136 setMgrp (catalog, FALSE, flatcorr); 137 131 138 setMgrid (catalog, flatcorr); 132 139 MARKTIME("-- set Mrel, Mcal, Mmos, Mgrid : %f sec\n", dtime); … … 151 158 if ((i > 8) && (i % 8 == 3)) clean_stars (catalog, Ncatalog); 152 159 if ((i > 8) && (i % 8 == 5)) clean_mosaics (); 160 if ((i > 8) && (i % 8 == 5)) clean_tgroups (); 153 161 if ((i > 8) && (i % 8 == 5)) clean_images (); 154 162 … … 172 180 setMcal (catalog, onlyPoorImages, flatcorr); 173 181 setMmos (catalog, onlyPoorImages, flatcorr); 182 setMgrp (catalog, onlyPoorImages, flatcorr); 174 183 MARKTIME("-- finalize Mcal values: %f sec\n", dtime); 175 184 176 setMcalFinal (); // copy per-mosaic calibrations to the images 185 setMcalFromMosaics (); // copy per-mosaic calibrations to the images 186 setMcalFromTGroups (); // copy per-tgroup calibrations to the images 177 187 178 188 if (SAVE_IMAGE_UPDATES) { … … 249 259 freeImageBins (Ncatalog, TRUE); 250 260 freeMosaicBins (Ncatalog, TRUE); 261 freeTGroupBins (Ncatalog); 251 262 freeGridBins (Ncatalog); 252 263 … … 255 266 // If nloop == 0, the above pass is not performed, in which case 256 267 // the Mcal values passed to the mosaics are not returned to the images... 257 setMcalFinal (); // copy per-mosaic calibrations to the images 268 setMcalFromMosaics (); // copy per-mosaic calibrations to the images 269 setMcalFromTGroups (); // copy per-tgroup calibrations to the images 258 270 } 259 271 -
trunk/Ohana/src/relphot/src/relphot_parallel_images.c
r40291 r41390 116 116 setMcal (catalog, FALSE, flatcorr); 117 117 setMmos (catalog, FALSE, flatcorr); 118 // setMgrp (catalog, FALSE, flatcorr); XXX think this through: this may not make sense for tgroups 118 119 MARKTIME("-- set Mrel, Mcal, Mmos, Mgrid : %f sec\n", dtime); 119 120 … … 152 153 setMcal (catalog, onlyPoorImages, flatcorr); 153 154 setMmos (catalog, onlyPoorImages, flatcorr); 155 // setMgrp (catalog, onlyPoorImages, flatcorr); XXX see above 154 156 MARKTIME("-- finalize Mcal values: %f sec\n", dtime); 155 157 156 setMcalFinal (); // copy per-mosaic calibrations to the images 158 setMcalFromMosaics (); // copy per-mosaic calibrations to the images 159 // XXX keep? setMcalFromTGroups (); // copy per-tgroup calibrations to the images 157 160 158 161 share_image_mags (regionHosts, -1); -
trunk/Ohana/src/relphot/src/setMrelCatalog.c
r40373 r41390 221 221 222 222 // ** Choose the calibration (depends on the mode : do I have an image reference or not?) 223 float Mcal = 0.0, Mmos = 0.0, Mgrid = 0.0, Mflat = 0.0 ;223 float Mcal = 0.0, Mmos = 0.0, Mgrid = 0.0, Mflat = 0.0, Mgrp = 0.0; 224 224 off_t meas = measureOffset + k; 225 225 if (getImageEntry (meas, cat) < 0) { … … 235 235 Mmos = getMmos (meas, cat); 236 236 if (isnan(Mmos)) SKIP_THIS_MEAS(Nmos); 237 Mgrp = getMgrp (meas, cat, measureT[k].airmass); 238 if (isnan(Mgrp)) SKIP_THIS_MEAS(Ngrp); 237 239 Mgrid = getMgrid (meas, cat); 238 240 if (isnan(Mgrid)) SKIP_THIS_MEAS(Ngrid); … … 261 263 if (CHECK_VALID_MAG(Map, dMap)) { 262 264 int Nap = results->aperData[Nsec].Nlist; 263 results->aperData[Nsec].flxlist[Nap] = Map - Mflat - Mcal - Mmos - Mgr id; // this is consistent with PhotRel265 results->aperData[Nsec].flxlist[Nap] = Map - Mflat - Mcal - Mmos - Mgrp - Mgrid; // this is consistent with PhotRel 264 266 results->aperData[Nsec].errlist[Nap] = dMap; 265 267 results->aperData[Nsec].wgtlist[Nap] = useUbercalWeight ? UBERCAL_WEIGHT : 1.0; … … 281 283 if (CHECK_VALID_MAG(Mkron, dMkron)) { 282 284 int Nkron = results->kronData[Nsec].Nlist; 283 results->kronData[Nsec].flxlist[Nkron] = Mkron - Mflat - Mcal - Mmos - Mgr id; // this is consistent with PhotRel285 results->kronData[Nsec].flxlist[Nkron] = Mkron - Mflat - Mcal - Mmos - Mgrp - Mgrid; // this is consistent with PhotRel 284 286 results->kronData[Nsec].errlist[Nkron] = dMkron; 285 287 results->kronData[Nsec].wgtlist[Nkron] = isUbercal ? UBERCAL_WEIGHT : 1.0; … … 294 296 if (CHECK_VALID_MAG(Mpsf, dMpsf)) { 295 297 int Npsf = results->psfData[Nsec].Nlist; 296 results->psfData[Nsec].flxlist[Npsf] = Mpsf - Mflat - Mcal - Mmos - Mgr id; // this is consistent with PhotRel298 results->psfData[Nsec].flxlist[Npsf] = Mpsf - Mflat - Mcal - Mmos - Mgrp - Mgrid; // this is consistent with PhotRel 297 299 results->psfData[Nsec].errlist[Npsf] = dMpsf; 298 300 results->psfData[Nsec].wgtlist[Npsf] = isUbercal ? UBERCAL_WEIGHT : 1.0; … … 711 713 Mmos = getMmos (measSeq, cat); 712 714 Mgrid = getMgrid (measSeq, cat); 715 // XXX can Mmos and Mgrid exist for stacks? 713 716 } 714 717
Note:
See TracChangeset
for help on using the changeset viewer.
