IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41608


Ignore:
Timestamp:
May 22, 2021, 1:44:24 PM (5 years ago)
Author:
eugene
Message:

fix inconsistency between Mgrid and Mflat

Location:
branches/eam_branches/relphot.20210521/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/relphot.20210521/src/GridOps.c

    r41607 r41608  
    188188        if (isnan(Mmos)) continue;
    189189
     190        float Mflat = getMflat (nm, nc, catalog);
     191        if (isnan(Mflat)) continue;
     192
    190193        // Mrel* is the average magnitude for this star.  For PS1 stacks, we have too much
    191194        // PSF variability.  We need to calibrate the PSF magnitudes separately from the
     
    200203        if (isnan(MsysPSF)) continue;
    201204
    202         // what about Mflat?
    203         float Moff =  Mcal + Mgrp + Mmos;
     205        float Moff =  Mcal + Mgrp + Mmos + Mflat;
    204206
    205207        // Msys = Mrel + Moff + Mgrid
     
    307309  for (off_t j = 0; j < catalog->Nmeasure; j++) {
    308310    float Mgrid = getMgrid (&catalog->measure[j]);
    309     catalog->measure[j].Mflat -= Mgrid;
    310   }
    311 }
    312 
     311    catalog->measure[j].Mflat += Mgrid;
     312  }
     313}
     314
  • branches/eam_branches/relphot.20210521/src/ImageOps.c

    r41606 r41608  
    636636      // apply that offset as well here for this image (in other words, each detection is
    637637      // being compared to the model, excluding the zero point, Mcal.  The model includes
    638       // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
     638      // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal + Mflat)
     639      // this was inconsistent w.r.t. PhotRel pre-r41606
    639640
    640641      float Mflat = getMflat (m, c, catalog);
     
    647648      }
    648649
    649       float Moff = Mmos + Mgrp + Mgrid - Mflat;
     650      float Moff = Mmos + Mgrp + Mgrid + Mflat;
    650651
    651652      PhotCode *code = GetPhotcodebyCode (catalog[c].measureT[m].photcode);
     
    830831      // apply that offset as well here for this image (in other words, each detection is
    831832      // being compared to the model, excluding the zero point, Mcal.  The model includes
    832       // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
     833      // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal + Mflat)
    833834
    834835      float Mflat = getMflat (m, c, catalog);
     
    842843      }
    843844
    844       float Moff = Mmos + Mgrp + Mgrid - Mflat;
     845      float Moff = Mmos + Mgrp + Mgrid + Mflat;
    845846
    846847      psfStars.alldata-> yVector[Nref] = MsysPSF - MrelPSF - Moff;
  • branches/eam_branches/relphot.20210521/src/MagResidSave.c

    r41606 r41608  
    233233    // apply that offset as well here for this image (in other words, each detection is
    234234    // being compared to the model, excluding the zero point, Mcal.  The model includes
    235     // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
     235    // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal + Mflat)
    236236
    237237    float Mflat = getMflat (m, c, catalog);
     
    248248    if (isnan(MsysPSF)) continue;
    249249
    250     float Moff = Mcal + Mmos + Mgrp + Mgrid - Mflat;
     250    float Moff = Mcal + Mmos + Mgrp + Mgrid + Mflat;
    251251
    252252    // Mrel is the true average apparent magnitude of this star
  • branches/eam_branches/relphot.20210521/src/MosaicOps.c

    r41606 r41608  
    10691069    // apply that offset as well here for this image (in other words, each detection is
    10701070    // being compared to the model, excluding the zero point, Mcal.  The model includes
    1071     // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
     1071    // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal + Mflat).
     1072    // this was inconsistent pre r41606
    10721073
    10731074    float Mflat = getMflat (m, c, catalog);
     
    10941095    assert (Nbright >= 0);
    10951096
    1096     float Moff =  Mcal + Mgrp + Mgrid - Mflat;
     1097    float Moff =  Mcal + Mgrp + Mgrid + Mflat;
    10971098
    10981099    psfStars->alldata-> yVector[N] = MsysPSF - MrelPSF - Moff;
     
    12051206    float MsysPSF = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_PSF);
    12061207   
    1207     float delta = MsysPSF - MrelPSF - Mcal - Mgrid + Mflat;
     1208    float delta = MsysPSF - MrelPSF - Mcal - Mgrid - Mflat;
    12081209
    12091210    int isBad = (catalog[c].measureT[m].dbFlags & MEAS_BAD);
  • branches/eam_branches/relphot.20210521/src/TGroupOps.c

    r41606 r41608  
    874874    // apply that offset as well here for this image (in other words, each detection is
    875875    // being compared to the model, excluding the zero point, Mcal.  The model includes
    876     // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
     876    // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal + Mflat)
     877    // this was inconsistent with PhotRel pre-r41606
    877878
    878879    float Mflat = getMflat (m, c, catalog);
     
    899900    assert (Nbright >= 0);
    900901
    901     float Moff =  Mcal + Mmos + Mgrid - Mflat;
     902    float Moff =  Mcal + Mmos + Mgrid + Mflat;
    902903
    903904    psfStars->alldata-> yVector[N] = MsysPSF - MrelPSF - Moff;
     
    10221023
    10231024    // for historical reasons, Mflat is defined with the wrong sign
    1024     float delta = MsysPSF - MrelPSF - Mcal - Mmos - Mgrid + Mflat - myTGroup->McalPSF;
     1025    float delta = MsysPSF - MrelPSF - Mcal - Mmos - Mgrid - Mflat - myTGroup->McalPSF;
    10251026
    10261027    int isBad = (catalog[c].measureT[m].dbFlags & MEAS_BAD);
     
    15031504        float MrelPSF  = getMrel  (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); // average magnitude
    15041505        // float Mgrid    = getMgridTiny (&catalog[c].measureT[m]); // camera offset (deprecated?)
    1505         // float Mflat    = getMflat (m, c, catalog); // flat-field correction
     1506        float Mflat    = getMflat (m, c, catalog); // flat-field correction
    15061507
    15071508        off_t n = catalog[c].measureT[m].averef;
     
    15111512
    15121513        // for historical reasons, Mflat is defined with the wrong sign
    1513         float delta = MsysPSF - MrelPSF - Mcal - Mmos - Mgrp;
     1514        float delta = MsysPSF - MrelPSF - Mcal - Mmos - Mgrp - Mflat;
    15141515
    15151516        fprintf (fout, "%f %f : %f %f : %f %f %f  : %f %f\n", catalog[c].averageT[n].R, catalog[c].averageT[n].D, MsysPSF, MrelPSF, Mcal, Mmos, Mgrp, catalog[c].measureT[m].airmass, delta);
  • branches/eam_branches/relphot.20210521/src/setMrelCatalog.c

    r41607 r41608  
    271271    float dMap = NAN;
    272272
    273     // XXX I am not convinced the sign on Mflat here is correct
    274     float Moff =  Mcal + Mmos + Mgrp + Mgrid - Mflat;
     273    // This definition is consistent with PhotRel: Mrel = Msys - Mcal - Mflat
     274    float Moff =  Mcal + Mmos + Mgrp + Mgrid + Mflat;
    275275
    276276    if (isSetMrelFinal) {
  • branches/eam_branches/relphot.20210521/src/setMrelFinal.c

    r41607 r41608  
    103103  ALLOCATE (catalog[0].measureRank, char, catalog[0].Nmeasure);
    104104  setMeasureRank (catalog);
    105   setMrelOutput (catalog, 1); // sets the values secfilt.MpsfChp = <measure.M + measure.Mflat - image.Mcal>
     105  setMrelOutput (catalog, 1); // sets the values secfilt.MpsfChp = <measure.M - image.Mcal - measure.Mflat>
    106106  setMcalOutput (catalog, 1); // sets measure.Mcal = image.Mcal
    107107
Note: See TracChangeset for help on using the changeset viewer.