IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 5, 2017, 6:04:35 AM (9 years ago)
Author:
eugene
Message:

split measure->Mcal into McalPSF and McalAPER

Location:
branches/eam_branches/ohana.20170822/src/relphot/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20170822/src/relphot/src/BrightCatalog.c

    r40212 r40244  
    6666    GET_COLUMN(D,         "DEC",        double);
    6767    GET_COLUMN(M,         "MAG_SYS",    float);
    68     GET_COLUMN(Mcal,      "MAG_CAL",    float);
     68    GET_COLUMN(McalPSF,   "MCAL_PSF",   float);
     69    GET_COLUMN(McalAPER,  "MCAL_APER",  float);
    6970    GET_COLUMN(Mflat,     "MAG_FLAT",   float);
    7071    GET_COLUMN(dM,        "MAG_ERR",    float);
     
    8990      measure[i].D         = D[i];
    9091      measure[i].M         = M[i];
    91       measure[i].Mcal      = Mcal[i];
     92      measure[i].McalPSF   = McalPSF[i];
     93      measure[i].McalAPER  = McalAPER[i];
    9294      measure[i].Mflat     = Mflat[i];
    9395      measure[i].dM        = dM[i];
     
    110112    free (D       );
    111113    free (M       );
    112     free (Mcal    );
     114    free (McalPSF );
     115    free (McalAPER);
    113116    free (Mflat   );
    114117    free (dM      );
     
    293296    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
    294297    float  *M         ; ALLOCATE (M        ,  float,  catalog->Nmeasure);
    295     float  *Mcal      ; ALLOCATE (Mcal     ,  float,  catalog->Nmeasure);
     298    float  *McalPSF   ; ALLOCATE (McalPSF  ,  float,  catalog->Nmeasure);
     299    float  *McalAPER  ; ALLOCATE (McalAPER ,  float,  catalog->Nmeasure);
    296300    float  *Mflat     ; ALLOCATE (Mflat    ,  float,  catalog->Nmeasure);
    297301    float  *dM        ; ALLOCATE (dM       ,  float,  catalog->Nmeasure);
     
    311315    MeasureTiny *measure = catalog->measure;
    312316    for (i = 0; i < catalog->Nmeasure; i++) {
    313       R[i]        = measure[i].R       ;
    314       D[i]        = measure[i].D       ;
     317      R[i]        = measure[i].R        ;
     318      D[i]        = measure[i].D        ;
    315319      M[i]        = measure[i].M        ;
    316       Mcal[i]     = measure[i].Mcal     ;
     320      McalPSF[i]  = measure[i].McalPSF  ;
     321      McalAPER[i] = measure[i].McalAPER ;
    317322      Mflat[i]    = measure[i].Mflat    ;
    318323      dM[i]       = measure[i].dM       ;
     
    334339    gfits_set_bintable_column (&theader, &ftable, "DEC",        D,         catalog->Nmeasure);
    335340    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    336     gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     341    gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF",   McalPSF,   catalog->Nmeasure);
     342    gfits_set_bintable_column (&theader, &ftable, "MCAL_APER",  McalAPER,  catalog->Nmeasure);
    337343    gfits_set_bintable_column (&theader, &ftable, "MAG_FLAT",   Mflat,     catalog->Nmeasure);
    338344    gfits_set_bintable_column (&theader, &ftable, "MAG_ERR",    dM,        catalog->Nmeasure);
     
    352358    free (D       );
    353359    free (M       );
    354     free (Mcal    );
     360    free (McalPSF );
     361    free (McalAPER);
    355362    free (Mflat   );
    356363    free (dM      );
  • branches/eam_branches/ohana.20170822/src/relphot/src/StarOps.c

    r40231 r40244  
    473473  int i;
    474474  off_t j, k, m;
    475   float Mcal, Mmos, Mgrid;
    476475
    477476  MEAS_BAD = ID_MEAS_NOCAL;
     
    484483      for (k = 0; k < catalog[i].averageT[j].Nmeasure; k++, m++) {
    485484        if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue;
    486         Mcal  = getMcal  (m, i, MAG_CLASS_PSF);
    487         if (isnan(Mcal)) continue;
    488         Mmos  = getMmos  (m, i);
     485        float McalPSF  = getMcal  (m, i, MAG_CLASS_PSF);
     486        float McalAPER = getMcal  (m, i, MAG_CLASS_APER);
     487        if (isnan(McalPSF)) continue;
     488        float Mmos  = getMmos  (m, i);
    489489        if (isnan(Mmos)) continue;
    490         Mgrid = getMgrid (m, i);
     490        float Mgrid = getMgrid (m, i);
    491491        if (isnan(Mgrid)) continue;
     492
     493        // XXX note that this operation is setting measure->McalAPER to image->McalAPER
     494        // regardless of how the average value was calculate.
     495        // IF average.Mkron (e.g.) is calculated using image.McalPSF, we should store McalPSF for both
     496        // of these items below
    492497
    493498        // note that measurements for which the image is not selected will not be modified
     
    495500
    496501        // set the output calibration
    497         catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid;
     502        catalog[i].measure[m].McalPSF  = McalPSF  + Mmos + Mgrid;
     503        catalog[i].measure[m].McalAPER = McalAPER + Mmos + Mgrid;
    498504
    499505        if (catalog[i].measureT[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
    500           myAssert (isfinite(catalog[i].measure[m].Mcal), "oops, broke an ubercal mag");
     506          myAssert (isfinite(catalog[i].measure[m].McalPSF), "oops, broke an ubercal mag");
    501507        }
    502508      }
     
    560566      int m = catalog[i].averageT[j].measureOffset;
    561567      for (n = 0; n < catalog[i].averageT[j].Nmeasure; n++) {
    562         fprintf (fout, "meas %5d %5d | %6.3f %6.3f | %6.3f\n", m+n, catalog[i].measureT[m+n].photcode, catalog[i].measureT[m+n].M, catalog[i].measureT[m+n].Mkron, catalog[i].measureT[m+n].Mcal);
     568        fprintf (fout, "meas %5d %5d | %6.3f %6.3f | %6.3f %6.3f\n", m+n, catalog[i].measureT[m+n].photcode, catalog[i].measureT[m+n].M, catalog[i].measureT[m+n].Mkron, catalog[i].measureT[m+n].McalPSF, catalog[i].measureT[m+n].McalAPER);
    563569      }
    564570    }
     
    643649// sigma of the INNER 50% mean.  it then flags any measurements which are more than
    644650// NSIGMA_REJECT (5) sigma of the mean
     651
     652// this function only operations on the PSF magnitudes
    645653
    646654# define NSIGMA_CLIP 3.0
  • branches/eam_branches/ohana.20170822/src/relphot/src/bcatalog.c

    r39641 r40244  
    153153        if (subcatalog[0].measureT[Nmeasure].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
    154154          if (!KEEP_UBERCAL) {
    155             subcatalog[0].measureT[Nmeasure].Mcal = 0.0;
     155            subcatalog[0].measureT[Nmeasure].McalPSF  = 0.0;
     156            subcatalog[0].measureT[Nmeasure].McalAPER = 0.0;
    156157            subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
    157158          }
    158159        } else {
    159160          if (getImageEntry (Nmeasure, Ncat) >= 0) {
    160             subcatalog[0].measureT[Nmeasure].Mcal = 0.0;
     161            subcatalog[0].measureT[Nmeasure].McalPSF  = 0.0;
     162            subcatalog[0].measureT[Nmeasure].McalAPER = 0.0;
    161163          }
    162164        }
  • branches/eam_branches/ohana.20170822/src/relphot/src/setMrelCatalog.c

    r40231 r40244  
    102102// 3) UBERCAL measurements can have their weight increased by a big factor to help tie down the averages
    103103// 4) some reference photcode of some kind can be specified as fixed and have a high weight
     104
     105// Although I calculate McalAPER for exposures, I am only using McalPSF for exposures
     106// XXX this means that a query of the database for mag:rel:kron will be inconsistent if there
     107// is any significant difference
    104108
    105109// set mean of chip measurements (selected by photcode range for now):
     
    224228      // overlaps).  Msys + measure.Mcal is our best guess of the true magnitude
    225229      Mmos = Mgrid = 0;
    226       Mcal = measureT[k].Mcal; // check that this is zero for loaded REF value
     230      Mcal = measureT[k].McalPSF; // check that this is zero for loaded REF value
    227231    } else {
    228232      // getMcal returns image[].Mcal; note the flat-field correction is stored in measure.Mflat
     
    521525// 2) select the BEST detections per filter (regardless of PRIMARY)
    522526// 3) apply the zero point and AB->Jy transformations
     527
     528// I calculate McalAPER and McalPSF independently for stacks.  I use McalAPER for Mkron
     529// and Map, and McalPSF for Mpsf.  A query of the database for mag:rel:kron will be
     530// inconsistent if there is any significant difference
     531
    523532int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr) {
    524533
     
    633642        // overlaps).  Msys + measure.Mcal is our best guess of the true magnitude
    634643        Mmos = Mgrid = 0;
    635         McalPSF = measure[k].Mcal; // check that this is zero for loaded REF value
     644        McalPSF = measure[k].McalPSF; // check that this is zero for loaded REF value
    636645        McalAPER = McalPSF; // check that this is zero for loaded REF value
    637646      } else {
     
    791800// * no grid, no mosaic, no 2MASS, no SYNTH, no Ubercal, no flatcorr
    792801// analysis is done on flux, not mags (as the faintest objects will be nearly insignificant)
     802
     803// Although I calculate McalAPER for exposures, I am only using McalPSF for exposures
     804// XXX this means that a query of the database for mag:rel:kron will be inconsistent if there
     805// is any significant difference
     806
    793807int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr, SetMrelInfo *results) {
    794808  OHANA_UNUSED_PARAM(flatcorr);
     
    868882      // data for which the associated image has not been loaded (probably because of
    869883      // overlaps).  Msys + measure.Mcal is our best guess of the true magnitude
    870       Mcal = measure[k].Mcal; // check that this is zero for loaded REF value
     884      Mcal = measure[k].McalPSF; // check that this is zero for loaded REF value
    871885    } else {
    872886      Mcal  = getMcal (meas, cat, MAG_CLASS_PSF);
  • branches/eam_branches/ohana.20170822/src/relphot/src/setMrelFinal.c

    r40213 r40244  
    6565          if (catalog[0].measure[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
    6666            if (!KEEP_UBERCAL) {
    67               catalog[0].measure[m].Mcal = 0.0;
     67              catalog[0].measure[m].McalPSF  = 0.0;
     68              catalog[0].measure[m].McalAPER = 0.0;
    6869              catalog[0].measure[m].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
    6970            }
    7071          } else {
    7172            if (RESET_ZEROPTS && (getImageEntry (m, 0) >= 0)) {
    72               catalog[0].measure[m].Mcal = 0.0;
     73              catalog[0].measure[m].McalPSF  = 0.0;
     74              catalog[0].measure[m].McalAPER = 0.0;
    7375            }
    7476          }
Note: See TracChangeset for help on using the changeset viewer.