IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41362


Ignore:
Timestamp:
May 22, 2020, 5:12:02 PM (6 years ago)
Author:
eugene
Message:

initial version with TGroups (for photometric nights)

Location:
branches/eam_branches/relphot.20200519
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/relphot.20200519/Makefile

    r39636 r41362  
    3232$(SRC)/BrightCatalog.$(ARCH).o   \
    3333$(SRC)/MosaicOps.$(ARCH).o       \
     34$(SRC)/TGroupOps.$(ARCH).o       \
     35$(SRC)/ReadTGroupFile.$(ARCH).o  \
    3436$(SRC)/SetSignals.$(ARCH).o      \
    3537$(SRC)/Shutdown.$(ARCH).o        \
     
    8991$(SRC)/BrightCatalog.$(ARCH).o   \
    9092$(SRC)/MosaicOps.$(ARCH).o       \
     93$(SRC)/TGroupOps.$(ARCH).o       \
     94$(SRC)/ReadTGroupFile.$(ARCH).o  \
    9195$(SRC)/SetSignals.$(ARCH).o      \
    9296$(SRC)/Shutdown.$(ARCH).o        \
  • branches/eam_branches/relphot.20200519/include/relphot.h

    r40386 r41362  
    9090} Mosaic;
    9191
     92typedef struct {
     93  unsigned int start;
     94  unsigned int stop;
     95  short photcode;
     96  float McalPSF;
     97  float McalAPER;
     98  float dMcal;
     99  float dMsys;
     100  float McalChiSq;
     101  unsigned short nFitPhotom;
     102  unsigned int flags;
     103
     104  off_t Nimage;
     105  off_t NIMAGE;
     106  off_t *image;
     107
     108  off_t Nmeasure;
     109  off_t NMEASURE;
     110  off_t *measure;
     111
     112  off_t Ncatalog;
     113  off_t NCATALOG;
     114  off_t *catalog;
     115} TGroup;
     116
    92117typedef enum {
    93118  STATS_NONE,
     
    145170  int Ncal;
    146171  int Nmos;
     172  int Ngrp;
    147173  int Ngrid;
    148174
     
    305331int    VERBOSE_IMAGE;
    306332int    MOSAIC_ZEROPT;
     333int    TGROUP_ZEROPT;
    307334
    308335int    TEST_IMAGE1;
     
    403430void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final, FlatCorrectionTable *flatcorr));
    404431void          clean_mosaics       PROTO((void));
     432void          clean_tgroups       PROTO((void));
    405433void          clean_stars         PROTO((Catalog *catalog, int Ncatalog));
    406434int           corner_check        PROTO((double *x1, double *y1, double *x2, double *y2));
     
    410438void          findImages          PROTO((Catalog *catalog, int Ncatalog, int doImageList));
    411439int           findMosaics         PROTO((Catalog *catalog, int Ncatalog, int doMosaicList));
     440int           findTGroups         PROTO((Catalog *catalog, int Ncatalog));
    412441
    413442void clearImages (void);
     
    428457void          freeImageBins       PROTO((int Ncatalog, int doImageList));
    429458void          freeMosaicBins      PROTO((int Ncatalog, int doMosaicList));
     459void          freeTGroupBins      PROTO((int Ncatalog, int doTGroupList));
     460
    430461void          free_catalogs       PROTO((Catalog *catalog, int Ncatalog));
    431462int           gcatalog            PROTO((Catalog *catalog, int FINAL));
     
    437468float         getMgrid            PROTO((off_t meas, int cat));
    438469float         getMmos             PROTO((off_t meas, int cat));
     470float         getMgrp             PROTO((off_t meas, int cat));
    439471float         getMrel             PROTO((Catalog *catalog, off_t meas, int cat, dvoMagClassType class, dvoMagSourceType source));
    440472short         getUbercalDist      PROTO((off_t meas, int cat));
     
    452484void          initMosaicGrid      PROTO((Image *image, off_t Nimage));
    453485void          initMosaics         PROTO((Image *subset, off_t Nsubset, Image *image, char *inSubset, off_t Nimage));
     486void          initTGroups         PROTO((Image *subset, off_t *LineNumber, off_t Nsubset));
     487void          initTGroupBins      PROTO((Catalog *catalog, int Ncatalog));
    454488void          initMrel            PROTO((Catalog *catalog, int Ncatalog));
    455489RelphotMode   initialize          PROTO((int argc, char **argv));
     
    460494int           liststats_irls      PROTO((StatDataSet *dataset, int Npoints, StatType *stats));
    461495
     496unsigned int *ReadTGroupFile      PROTO((FILE *f, int *nelem));
     497void          loadTGroups         PROTO((char *filename));
     498void          initTGroupsMcal     PROTO((void));
     499TGroup       *getTGroupForImage   PROTO((off_t im));
     500off_t         findTGroup          PROTO((unsigned int start, int photcode));
     501
    462502Catalog      *load_catalogs       PROTO((SkyList *skylist, int *Ncatalog, int hostID, char *hostpath, char *syncfile));
    463503Catalog      *load_catalogs_parallel PROTO((SkyList *sky, int *Ncatalog, char *syncfile));
     
    470510void          matchImage          PROTO((Catalog *catalog, off_t meas, int cat, int doImageList));
    471511void          matchMosaics        PROTO((Catalog *catalog, off_t meas, int cat, int doMosaicList));
     512void          matchTGroups        PROTO((Catalog *catalog, off_t meas, int cat));
     513
    472514double        opening_angle       PROTO((double x1, double y1, double x2, double y2, double x3, double y3));
    473515void          plot_chisq          PROTO((Catalog *catalog, int Ncatalog));
     
    491533int           setExclusions       PROTO((Catalog *catalog, int Ncatalog, int verbose));
    492534void          setMcal             PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr));
    493 void          setMcalFinal        PROTO((void));
     535void          setMcalFromMosaics  PROTO((void));
     536void          setMcalFromTGroups  PROTO((void));
    494537int           setMcalOutput       PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
    495538void          setMgrid            PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
    496539int           setMmos             PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr));
     540int           setMgrp             PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr));
    497541int           setMrel             PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
    498542void          setMrelFinal        PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr, int simpleAverage));
  • branches/eam_branches/relphot.20200519/src/MosaicOps.c

    r40291 r41362  
    720720}
    721721
    722 void setMcalFinal () {
     722void setMcalFromMosaics () {
    723723
    724724  off_t i, j, im, Nimage;
  • branches/eam_branches/relphot.20200519/src/StarOps.c

    r40291 r41362  
    105105  results->Ncal  = 0;
    106106  results->Nmos  = 0;
     107  results->Ngrp  = 0;
    107108  results->Ngrid = 0;
    108109}
     
    264265  summary->Ncal  += results->Ncal ;
    265266  summary->Nmos  += results->Nmos ;
     267  summary->Ngrp  += results->Ngrp ;
    266268  summary->Ngrid += results->Ngrid;
    267269}
     
    313315    SetMrelInfoAccum (&summary, &results);
    314316  }
    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, Ngrid: %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);
    316318
    317319  SetMrelInfoFree (&results);
     
    336338    SetMrelInfoAccum (&summary, &results);
    337339  }
    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, Ngrid: %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);
    339341
    340342  SetMrelInfoFree (&results);
     
    393395  // report stats & summary from the threads
    394396  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, Ngrid: %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",
    396398             i,
    397399             threadinfo[i].summary.Ncode,
     
    400402             threadinfo[i].summary.Ncal,
    401403             threadinfo[i].summary.Nmos,
     404             threadinfo[i].summary.Ngrp,
    402405             threadinfo[i].summary.Ngrid,
    403406             threadinfo[i].summary.Nsys);
     
    405408    SetMrelInfoFree (&threadinfo[i].summary);
    406409  }
    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, Ngrid: %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);
    408411  free (threadinfo);
    409412
     
    488491        float Mmos  = getMmos  (m, i);
    489492        if (isnan(Mmos)) continue;
     493        float Mgrp  = getMgrp  (m, i);
     494        if (isnan(Mgrp)) continue;
    490495        float Mgrid = getMgrid (m, i);
    491496        if (isnan(Mgrid)) continue;
     
    502507
    503508        // 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        catalog[i].measure[m].McalPSF  = McalPSF + Moff;
     511        catalog[i].measure[m].McalAPER = useStackAper ? McalAPER + Moff : McalPSF + Moff;
    506512
    507513        if (catalog[i].measureT[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
     
    662668  off_t *ilist;
    663669  double *tlist, *list, *dlist;
    664   float Msys, Mcal, Mmos, Mgrid;
    665   int Ncal, Nmos, Ngrid, Nfew;
     670  float Msys, Mcal, Mmos, Mgrp, Mgrid;
     671  int Ncal, Nmos, Ngrp, Ngrid, Nfew;
    666672
    667673  int Nsecfilt = GetPhotcodeNsecfilt ();
     
    689695
    690696  Ndel = Nave = 0;
    691   Ncal = Nmos = Ngrid = Nfew = 0;
     697  Ncal = Nmos = Ngrp = Ngrid = Nfew = 0;
    692698  for (i = 0; i < Ncatalog; i++) {
    693699    for (j = 0; j < catalog[i].Naverage; j++) {
     
    724730          Mmos  = getMmos  (m, i);
    725731          if (isnan(Mmos)) { Nmos ++; continue; }
     732          Mgrp  = getMgrp  (m, i);
     733          if (isnan(Mgrp)) { Ngrp ++; continue; }
    726734          Mgrid = getMgrid (m, i);
    727735          if (isnan(Mgrid)) { Ngrid ++; continue; }
  • branches/eam_branches/relphot.20200519/src/args.c

    r40386 r41362  
    315315      exit (2);
    316316    }
     317  }
     318
     319  // calibrate the photometry by night / time period
     320  TGROUP_ZEROPT = FALSE;
     321  if ((N = get_argument (argc, argv, "-tgroup"))) {
     322    TGROUP_ZEROPT = TRUE;
     323    remove_argument (N, &argc, argv);
     324    loadTGroups (argv[N]);
     325    remove_argument (N, &argc, argv);
    317326  }
    318327
  • branches/eam_branches/relphot.20200519/src/load_images.c

    r40291 r41362  
    110110  MARKTIME("init images: %f sec\n", dtime);
    111111
     112  initTGroups (subset, LineNumber, Nsubset);
     113
    112114  return TRUE;
    113115}
  • branches/eam_branches/relphot.20200519/src/relphot_images.c

    r40291 r41362  
    7070
    7171    initMosaicBins (catalog, Ncatalog, TRUE);
     72    initTGroupBins (catalog, Ncatalog);
     73
    7274    initGridBins   (catalog, Ncatalog);
    7375    initMrel (catalog, Ncatalog);
     
    7779
    7880    findMosaics (catalog, Ncatalog, TRUE);  /* also sets Grid values */
     81    MARKTIME("-- set up mosaic indexes: %f sec\n", dtime);
     82
     83    findTGroups (catalog, Ncatalog);  /* also sets Grid values */
    7984    MARKTIME("-- set up mosaic indexes: %f sec\n", dtime);
    8085
     
    129134
    130135      setMmos  (catalog, FALSE, flatcorr);
     136      setMgrp  (catalog, FALSE, flatcorr);
     137
    131138      setMgrid (catalog, flatcorr);
    132139      MARKTIME("-- set Mrel, Mcal, Mmos, Mgrid : %f sec\n", dtime);
     
    172179    setMcal  (catalog, onlyPoorImages, flatcorr);
    173180    setMmos  (catalog, onlyPoorImages, flatcorr);
     181    setMgrp  (catalog, onlyPoorImages, flatcorr);
    174182    MARKTIME("-- finalize Mcal values: %f sec\n", dtime);
    175183
    176     setMcalFinal (); // copy per-mosaic calibrations to the images
     184    setMcalFromMosaics (); // copy per-mosaic calibrations to the images
     185    setMcalFromTGroups (); // copy per-tgroup calibrations to the images
    177186
    178187    if (SAVE_IMAGE_UPDATES) {
     
    255264    // If nloop == 0, the above pass is not performed, in which case
    256265    // the Mcal values passed to the mosaics are not returned to the images...
    257     setMcalFinal (); // copy per-mosaic calibrations to the images
     266    setMcalFromMosaics (); // copy per-mosaic calibrations to the images
     267    setMcalFromTGroups (); // copy per-tgroup calibrations to the images
    258268  }
    259269
  • branches/eam_branches/relphot.20200519/src/relphot_parallel_images.c

    r40291 r41362  
    116116    setMcal  (catalog, FALSE, flatcorr);
    117117    setMmos  (catalog, FALSE, flatcorr);
     118    // setMgrp  (catalog, FALSE, flatcorr); XXX think this through: this may not make sense for tgroups
    118119    MARKTIME("-- set Mrel, Mcal, Mmos, Mgrid : %f sec\n", dtime);
    119120   
     
    152153  setMcal  (catalog, onlyPoorImages, flatcorr);
    153154  setMmos  (catalog, onlyPoorImages, flatcorr);
     155  // setMgrp  (catalog, onlyPoorImages, flatcorr); XXX see above
    154156  MARKTIME("-- finalize Mcal values: %f sec\n", dtime);
    155157
    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
    157160
    158161  share_image_mags (regionHosts, -1);
Note: See TracChangeset for help on using the changeset viewer.