IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41606


Ignore:
Timestamp:
May 21, 2021, 2:04:53 PM (5 years ago)
Author:
eugene
Message:

I have stripped out all flatcorr references : flat correction is applied by setphot

Location:
branches/eam_branches/relphot.20210521
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/relphot.20210521/include/relphot.h

    r41604 r41606  
    518518int           bcatalog            PROTO((Catalog *subcatalog, Catalog *catalog, int Ncat));
    519519void          clean_images        PROTO((void));
    520 void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final, FlatCorrectionTable *flatcorr));
     520void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final));
    521521void          clean_mosaics       PROTO((void));
    522522void          clean_tgroups       PROTO((void));
     
    555555
    556556float         getMcal             PROTO((off_t meas, int cat, dvoMagClassType class));
    557 float         getMflat            PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog));
     557float         getMflat            PROTO((off_t meas, int cat, Catalog *catalog));
    558558float         getMgridTiny        PROTO((MeasureTiny *measure));
    559559float         getMgrid            PROTO((Measure *measure));
     
    566566Image        *getimages           PROTO((off_t *N, off_t **LineNumber));
    567567ImageSubset  *getimages_subset    PROTO((off_t *N));
    568 void          global_stats        PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr, int nloop));
     568void          global_stats        PROTO((Catalog *catalog, int Ncatalog, int nloop));
    569569void          initGrid            PROTO(());
    570570void          initGridBins        PROTO(());
     
    621621void          plot_mosaic_fields  PROTO((Catalog *catalog));
    622622void          plot_mosaics        PROTO((void));
    623 void          plot_scatter        PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
     623void          plot_scatter        PROTO((Catalog *catalog, int Ncatalog));
    624624void          plot_star_coords    PROTO((Catalog *catalog, int Ncatalog));
    625625void          plot_stars          PROTO((Catalog *catalog, int Ncatalog));
     
    630630int           open_graph          PROTO((int N));
    631631
    632 void          reload_catalogs     PROTO((SkyList *skylist, FlatCorrectionTable *flatcorr, int hostID, char *hostpath));
     632void          reload_catalogs     PROTO((SkyList *skylist, int hostID, char *hostpath));
    633633int           reload_catalogs_parallel PROTO((SkyList *sky));
    634634int           reload_images       PROTO((FITS_DB *db));
     
    639639void          setMcalFromMosaics  PROTO((void));
    640640void          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));
     641int           setMcalOutput       PROTO((Catalog *catalog, int Ncatalog));
     642
     643void          setMcal             PROTO((Catalog *catalog));
     644int           setMmos             PROTO((Catalog *catalog));
     645int           setMgrp             PROTO((Catalog *catalog));
     646
     647int           setMrel             PROTO((Catalog *catalog, int Ncatalog));
     648void          setMrelFinal        PROTO((Catalog *catalog, int simpleAverage));
     649int           setMrelOutput       PROTO((Catalog *catalog, int Ncatalog));
     650
     651void          setMcalTest         PROTO((Catalog *catalog));
    652652
    653653int           setMave             PROTO((Catalog *catalog, int Ncatalog));
    654654void          set_ZP              PROTO((double ZERO));
    655655int           setrefcode          PROTO((Image *image, off_t Nimage));
    656 void          skip_measurements   PROTO((Catalog *catalog, int pass, FlatCorrectionTable *flatcorr));
     656void          skip_measurements   PROTO((Catalog *catalog, int pass));
    657657void          sortA               PROTO((double *X, int N));
    658658void          sortB               PROTO((double *X, double *Y, int N));
     
    660660void          sortD               PROTO((double *X, double *Y, double *Z, int N));
    661661StatType      statsImageM         PROTO((Catalog *catalog));
    662 StatType      statsImageN         PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
     662StatType      statsImageN         PROTO((Catalog *catalog));
    663663StatType      statsImageX         PROTO((Catalog *catalog));
    664664StatType      statsImagedM        PROTO((Catalog *catalog));
    665665StatType      statsMosaicM        PROTO((Catalog *catalog));
    666 StatType      statsMosaicN        PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
     666StatType      statsMosaicN        PROTO((Catalog *catalog));
    667667StatType      statsMosaicX        PROTO((Catalog *catalog));
    668668StatType      statsMosaicdM       PROTO((Catalog *catalog));
     
    671671StatType      statsTGroupdM       PROTO((Catalog *catalog));
    672672
    673 StatType      statsStarN          PROTO((Catalog *catalog, int Ncatalog, int Nsec, int seccode, FlatCorrectionTable *flatcorr));
     673StatType      statsStarN          PROTO((Catalog *catalog, int Ncatalog, int Nsec, int seccode));
    674674StatType      statsStarS          PROTO((Catalog *catalog, int Ncatalog, int Nsec));
    675675StatType      statsStarX          PROTO((Catalog *catalog, int Ncatalog, int Nsec));
     
    717717
    718718int 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);
     719int setMrel_catalog_alt (Catalog *catalog, int Nc, int isSetMrelFinal, SetMrelInfo *results, int Nsecfilt);
     720int setMrelAverageExposure (Catalog *catalog, int cat, off_t ave, int Nsecfilt, int isSetMrelFinal, SetMrelInfo *results);
     721int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt);
     722int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, SetMrelInfo *results);
    723723
    724724int setGlobalObjStats (Average *average, Measure *measure);
  • branches/eam_branches/relphot.20210521/src/BrightCatalog.c

    r40291 r41606  
    1212  myAssert (!strcmp(type, #TYPE), "wrong column type");
    1313
    14 // XXX double check the header extname values for each table
    15 // XXX make sure we free things as we can
    16 // XXX make sure we close files as we can
    17 // XXX handle free and close on error return as well
    1814BrightCatalog *BrightCatalogLoad(char *filename) {
    1915
     
    622618int BrightCatalogSplitFree (CatalogSplitter *catalogs) {
    623619
    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
    632621  free (catalogs->catIDs);
    633622  free (catalogs->NAVERAGE);
     
    652641    catIDmax = MAX(catIDmax, bcatalog->average[i].catID);
    653642  }
    654   // XXX validate the measure ID range here
    655643   
    656644  int maxIDold = catalogs->maxID;
     
    746734
    747735  // assign the measures to the corresponding catalog
    748   // XXX what about averef and related links?  Do I need them?
    749736  for (i = 0; i < bcatalog->Nmeasure; i++) {
    750737    int ID = bcatalog->measure[i].catID;
  • branches/eam_branches/relphot.20210521/src/ImageOps.c

    r41604 r41606  
    497497}
    498498
    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 
    512499Coords *getCoords (off_t meas, int cat) {
    513500
     
    520507
    521508/* determine Mcal values for all images */
    522 void setMcal (Catalog *catalog, FlatCorrectionTable *flatcorr) {
     509void setMcal (Catalog *catalog) {
    523510
    524511  off_t i, j, m, c, n;
     
    651638      // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
    652639
    653       float Mflat = getMflat (m, c, flatcorr, catalog);
     640      float Mflat = getMflat (m, c, catalog);
    654641
    655642      n = catalog[c].measureT[m].averef;
     
    773760
    774761/* 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) {
     762void setMcalTest (Catalog *catalog) {
    776763
    777764  off_t i, j, m, c, n;
     
    845832      // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
    846833
    847       float Mflat = getMflat (m, c, flatcorr, catalog);
     834      float Mflat = getMflat (m, c, catalog);
    848835
    849836      // get the PSF magnitude for thie measurement, with airmass slope applied
     
    10841071}
    10851072
    1086 StatType statsImageN (Catalog *catalog, FlatCorrectionTable *flatcorr) {
     1073StatType statsImageN (Catalog *catalog) {
    10871074
    10881075  off_t i, j, m, c, n, N;
  • branches/eam_branches/relphot.20210521/src/MagResidSave.c

    r41603 r41606  
    235235    // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
    236236
    237     // float Mflat = getMflat (m, c, flatcorr, catalog);
     237    float Mflat = getMflat (m, c, catalog);
    238238
    239239    // MrelPSF is the average magnitude for this star. 
     
    248248    if (isnan(MsysPSF)) continue;
    249249
    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;
    254251
    255252    // Mrel is the true average apparent magnitude of this star
  • branches/eam_branches/relphot.20210521/src/MosaicOps.c

    r41603 r41606  
    11# include "relphot.h"
    22off_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);
     3int save_test_mosaic_measures (FILE *fout, int Nmos, Catalog *catalog);
    44
    55// see discussion in ImagesOps.c re: IDX_T
     
    818818  Catalog *catalog;
    819819  Image *image;
    820   FlatCorrectionTable *flatcorr;
    821820  SetMmosInfo info;
    822821} ThreadInfo;
    823822
    824 int setMmos_mosaic (Mosaic *mosaic, off_t Nmos, Image *image, Catalog *catalog, SetMmosInfo *info, FlatCorrectionTable *flatcorr);
     823int setMmos_mosaic (Mosaic *mosaic, off_t Nmos, Image *image, Catalog *catalog, SetMmosInfo *info);
    825824void *setMmos_worker (void *data);
    826 int setMmos_threaded (Catalog *catalog, FlatCorrectionTable *flatcorr);
     825int setMmos_threaded (Catalog *catalog);
    827826
    828827void SetMmosInfoInit (SetMmosInfo *info, off_t Nmax, int allocLists) {
     
    890889}
    891890
    892 int setMmos (Catalog *catalog, FlatCorrectionTable *flatcorr) {
     891int setMmos (Catalog *catalog) {
    893892
    894893  off_t i, N, Nmax;
     
    903902  // so do not run setMmos in threaded mode if PLOTSTUFF is set
    904903  if (NTHREADS && !PLOTSTUFF) {
    905     int status = setMmos_threaded (catalog, flatcorr);
     904    int status = setMmos_threaded (catalog);
    906905    return status;
    907906  }
     
    923922
    924923  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);
    926925  }
    927926  SetMmosInfoFree (&info);
     
    940939 
    941940// '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) {
     941int setMmos_mosaic (Mosaic *myMosaic, off_t Nmos, Image *image, Catalog *catalog, SetMmosInfo *info) {
    943942
    944943  off_t j, NimageReal;
     
    10211020    snprintf (filename, 64, "test.%05d.%02d.dat", (int) Nmos, npass_output);
    10221021    fout = fopen (filename, "w");
    1023     save_test_mosaic_measures (fout, Nmos, catalog, flatcorr);
     1022    save_test_mosaic_measures (fout, Nmos, catalog);
    10241023    fclose (fout);
    10251024  }
     
    10721071    // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
    10731072
    1074     float Mflat = getMflat (m, c, flatcorr, catalog);
     1073    float Mflat = getMflat (m, c, catalog);
    10751074
    10761075    off_t n = catalog[c].measureT[m].averef;
     
    11871186}
    11881187 
    1189 int save_test_mosaic_measures (FILE *fout, int Nmos, Catalog *catalog, FlatCorrectionTable *flatcorr) {
     1188int save_test_mosaic_measures (FILE *fout, int Nmos, Catalog *catalog) {
    11901189
    11911190  int Nsecfilt = GetPhotcodeNsecfilt ();
     
    12011200    float Mgrid    = getMgridTiny (&catalog[c].measureT[m]);
    12021201    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);
    12041203
    12051204    off_t n = catalog[c].measureT[m].averef;
     
    12151214}
    12161215
    1217 int setMmos_threaded (Catalog *catalog, FlatCorrectionTable *flatcorr) {
     1216int setMmos_threaded (Catalog *catalog) {
    12181217
    12191218  int i;
     
    12521251    threadinfo[i].catalog  =  catalog;
    12531252    threadinfo[i].image    =    image;
    1254     threadinfo[i].flatcorr = flatcorr;
    12551253
    12561254    // we do NOT allocate the arrays here, we only supply basic info (Nmax, Nloop) used in
     
    13211319
    13221320    Catalog *catalog = threadinfo->catalog;
    1323     FlatCorrectionTable *flatcorr = threadinfo->flatcorr;
    13241321    Image *image = threadinfo->image;
    13251322
    1326     setMmos_mosaic (&mosaic[i], i, image, catalog, &results, flatcorr);
     1323    setMmos_mosaic (&mosaic[i], i, image, catalog, &results);
    13271324    SetMmosInfoAccum (&threadinfo->info, &results);
    13281325  }
     
    15991596}
    16001597
    1601 StatType statsMosaicN (Catalog *catalog, FlatCorrectionTable *flatcorr) {
     1598StatType statsMosaicN (Catalog *catalog) {
    16021599
    16031600  off_t i, j, m, c, n, N;
  • branches/eam_branches/relphot.20210521/src/StarOps.c

    r41603 r41606  
    88  Catalog *catalog;
    99  int Ncatalog;
    10   FlatCorrectionTable *flatcorr;
    1110  SetMrelInfo summary;
    1211} ThreadInfo;
     
    1413// ** internal functions:
    1514void *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);
     15int setMrel_threaded (Catalog *catalog, int Ncatalog);
     16int setMrel_catalog (Catalog *catalog, int Nc, int pass, SetMrelInfo *results, int Nsecfilt);
    1817int print_measure_set (Average *average, SecFilt *secfilt, Measure *measure);
    1918
     
    298297// * setMrelOutput updates average EXT flags (PS1 and 2MASS)
    299298
    300 int setMrel (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
     299int setMrel (Catalog *catalog, int Ncatalog) {
    301300
    302301  int i;
    303302
    304303  if (NTHREADS) {
    305     int status = setMrel_threaded (catalog, Ncatalog, flatcorr);
     304    int status = setMrel_threaded (catalog, Ncatalog);
    306305    return status;
    307306  }
     
    314313
    315314  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);
    317316    SetMrelInfoAccum (&summary, &results);
    318317  }
     
    326325
    327326// setMrelOutput is NOT threaded because we read/write catalogs one at a time (for now)
    328 int setMrelOutput (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
     327int setMrelOutput (Catalog *catalog, int Ncatalog) {
    329328
    330329  int i;
     
    337336
    338337  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);
    340339    SetMrelInfoAccum (&summary, &results);
    341340  }
     
    347346}
    348347
    349 int setMrel_threaded (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
     348int setMrel_threaded (Catalog *catalog, int Ncatalog) {
    350349
    351350  int i;
     
    374373    threadinfo[i].catalog  =  catalog;
    375374    threadinfo[i].Ncatalog = Ncatalog;
    376     threadinfo[i].flatcorr = flatcorr;
    377375    SetMrelInfoInit (&threadinfo[i].summary, FALSE);
    378376    pthread_create (&threads[i], NULL, setMrel_worker, &threadinfo[i]);
     
    435433
    436434    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);
    440437    SetMrelInfoAccum (&threadinfo->summary, &results);
    441438  }
     
    474471
    475472/* set measure.Mcal for all measures except ID_MEAS_NOCAL and ID_IMAGE_PHOTOM_NOCAL */
    476 int setMcalOutput (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
     473int setMcalOutput (Catalog *catalog, int Ncatalog) {
    477474
    478475  int i;
     
    667664# define NSIGMA_CLIP 3.0
    668665# define NSIGMA_REJECT 5.0
    669 void clean_measures (Catalog *catalog, int Ncatalog, int final, FlatCorrectionTable *flatcorr) {
     666void clean_measures (Catalog *catalog, int Ncatalog, int final) {
    670667
    671668  off_t j, k, m, Nmax, Ndel, Nave;
     
    833830}
    834831
    835 StatType statsStarN (Catalog *catalog, int Ncatalog, int Nsec, int seccode, FlatCorrectionTable *flatcorr) {
     832StatType statsStarN (Catalog *catalog, int Ncatalog, int Nsec, int seccode) {
    836833
    837834  off_t j, k, m, Ntot;
     
    11061103      float MrelPSF  = getMrel  (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); // average magnitude
    11071104      // float Mgrid    = getMgridTiny (&catalog[c].measureT[m]);                    // camera offset (deprecated?)
    1108       // float Mflat    = getMflat (m, c, flatcorr, catalog); // flat-field correction
     1105      // float Mflat    = getMflat (m, c, catalog); // flat-field correction
    11091106
    11101107      off_t n = catalog[c].measureT[m].averef;
     
    11211118  fclose (fout);
    11221119}
     1120
     1121// maybe make this a macro
     1122float 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  
    22
    33void assignMosaicsToTGroups (void);
    4 int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog, FlatCorrectionTable *flatcorr);
     4int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog);
    55
    66// tgroupTimes carries the times of the tgroups (initially, just the photometric nights)
     
    647647  Catalog *catalog;
    648648  Image *image;
    649   FlatCorrectionTable *flatcorr;
    650649  SetMgrpInfo info;
    651650} ThreadInfo;
    652651
    653 int   setMgrp_tgroup (TGroup *tgroup, off_t Nmos, Image *image, Catalog *catalog, SetMgrpInfo *info, FlatCorrectionTable *flatcorr);
     652int   setMgrp_tgroup (TGroup *tgroup, off_t Nmos, Image *image, Catalog *catalog, SetMgrpInfo *info);
    654653void *setMgrp_worker (void *data);
    655 int   setMgrp_threaded (Catalog *catalog, FlatCorrectionTable *flatcorr);
     654int   setMgrp_threaded (Catalog *catalog);
    656655
    657656void SetMgrpInfoInit (SetMgrpInfo *info, off_t Nmax, int allocLists) {
     
    727726}
    728727
    729 int setMgrp (Catalog *catalog, FlatCorrectionTable *flatcorr) {
     728int setMgrp (Catalog *catalog) {
    730729
    731730  off_t N;
     
    738737  // so do not run setMgrp in threaded mode if PLOTSTUFF is set
    739738  if (NTHREADS && !PLOTSTUFF) {
    740     int status = setMgrp_threaded (catalog, flatcorr);
     739    int status = setMgrp_threaded (catalog);
    741740    return status;
    742741  }
     
    758757    TGroup *tgroup = tgroupTimes[i][0].byCode;
    759758    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);
    761760      // 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",
    762761      // 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);
     
    781780
    782781// '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) {
     782int setMgrp_tgroup (TGroup *myTGroup, off_t Ngrp, Image *image, Catalog *catalog, SetMgrpInfo *info) {
    784783
    785784  off_t j;
     
    826825    fout = fopen (filename, "w");
    827826    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);
    829828    fclose (fout);
    830829  }
     
    877876    // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
    878877
    879     float Mflat = getMflat (m, c, flatcorr, catalog);
     878    float Mflat = getMflat (m, c, catalog);
    880879
    881880    off_t n = catalog[c].measureT[m].averef;
     
    1000999}
    10011000 
    1002 int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog, FlatCorrectionTable *flatcorr) {
     1001int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog) {
    10031002
    10041003  int Nsecfilt = GetPhotcodeNsecfilt ();
     
    10151014    float Mgrid    = getMgridTiny (&catalog[c].measureT[m]);                    // camera offset (deprecated?)
    10161015    float MrelPSF  = getMrel  (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); // average magnitude
    1017     float Mflat    = getMflat (m, c, flatcorr, catalog); // flat-field correction
     1016    float Mflat    = getMflat (m, c, catalog); // flat-field correction
    10181017
    10191018    off_t n = catalog[c].measureT[m].averef;
     
    10371036}
    10381037
    1039 int setMgrp_threaded (Catalog *catalog, FlatCorrectionTable *flatcorr) {
     1038int setMgrp_threaded (Catalog *catalog) {
    10401039
    10411040  int i;
     
    10751074    threadinfo[i].catalog  =  catalog;
    10761075    threadinfo[i].image    =    image;
    1077     threadinfo[i].flatcorr = flatcorr;
    10781076
    10791077    // we do NOT allocate the arrays here, we only supply basic info used in the threads
     
    11471145
    11481146    Catalog *catalog = threadinfo->catalog;
    1149     FlatCorrectionTable *flatcorr = threadinfo->flatcorr;
    11501147    Image *image = threadinfo->image;
    11511148
    11521149    TGroup *tgroup = tgroupTimes[i][0].byCode;
    11531150    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);
    11551152      SetMgrpInfoAccum (&threadinfo->info, &results);
    11561153    }
     
    15061503        float MrelPSF  = getMrel  (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); // average magnitude
    15071504        // float Mgrid    = getMgridTiny (&catalog[c].measureT[m]); // camera offset (deprecated?)
    1508         // float Mflat    = getMflat (m, c, flatcorr, catalog); // flat-field correction
     1505        // float Mflat    = getMflat (m, c, catalog); // flat-field correction
    15091506
    15101507        off_t n = catalog[c].measureT[m].averef;
  • branches/eam_branches/relphot.20210521/src/global_stats.c

    r41462 r41606  
    11# include "relphot.h"
    22
    3 void global_stats (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr, int nloop) {
     3void global_stats (Catalog *catalog, int Ncatalog, int nloop) {
    44
    55  StatType stN, stX, stS, imN, imX, imM, imD, msM, msX, msN, msD, tgM, tgX, tgD;
     
    3333    int seccode = photcodes[Ns][0].code;
    3434
    35     stN = statsStarN (catalog, Ncatalog, Nsec, seccode, flatcorr);
     35    stN = statsStarN (catalog, Ncatalog, Nsec, seccode);
    3636    stX = statsStarX (catalog, Ncatalog, Nsec);
    3737    stS = statsStarS (catalog, Ncatalog, Nsec);
     
    4343  }
    4444 
    45   imN = statsImageN (catalog, flatcorr);
     45  imN = statsImageN (catalog);
    4646  imX = statsImageX (catalog);
    4747  imM = statsImageM (catalog);
    4848  imD = statsImagedM (catalog);
    4949 
    50   msN = statsMosaicN (catalog, flatcorr);
     50  msN = statsMosaicN (catalog);
    5151  msM = statsMosaicM (catalog);
    5252  msD = statsMosaicdM (catalog);
     
    5858 
    5959  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);
    6161  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);
    6262  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);
    6363
    6464  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);
    6666  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);
    6767  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  
    11# include "relphot.h"
    22   
    3 void plot_scatter (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
     3void plot_scatter (Catalog *catalog, int Ncatalog) {
    44
    55  off_t i, j, k, m, N, Ntot;
  • branches/eam_branches/relphot.20210521/src/reload_catalogs.c

    r41605 r41606  
    99    gettimeofday (&start, (void *) NULL);
    1010
    11 void reload_catalogs (SkyList *skylist, FlatCorrectionTable *flatcorr, int hostID, char *hostpath) {
     11void reload_catalogs (SkyList *skylist, int hostID, char *hostpath) {
    1212
    1313  int i;
     
    100100
    101101    initMrel (&catalog, 1);
    102     setMrelFinal (&catalog, flatcorr, FALSE);
     102    setMrelFinal (&catalog, FALSE);
    103103    TIMESTAMP(time5);
    104104
  • branches/eam_branches/relphot.20210521/src/relphot.c

    r41605 r41606  
    7272        exit (2);
    7373      }
    74       reload_catalogs (skylist, NULL, 0, NULL);
     74      reload_catalogs (skylist, 0, NULL);
    7575      relphot_free (sky, skylist);
    7676      exit (0);
  • branches/eam_branches/relphot.20210521/src/relphot_client.c

    r39643 r41606  
    8080      initImagesSubset (image, NULL, Nimage);
    8181
    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);
    8583      freeImages ((char *)image);
    8684      free (image);
  • branches/eam_branches/relphot.20210521/src/relphot_images.c

    r41604 r41606  
    4545  if (!UPDATE) dvo_image_unlock (&db);
    4646
    47   FlatCorrectionTable *flatcorr = NULL; // no longer used here
    48 
    4947  initGridBins (); // allocates the empty array of corrections (elements are build below)
    5048
     
    8078    setExclusions (catalog, Ncatalog, TRUE);
    8179
    82     global_stats (catalog, Ncatalog, flatcorr, 0);
     80    global_stats (catalog, Ncatalog, 0);
    8381
    8482    if (PLOTSTUFF) {
     
    9189      SetZptIteration (i);
    9290
    93       setMrel  (catalog, Ncatalog, flatcorr); // threaded
     91      setMrel  (catalog, Ncatalog); // threaded
    9492
    95       setMcal  (catalog, flatcorr);
    96       setMmos  (catalog, flatcorr);
    97       setMgrp  (catalog, flatcorr);
     93      setMcal  (catalog);
     94      setMmos  (catalog);
     95      setMgrp  (catalog);
    9896
    9997      setMgrid (catalog, Ncatalog);
     
    10199   
    102100      if (PLOTSTUFF) {
    103         plot_scatter (catalog, Ncatalog, flatcorr);
     101        plot_scatter (catalog, Ncatalog);
    104102        plot_mosaics ();
    105103        plot_images ();
     
    108106      }
    109107
    110       global_stats (catalog, Ncatalog, flatcorr, i);
     108      global_stats (catalog, Ncatalog, i);
    111109      SetZeroPointModes ();
    112110
     
    116114
    117115    if (PLOTSTUFF) {
    118       plot_scatter (catalog, Ncatalog, flatcorr);
     116      plot_scatter (catalog, Ncatalog);
    119117      plot_mosaics ();
    120118      plot_images ();
     
    162160     clients */
    163161  if (!CALIBRATE_STACKS_AND_WARPS) {
    164     reload_catalogs (skylist, flatcorr, 0, NULL);
     162    reload_catalogs (skylist, 0, NULL);
    165163    MARKTIME("-- updated all catalogs: %f sec\n", dtime);
    166164  }
  • branches/eam_branches/relphot.20210521/src/relphot_objects.c

    r41605 r41606  
    126126
    127127    initMrel (&catalog, 1);
    128     setMrelFinal (&catalog, NULL, TRUE);
     128    setMrelFinal (&catalog, TRUE);
    129129
    130130    // uncomment for extra verbosity
  • branches/eam_branches/relphot.20210521/src/relphot_parallel_images.c

    r41603 r41606  
    4040  initImages (image, NULL, Nimage);
    4141
    42   // load the flat correction table (if defined)
    43   // we no longer need to do this: the flatcorrection is now saved in measure.Mflat
    44 # if (0)
    45   char flatcorrfile[256];
    46   sprintf (flatcorrfile, "%s/flatcorr.fits", CATDIR);
    47   FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrfile, VERBOSE);
    48 # endif
    49   FlatCorrectionTable *flatcorr = NULL;
    50 
    5142  // UserPatch.Rmin,Rmax may have range from a few degrees < 0.0 to few degrees > 360.0.
    5243  // the following function correctly chooses the sky regions on the 0,360 boundary
     
    8879  setExclusions (catalog, Ncatalog, TRUE);
    8980
    90   global_stats (catalog, Ncatalog, flatcorr, 0);
     81  global_stats (catalog, Ncatalog, 0);
    9182
    9283  if (PLOTSTUFF) {
     
    10192
    10293    // set the mean stellar mags given the measurements and the image calibrations
    103     setMrel  (catalog, Ncatalog, flatcorr);
     94    setMrel  (catalog, Ncatalog);
    10495
    10596    // share mean mags for objects at the boundary (number of unowned meas > 0)
     
    112103
    113104    // 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 tgroups
     105    setMcal  (catalog);
     106    setMmos  (catalog);
     107    // setMgrp  (catalog, FALSE); XXX think this through: this may not make sense for tgroups
    117108    MARKTIME("-- set Mrel, Mcal, Mmos, Mgrid : %f sec\n", dtime);
    118109   
     
    124115    client_logger_message ("slurped image data : loop %d \n", i);
    125116
    126     global_stats (catalog, Ncatalog, flatcorr, i);
     117    global_stats (catalog, Ncatalog, i);
    127118
    128119    SetZeroPointModes ();
  • branches/eam_branches/relphot.20210521/src/relphot_parallel_regions.c

    r41556 r41606  
    1414    exit (2);
    1515  }
    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 # endif
    23   FlatCorrectionTable *flatcorr = NULL;
    2416
    2517  // register database handle with shutdown procedure
     
    8173
    8274  /* update catalogs (in parallel) */
    83   reload_catalogs (skylist, flatcorr, 0, NULL);
     75  reload_catalogs (skylist, 0, NULL);
    8476
    8577  // save the changes to the image parameters
  • branches/eam_branches/relphot.20210521/src/setMrelCatalog.c

    r41603 r41606  
    6060int useOLS = TRUE; // chosen based on iteration below
    6161
    62 int setMrel_catalog_alt (Catalog *catalog, int Nc, int isSetMrelFinal, FlatCorrectionTable *flatcorr, SetMrelInfo *results, int Nsecfilt) {
     62int setMrel_catalog_alt (Catalog *catalog, int Nc, int isSetMrelFinal, SetMrelInfo *results, int Nsecfilt) {
    6363
    6464  off_t j;
     
    7575
    7676    if (STAGES & STAGE_CHIP) {
    77       setMrelAverageExposure (&catalog[Nc], Nc, j, Nsecfilt, isSetMrelFinal, flatcorr, results);
     77      setMrelAverageExposure (&catalog[Nc], Nc, j, Nsecfilt, isSetMrelFinal, results);
    7878    }
    7979
    8080    // only apply Stack operation on setMrelFinal in first pass
    8181    if (isSetMrelFinal && (STAGES & STAGE_STACK) && !IS_DIFF_DB) {
    82       setMrelAverageStack (&catalog[Nc], Nc, j, Nsecfilt, flatcorr);
     82      setMrelAverageStack (&catalog[Nc], Nc, j, Nsecfilt);
    8383    }
    8484
    8585    // only measure force-warp mean values if issetMrelFinal (make it optional?)
    8686    if (isSetMrelFinal && (STAGES & STAGE_WARP)) {
    87       setMrelAverageForcedWarp (&catalog[Nc], Nc, j, Nsecfilt, flatcorr, results);
     87      setMrelAverageForcedWarp (&catalog[Nc], Nc, j, Nsecfilt, results);
    8888    }
    8989  }
     
    113113
    114114// 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) {
     115int setMrelAverageExposure (Catalog *catalog, int cat, off_t ave, int Nsecfilt, int isSetMrelFinal, SetMrelInfo *results) {
    116116
    117117  int Nsec;
     
    270270
    271271    // XXX I am not convinced the sign on Mflat here is correct
    272     float Moff =  Mflat + Mcal + Mmos + Mgrp + Mgrid;
     272    float Moff =  Mcal + Mmos + Mgrp + Mgrid - Mflat;
    273273
    274274    if (isSetMrelFinal) {
     
    552552// measure->McalAPER to image->McalPSF for chips and warps, but not stacks
    553553
    554 int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr) {
     554int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt) {
    555555
    556556  // we are guaranteed to have average, measure, secfilt
     
    884884// chips and warps, but not stacks
    885885
    886 int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr, SetMrelInfo *results) {
    887   OHANA_UNUSED_PARAM(flatcorr);
     886int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, SetMrelInfo *results) {
    888887
    889888  // we are guaranteed to have average, measure, secfilt
  • branches/eam_branches/relphot.20210521/src/setMrelFinal.c

    r40291 r41606  
    55// output dbFlags values
    66
    7 void setMrelFinal (Catalog *catalog, FlatCorrectionTable *flatcorr, int simpleAverage) {
     7void setMrelFinal (Catalog *catalog, int simpleAverage) {
    88
    99  off_t i;
     
    103103  // XXX make this optional? (do not clean for -averages?)
    104104  // 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 */
    106106
    107107  ALLOCATE (catalog[0].measureRank, char, catalog[0].Nmeasure);
    108108  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.Mcal
     109  setMrelOutput (catalog, 1); // sets the values secfilt.MpsfChp = <measure.M + measure.Mflat - image.Mcal>
     110  setMcalOutput (catalog, 1); // sets measure.Mcal = image.Mcal
    111111
    112112  /* clear ID_OBJ_POOR, ID_OBJ_FEW values before writing ??? */
     
    163163int print_measure_set (Average *average, SecFilt *secfilt, Measure *measure);
    164164
    165 void skip_measurements (Catalog *catalog, int pass, FlatCorrectionTable *flatcorr) {
     165void skip_measurements (Catalog *catalog, int pass) {
    166166
    167167  off_t i, k, m;
Note: See TracChangeset for help on using the changeset viewer.