IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 21, 2021, 4:49:23 PM (5 years ago)
Author:
eugene
Message:

add code to set Mflat based on Mgrid before final Mrel calculation

File:
1 edited

Legend:

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

    r41606 r41607  
    233233      // data for which the associated image has not been loaded (probably because of
    234234      // overlaps).  Msys + measure.Mcal is our best guess of the true magnitude
    235       Mmos = Mgrid = 0;
    236235      Mcal = measureT[k].McalPSF; // check that this is zero for loaded REF value
    237236    } else {
     
    243242      Mgrp  = getMgrp  (meas, cat, measureT[k].airmass, &dMgrp);
    244243      if (isnan(Mgrp))  SKIP_THIS_MEAS(Ngrp);
    245       Mgrid = getMgridTiny (&measureT[k]);
     244      Mgrid = isSetMrelFinal ? 0.0 : getMgridTiny (&measureT[k]);
    246245      if (isnan(Mgrid)) SKIP_THIS_MEAS(Ngrid);
    247246      Mflat = isnan (measureT[k].Mflat) ? 0.0 : measureT[k].Mflat;
    248247    }
     248    // on the final calculation of Mrel the value of Mgrid has been applied to Mflat, but
     249    // it has not been removed from the GridOps.c structures.  In order to avoid double-counting,
     250    // we need to skip Mgrid on the final calculation.
    249251
    250252    int myUbercalDist = getUbercalDist(meas, cat);
     
    562564  SecFilt *secfilt = &catalog[0].secfilt[ave*Nsecfilt];
    563565
    564   float McalPSF = 0, McalAPER = 0, Mmos = 0, Mgrid = 0;
     566  float McalPSF = 0, McalAPER = 0;
    565567
    566568  // set the primary projection cell and skycell for this coordinate
     
    726728      McalPSF  = measure[meas].McalPSF; // check that this is zero for loaded REF value
    727729      McalAPER = McalPSF; // check that this is zero for loaded REF value
    728       Mmos     = 0.0;
    729       Mgrid    = 0.0;
    730730    } else {
    731731      McalPSF   = getMcal  (measSeq, cat, MAG_CLASS_PSF);
    732732      McalAPER  = USE_MCAL_PSF_FOR_STACK_APER ? getMcal  (measSeq, cat, MAG_CLASS_PSF) : getMcal  (measSeq, cat, MAG_CLASS_KRON);
    733       Mmos      = getMmos  (measSeq, cat);
    734       Mgrid     = getMgrid (&measure[meas]);
    735       // XXX can Mmos and Mgrid exist for stacks?
    736733    }
    737734   
     
    769766    // get the zero point for the selected image
    770767    // Use a different zero point for the PSF-like and APERTURE-like magnitudes
    771     float zpPSF  = PhotZeroPoint (&measure[meas], &average[0], &secfilt[0]) - (McalPSF  + Mmos + Mgrid);
    772     float zpAPER = PhotZeroPoint (&measure[meas], &average[0], &secfilt[0]) - (McalAPER + Mmos + Mgrid);
     768    float zpPSF  = PhotZeroPoint (&measure[meas], &average[0], &secfilt[0]) - McalPSF;
     769    float zpAPER = PhotZeroPoint (&measure[meas], &average[0], &secfilt[0]) - McalAPER;
    773770
    774771    // zpFactor to go from instrumental flux to Janskies
Note: See TracChangeset for help on using the changeset viewer.